app_list_controller_ash.cc revision 424c4d7b64af9d0d8fd9624f381f469654d5e3d2
1// Copyright (c) 2012 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" 6 7#include "ash/shell.h" 8#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 9 10AppListControllerDelegateAsh::AppListControllerDelegateAsh() {} 11 12AppListControllerDelegateAsh::~AppListControllerDelegateAsh() {} 13 14void AppListControllerDelegateAsh::DismissView() { 15 DCHECK(ash::Shell::HasInstance()); 16 if (ash::Shell::GetInstance()->GetAppListTargetVisibility()) 17 ash::Shell::GetInstance()->ToggleAppList(NULL); 18} 19 20gfx::NativeWindow AppListControllerDelegateAsh::GetAppListWindow() { 21 DCHECK(ash::Shell::HasInstance()); 22 return ash::Shell::GetInstance()->GetAppListWindow(); 23} 24 25bool AppListControllerDelegateAsh::IsAppPinned( 26 const std::string& extension_id) { 27 return ChromeLauncherController::instance()->IsAppPinned(extension_id); 28} 29 30void AppListControllerDelegateAsh::PinApp(const std::string& extension_id) { 31 ChromeLauncherController::instance()->PinAppWithID(extension_id); 32} 33 34void AppListControllerDelegateAsh::UnpinApp(const std::string& extension_id) { 35 ChromeLauncherController::instance()->UnpinAppWithID(extension_id); 36} 37 38bool AppListControllerDelegateAsh::CanPin() { 39 return ChromeLauncherController::instance()->CanPin(); 40} 41 42bool AppListControllerDelegateAsh::CanDoCreateShortcutsFlow( 43 bool is_platform_app) { 44 return false; 45} 46 47void AppListControllerDelegateAsh::CreateNewWindow(Profile* profile, 48 bool incognito) { 49 if (incognito) 50 ChromeLauncherController::instance()->CreateNewIncognitoWindow(); 51 else 52 ChromeLauncherController::instance()->CreateNewWindow(); 53} 54 55void AppListControllerDelegateAsh::ActivateApp( 56 Profile* profile, const extensions::Extension* extension, int event_flags) { 57 ChromeLauncherController::instance()->ActivateApp(extension->id(), 58 event_flags); 59 DismissView(); 60} 61 62void AppListControllerDelegateAsh::LaunchApp( 63 Profile* profile, const extensions::Extension* extension, int event_flags) { 64 ChromeLauncherController::instance()->LaunchApp(extension->id(), 65 event_flags); 66 DismissView(); 67} 68 69bool AppListControllerDelegateAsh::ShouldShowUserIcon() { 70 return false; 71} 72