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

Side by Side Diff: ash/root_window_controller.cc

Issue 11476033: [Launcher per display] Removed Shell::status_area_widget(), system_tray() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix style Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « ash/root_window_controller.h ('k') | ash/shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/desktop_background/desktop_background_widget_controller.h" 10 #include "ash/desktop_background/desktop_background_widget_controller.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 SetRootWindowController(root_window, this); 169 SetRootWindowController(root_window, this);
170 screen_dimmer_.reset(new ScreenDimmer(root_window)); 170 screen_dimmer_.reset(new ScreenDimmer(root_window));
171 } 171 }
172 172
173 RootWindowController::~RootWindowController() { 173 RootWindowController::~RootWindowController() {
174 Shutdown(); 174 Shutdown();
175 root_window_.reset(); 175 root_window_.reset();
176 } 176 }
177 177
178 // static 178 // static
179 internal::RootWindowController* 179 RootWindowController* RootWindowController::ForLauncher(aura::Window* window) {
180 RootWindowController::ForLauncher(aura::Window* window) {
181 if (Shell::IsLauncherPerDisplayEnabled()) 180 if (Shell::IsLauncherPerDisplayEnabled())
182 return GetRootWindowController(window->GetRootWindow()); 181 return GetRootWindowController(window->GetRootWindow());
183 else 182 else
184 return Shell::GetPrimaryRootWindowController(); 183 return Shell::GetPrimaryRootWindowController();
185 } 184 }
186 185
186 // static
187 RootWindowController* RootWindowController::ForWindow(aura::Window* window) {
188 return GetRootWindowController(window->GetRootWindow());
189 }
190
191 // static
192 RootWindowController* RootWindowController::ForActiveRootWindow() {
193 return GetRootWindowController(Shell::GetActiveRootWindow());
194 }
195
187 void RootWindowController::Shutdown() { 196 void RootWindowController::Shutdown() {
188 CloseChildWindows(); 197 CloseChildWindows();
189 if (Shell::GetActiveRootWindow() == root_window_.get()) { 198 if (Shell::GetActiveRootWindow() == root_window_.get()) {
190 Shell::GetInstance()->set_active_root_window( 199 Shell::GetInstance()->set_active_root_window(
191 Shell::GetPrimaryRootWindow() == root_window_.get() ? 200 Shell::GetPrimaryRootWindow() == root_window_.get() ?
192 NULL : Shell::GetPrimaryRootWindow()); 201 NULL : Shell::GetPrimaryRootWindow());
193 } 202 }
194 SetRootWindowController(root_window_.get(), NULL); 203 SetRootWindowController(root_window_.get(), NULL);
195 screen_dimmer_.reset(); 204 screen_dimmer_.reset();
196 workspace_controller_.reset(); 205 workspace_controller_.reset();
(...skipping 17 matching lines...) Expand all
214 RootWindowController::GetSystemModalLayoutManager(aura::Window* window) { 223 RootWindowController::GetSystemModalLayoutManager(aura::Window* window) {
215 aura::Window* container = NULL; 224 aura::Window* container = NULL;
216 if (window) { 225 if (window) {
217 if (window->parent() && 226 if (window->parent() &&
218 window->parent()->id() >= kShellWindowId_LockScreenContainer) { 227 window->parent()->id() >= kShellWindowId_LockScreenContainer) {
219 container = GetContainer(kShellWindowId_LockSystemModalContainer); 228 container = GetContainer(kShellWindowId_LockSystemModalContainer);
220 } else { 229 } else {
221 container = GetContainer(kShellWindowId_SystemModalContainer); 230 container = GetContainer(kShellWindowId_SystemModalContainer);
222 } 231 }
223 } else { 232 } else {
224 user::LoginStatus login = Shell::GetInstance()->status_area_widget() ? 233 user::LoginStatus login = Shell::GetInstance()->tray_delegate() ?
225 Shell::GetInstance()->tray_delegate()->GetUserLoginStatus() : 234 Shell::GetInstance()->tray_delegate()->GetUserLoginStatus() :
226 user::LOGGED_IN_NONE; 235 user::LOGGED_IN_NONE;
227 int modal_window_id = (login == user::LOGGED_IN_LOCKED || 236 int modal_window_id = (login == user::LOGGED_IN_LOCKED ||
228 login == user::LOGGED_IN_NONE) ? 237 login == user::LOGGED_IN_NONE) ?
229 kShellWindowId_LockSystemModalContainer : 238 kShellWindowId_LockSystemModalContainer :
230 kShellWindowId_SystemModalContainer; 239 kShellWindowId_SystemModalContainer;
231 container = GetContainer(modal_window_id); 240 container = GetContainer(modal_window_id);
232 } 241 }
233 return static_cast<SystemModalContainerLayoutManager*>( 242 return static_cast<SystemModalContainerLayoutManager*>(
234 container->layout_manager()); 243 container->layout_manager());
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 ReparentAllWindows(root_window_.get(), dst); 444 ReparentAllWindows(root_window_.get(), dst);
436 445
437 // Restore focused or active window if it's still alive. 446 // Restore focused or active window if it's still alive.
438 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { 447 if (focused && tracker.Contains(focused) && dst->Contains(focused)) {
439 aura::client::GetFocusClient(dst)->FocusWindow(focused, NULL); 448 aura::client::GetFocusClient(dst)->FocusWindow(focused, NULL);
440 } else if (active && tracker.Contains(active) && dst->Contains(active)) { 449 } else if (active && tracker.Contains(active) && dst->Contains(active)) {
441 activation_client->ActivateWindow(active); 450 activation_client->ActivateWindow(active);
442 } 451 }
443 } 452 }
444 453
454 SystemTray* RootWindowController::GetSystemTray() {
455 // We assume in throughout the code that this will not return NULL. If code
456 // triggers this for valid reasons, it should test status_area_widget first.
457 internal::StatusAreaWidget* status_area = status_area_widget();
458 CHECK(status_area);
459 return status_area->system_tray();
460 }
461
445 void RootWindowController::ShowContextMenu( 462 void RootWindowController::ShowContextMenu(
446 const gfx::Point& location_in_screen) { 463 const gfx::Point& location_in_screen) {
447 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ? 464 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ?
448 root_window() : Shell::GetPrimaryRootWindow(); 465 root_window() : Shell::GetPrimaryRootWindow();
449 DCHECK(Shell::GetInstance()->delegate()); 466 DCHECK(Shell::GetInstance()->delegate());
450 scoped_ptr<ui::MenuModel> menu_model( 467 scoped_ptr<ui::MenuModel> menu_model(
451 Shell::GetInstance()->delegate()->CreateContextMenu(target)); 468 Shell::GetInstance()->delegate()->CreateContextMenu(target));
452 469
453 views::MenuModelAdapter menu_model_adapter(menu_model.get()); 470 views::MenuModelAdapter menu_model_adapter(menu_model.get());
454 views::MenuRunner menu_runner(menu_model_adapter.CreateMenu()); 471 views::MenuRunner menu_runner(menu_model_adapter.CreateMenu());
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 "OverlayContainer", 656 "OverlayContainer",
640 lock_screen_related_containers); 657 lock_screen_related_containers);
641 SetUsesScreenCoordinates(overlay_container); 658 SetUsesScreenCoordinates(overlay_container);
642 659
643 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, 660 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
644 "PowerButtonAnimationContainer", root_window) ; 661 "PowerButtonAnimationContainer", root_window) ;
645 } 662 }
646 663
647 } // namespace internal 664 } // namespace internal
648 } // namespace ash 665 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.h ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698