OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" | 5 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" |
6 | 6 |
7 #include "ash/metrics/task_switch_metrics_recorder.h" | 7 #include "ash/metrics/task_switch_metrics_recorder.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
11 #include "chrome/browser/ui/browser_navigator_params.h" | 11 #include "chrome/browser/ui/browser_navigator_params.h" |
12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
| 13 #include "ui/app_list/shower/app_list_shower_impl.h" |
13 #include "ui/app_list/views/app_list_view.h" | 14 #include "ui/app_list/views/app_list_view.h" |
14 | 15 |
15 AppListControllerDelegateAsh::AppListControllerDelegateAsh() {} | 16 AppListControllerDelegateAsh::AppListControllerDelegateAsh( |
| 17 app_list::AppListShowerImpl* app_list_shower) |
| 18 : app_list_shower_(app_list_shower) {} |
16 | 19 |
17 AppListControllerDelegateAsh::~AppListControllerDelegateAsh() {} | 20 AppListControllerDelegateAsh::~AppListControllerDelegateAsh() {} |
18 | 21 |
19 void AppListControllerDelegateAsh::DismissView() { | 22 void AppListControllerDelegateAsh::DismissView() { |
20 DCHECK(ash::Shell::HasInstance()); | 23 app_list_shower_->Dismiss(); |
21 ash::Shell::GetInstance()->DismissAppList(); | |
22 } | 24 } |
23 | 25 |
24 gfx::NativeWindow AppListControllerDelegateAsh::GetAppListWindow() { | 26 gfx::NativeWindow AppListControllerDelegateAsh::GetAppListWindow() { |
25 DCHECK(ash::Shell::HasInstance()); | 27 return app_list_shower_->GetWindow(); |
26 return ash::Shell::GetInstance()->GetAppListWindow(); | |
27 } | 28 } |
28 | 29 |
29 gfx::Rect AppListControllerDelegateAsh::GetAppListBounds() { | 30 gfx::Rect AppListControllerDelegateAsh::GetAppListBounds() { |
30 app_list::AppListView* app_list_view = | 31 app_list::AppListView* app_list_view = app_list_shower_->GetView(); |
31 ash::Shell::GetInstance()->GetAppListView(); | |
32 if (app_list_view) | 32 if (app_list_view) |
33 return app_list_view->GetBoundsInScreen(); | 33 return app_list_view->GetBoundsInScreen(); |
34 return gfx::Rect(); | 34 return gfx::Rect(); |
35 } | 35 } |
36 | 36 |
37 gfx::ImageSkia AppListControllerDelegateAsh::GetWindowIcon() { | 37 gfx::ImageSkia AppListControllerDelegateAsh::GetWindowIcon() { |
38 return gfx::ImageSkia(); | 38 return gfx::ImageSkia(); |
39 } | 39 } |
40 | 40 |
41 bool AppListControllerDelegateAsh::IsAppPinned( | 41 bool AppListControllerDelegateAsh::IsAppPinned( |
(...skipping 10 matching lines...) Expand all Loading... |
52 } | 52 } |
53 | 53 |
54 AppListControllerDelegate::Pinnable AppListControllerDelegateAsh::GetPinnable( | 54 AppListControllerDelegate::Pinnable AppListControllerDelegateAsh::GetPinnable( |
55 const std::string& extension_id) { | 55 const std::string& extension_id) { |
56 return ChromeLauncherController::instance()->CanPin(extension_id) | 56 return ChromeLauncherController::instance()->CanPin(extension_id) |
57 ? PIN_EDITABLE | 57 ? PIN_EDITABLE |
58 : PIN_FIXED; | 58 : PIN_FIXED; |
59 } | 59 } |
60 | 60 |
61 void AppListControllerDelegateAsh::OnShowChildDialog() { | 61 void AppListControllerDelegateAsh::OnShowChildDialog() { |
62 app_list::AppListView* app_list_view = | 62 app_list::AppListView* app_list_view = app_list_shower_->GetView(); |
63 ash::Shell::GetInstance()->GetAppListView(); | |
64 if (app_list_view) | 63 if (app_list_view) |
65 app_list_view->SetAppListOverlayVisible(true); | 64 app_list_view->SetAppListOverlayVisible(true); |
66 } | 65 } |
67 | 66 |
68 void AppListControllerDelegateAsh::OnCloseChildDialog() { | 67 void AppListControllerDelegateAsh::OnCloseChildDialog() { |
69 app_list::AppListView* app_list_view = | 68 app_list::AppListView* app_list_view = app_list_shower_->GetView(); |
70 ash::Shell::GetInstance()->GetAppListView(); | |
71 if (app_list_view) | 69 if (app_list_view) |
72 app_list_view->SetAppListOverlayVisible(false); | 70 app_list_view->SetAppListOverlayVisible(false); |
73 } | 71 } |
74 | 72 |
75 bool AppListControllerDelegateAsh::CanDoCreateShortcutsFlow() { | 73 bool AppListControllerDelegateAsh::CanDoCreateShortcutsFlow() { |
76 return false; | 74 return false; |
77 } | 75 } |
78 | 76 |
79 void AppListControllerDelegateAsh::DoCreateShortcutsFlow( | 77 void AppListControllerDelegateAsh::DoCreateShortcutsFlow( |
80 Profile* profile, | 78 Profile* profile, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 AppListSource source) { | 148 AppListSource source) { |
151 switch (source) { | 149 switch (source) { |
152 case LAUNCH_FROM_APP_LIST: | 150 case LAUNCH_FROM_APP_LIST: |
153 return ash::LAUNCH_FROM_APP_LIST; | 151 return ash::LAUNCH_FROM_APP_LIST; |
154 case LAUNCH_FROM_APP_LIST_SEARCH: | 152 case LAUNCH_FROM_APP_LIST_SEARCH: |
155 return ash::LAUNCH_FROM_APP_LIST_SEARCH; | 153 return ash::LAUNCH_FROM_APP_LIST_SEARCH; |
156 default: | 154 default: |
157 return ash::LAUNCH_FROM_UNKNOWN; | 155 return ash::LAUNCH_FROM_UNKNOWN; |
158 } | 156 } |
159 } | 157 } |
OLD | NEW |