Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: chrome/browser/ui/ash/app_list/app_list_controller_ash.cc

Issue 1770993002: wip: Refactoring Ash's AppListController, moving the bulk of the logic to chrome/browser/ui/ash/app… Base URL: https://chromium.googlesource.com/chromium/src.git@small_5_apps
Patch Set: Added a comment for PostTask in AppListServiceAsh. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/app_list/app_list_shower_ash.h"
9 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
10 #include "chrome/browser/ui/browser_navigator.h" 11 #include "chrome/browser/ui/browser_navigator.h"
11 #include "chrome/browser/ui/browser_navigator_params.h" 12 #include "chrome/browser/ui/browser_navigator_params.h"
12 #include "extensions/common/extension.h" 13 #include "extensions/common/extension.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 AppListShowerAsh* 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 DCHECK(ash::Shell::HasInstance());
21 ash::Shell::GetInstance()->DismissAppList(); 24 ash::Shell::GetInstance()->DismissAppList();
xiyuan 2016/03/11 18:36:00 Call app_list_shower_->Dismiss(). It looks like we
mfomitchev 2016/03/24 17:47:29 Done. Shell is still used in one place unfortunate
22 } 25 }
23 26
24 gfx::NativeWindow AppListControllerDelegateAsh::GetAppListWindow() { 27 gfx::NativeWindow AppListControllerDelegateAsh::GetAppListWindow() {
25 DCHECK(ash::Shell::HasInstance()); 28 return app_list_shower_->GetWindow();
26 return ash::Shell::GetInstance()->GetAppListWindow();
27 } 29 }
28 30
29 gfx::Rect AppListControllerDelegateAsh::GetAppListBounds() { 31 gfx::Rect AppListControllerDelegateAsh::GetAppListBounds() {
30 app_list::AppListView* app_list_view = 32 app_list::AppListView* app_list_view = app_list_shower_->GetView();
31 ash::Shell::GetInstance()->GetAppListView();
32 if (app_list_view) 33 if (app_list_view)
33 return app_list_view->GetBoundsInScreen(); 34 return app_list_view->GetBoundsInScreen();
34 return gfx::Rect(); 35 return gfx::Rect();
35 } 36 }
36 37
37 gfx::ImageSkia AppListControllerDelegateAsh::GetWindowIcon() { 38 gfx::ImageSkia AppListControllerDelegateAsh::GetWindowIcon() {
38 return gfx::ImageSkia(); 39 return gfx::ImageSkia();
39 } 40 }
40 41
41 bool AppListControllerDelegateAsh::IsAppPinned( 42 bool AppListControllerDelegateAsh::IsAppPinned(
(...skipping 10 matching lines...) Expand all
52 } 53 }
53 54
54 AppListControllerDelegate::Pinnable AppListControllerDelegateAsh::GetPinnable( 55 AppListControllerDelegate::Pinnable AppListControllerDelegateAsh::GetPinnable(
55 const std::string& extension_id) { 56 const std::string& extension_id) {
56 return ChromeLauncherController::instance()->CanPin(extension_id) 57 return ChromeLauncherController::instance()->CanPin(extension_id)
57 ? PIN_EDITABLE 58 ? PIN_EDITABLE
58 : PIN_FIXED; 59 : PIN_FIXED;
59 } 60 }
60 61
61 void AppListControllerDelegateAsh::OnShowChildDialog() { 62 void AppListControllerDelegateAsh::OnShowChildDialog() {
62 app_list::AppListView* app_list_view = 63 app_list::AppListView* app_list_view = app_list_shower_->GetView();
63 ash::Shell::GetInstance()->GetAppListView();
64 if (app_list_view) 64 if (app_list_view)
65 app_list_view->SetAppListOverlayVisible(true); 65 app_list_view->SetAppListOverlayVisible(true);
66 } 66 }
67 67
68 void AppListControllerDelegateAsh::OnCloseChildDialog() { 68 void AppListControllerDelegateAsh::OnCloseChildDialog() {
69 app_list::AppListView* app_list_view = 69 app_list::AppListView* app_list_view = app_list_shower_->GetView();
70 ash::Shell::GetInstance()->GetAppListView();
71 if (app_list_view) 70 if (app_list_view)
72 app_list_view->SetAppListOverlayVisible(false); 71 app_list_view->SetAppListOverlayVisible(false);
73 } 72 }
74 73
75 bool AppListControllerDelegateAsh::CanDoCreateShortcutsFlow() { 74 bool AppListControllerDelegateAsh::CanDoCreateShortcutsFlow() {
76 return false; 75 return false;
77 } 76 }
78 77
79 void AppListControllerDelegateAsh::DoCreateShortcutsFlow( 78 void AppListControllerDelegateAsh::DoCreateShortcutsFlow(
80 Profile* profile, 79 Profile* profile,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 AppListSource source) { 149 AppListSource source) {
151 switch (source) { 150 switch (source) {
152 case LAUNCH_FROM_APP_LIST: 151 case LAUNCH_FROM_APP_LIST:
153 return ash::LAUNCH_FROM_APP_LIST; 152 return ash::LAUNCH_FROM_APP_LIST;
154 case LAUNCH_FROM_APP_LIST_SEARCH: 153 case LAUNCH_FROM_APP_LIST_SEARCH:
155 return ash::LAUNCH_FROM_APP_LIST_SEARCH; 154 return ash::LAUNCH_FROM_APP_LIST_SEARCH;
156 default: 155 default:
157 return ash::LAUNCH_FROM_UNKNOWN; 156 return ash::LAUNCH_FROM_UNKNOWN;
158 } 157 }
159 } 158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698