app_list_controller_ash.cc revision 5821806d5e7f356e8fa4b058a389a808ea183019
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::CloseView() {
15  DCHECK(ash::Shell::HasInstance());
16  if (ash::Shell::GetInstance()->GetAppListTargetVisibility())
17    ash::Shell::GetInstance()->ToggleAppList();
18}
19
20bool AppListControllerDelegateAsh::IsAppPinned(
21    const std::string& extension_id) {
22  return ChromeLauncherController::instance()->IsAppPinned(extension_id);
23}
24
25void AppListControllerDelegateAsh::PinApp(const std::string& extension_id) {
26  ChromeLauncherController::instance()->PinAppWithID(extension_id);
27}
28
29void AppListControllerDelegateAsh::UnpinApp(const std::string& extension_id) {
30  ChromeLauncherController::instance()->UnpinAppsWithID(extension_id);
31}
32
33bool AppListControllerDelegateAsh::CanPin() {
34  return ChromeLauncherController::instance()->CanPin();
35}
36
37bool AppListControllerDelegateAsh::CanShowCreateShortcutsDialog() {
38  return false;
39}
40
41void AppListControllerDelegateAsh::CreateNewWindow(bool incognito) {
42  if (incognito)
43    ChromeLauncherController::instance()->CreateNewIncognitoWindow();
44  else
45    ChromeLauncherController::instance()->CreateNewWindow();
46}
47
48void AppListControllerDelegateAsh::ActivateApp(Profile* profile,
49                                               const std::string& extension_id,
50                                               int event_flags) {
51  ChromeLauncherController::instance()->ActivateApp(extension_id, event_flags);
52  CloseView();
53}
54
55void AppListControllerDelegateAsh::LaunchApp(Profile* profile,
56                                             const std::string& extension_id,
57                                             int event_flags) {
58  ChromeLauncherController::instance()->LaunchApp(extension_id, event_flags);
59  CloseView();
60}
61