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

Side by Side Diff: chrome/browser/ui/ash/chrome_shell_delegate.cc

Issue 508813002: Move ownership of the AppListViewDelegate into the AppListService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 6 years, 3 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/chrome_shell_delegate.h" 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
6 6
7 #include "ash/content_support/gpu_support_impl.h" 7 #include "ash/content_support/gpu_support_impl.h"
8 #include "ash/magnifier/magnifier_constants.h" 8 #include "ash/magnifier/magnifier_constants.h"
9 #include "ash/wm/window_state.h" 9 #include "ash/wm/window_state.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
11 #include "chrome/browser/app_mode/app_mode_utils.h" 11 #include "chrome/browser/app_mode/app_mode_utils.h"
12 #include "chrome/browser/lifetime/application_lifetime.h" 12 #include "chrome/browser/lifetime/application_lifetime.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/profiles/profiles_state.h" 14 #include "chrome/browser/profiles/profiles_state.h"
15 #include "chrome/browser/ui/app_list/app_list_service.h"
16 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" 15 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
17 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" 16 #include "chrome/browser/ui/ash/app_list/app_list_service_ash.h"
18 #include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h" 17 #include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h"
19 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 18 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
20 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" 19 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h"
21 #include "chrome/browser/ui/browser_commands.h" 20 #include "chrome/browser/ui/browser_commands.h"
22 #include "chrome/grit/chromium_strings.h" 21 #include "chrome/grit/chromium_strings.h"
23 #include "components/signin/core/common/profile_management_switches.h" 22 #include "components/signin/core/common/profile_management_switches.h"
24 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
25 24
26 #if defined(OS_CHROMEOS) 25 #if defined(OS_CHROMEOS)
27 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 26 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 chrome::AttemptUserExit(); 94 chrome::AttemptUserExit();
96 } 95 }
97 96
98 content::BrowserContext* ChromeShellDelegate::GetActiveBrowserContext() { 97 content::BrowserContext* ChromeShellDelegate::GetActiveBrowserContext() {
99 #if defined(OS_CHROMEOS) 98 #if defined(OS_CHROMEOS)
100 DCHECK(user_manager::UserManager::Get()->GetLoggedInUsers().size()); 99 DCHECK(user_manager::UserManager::Get()->GetLoggedInUsers().size());
101 #endif 100 #endif
102 return ProfileManager::GetActiveUserProfile(); 101 return ProfileManager::GetActiveUserProfile();
103 } 102 }
104 103
105 app_list::AppListViewDelegate* 104 app_list::AppListViewDelegate* ChromeShellDelegate::GetAppListViewDelegate() {
106 ChromeShellDelegate::CreateAppListViewDelegate() {
107 DCHECK(ash::Shell::HasInstance()); 105 DCHECK(ash::Shell::HasInstance());
108 // Shell will own the created delegate, and the delegate will own 106 return AppListServiceAsh::GetInstance()->GetViewDelegate(
109 // the controller. 107 Profile::FromBrowserContext(GetActiveBrowserContext()));
110 return new AppListViewDelegate(
111 Profile::FromBrowserContext(GetActiveBrowserContext()),
112 AppListService::Get(chrome::HOST_DESKTOP_TYPE_ASH)->
113 GetControllerDelegate());
114 } 108 }
115 109
116 ash::ShelfDelegate* ChromeShellDelegate::CreateShelfDelegate( 110 ash::ShelfDelegate* ChromeShellDelegate::CreateShelfDelegate(
117 ash::ShelfModel* model) { 111 ash::ShelfModel* model) {
118 if (!shelf_delegate_) { 112 if (!shelf_delegate_) {
119 shelf_delegate_ = ChromeLauncherController::CreateInstance(NULL, model); 113 shelf_delegate_ = ChromeLauncherController::CreateInstance(NULL, model);
120 shelf_delegate_->Init(); 114 shelf_delegate_->Init();
121 } 115 }
122 return shelf_delegate_; 116 return shelf_delegate_;
123 } 117 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 153
160 void ChromeShellDelegate::AddVirtualKeyboardStateObserver( 154 void ChromeShellDelegate::AddVirtualKeyboardStateObserver(
161 ash::VirtualKeyboardStateObserver* observer) { 155 ash::VirtualKeyboardStateObserver* observer) {
162 keyboard_state_observer_list_.AddObserver(observer); 156 keyboard_state_observer_list_.AddObserver(observer);
163 } 157 }
164 158
165 void ChromeShellDelegate::RemoveVirtualKeyboardStateObserver( 159 void ChromeShellDelegate::RemoveVirtualKeyboardStateObserver(
166 ash::VirtualKeyboardStateObserver* observer) { 160 ash::VirtualKeyboardStateObserver* observer) {
167 keyboard_state_observer_list_.RemoveObserver(observer); 161 keyboard_state_observer_list_.RemoveObserver(observer);
168 } 162 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.h ('k') | ui/app_list/cocoa/app_list_view_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698