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

Side by Side Diff: ash/root_window_controller.cc

Issue 12313118: Refactor: Shelf Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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 "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_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/desktop_background/desktop_background_widget_controller.h" 11 #include "ash/desktop_background/desktop_background_widget_controller.h"
12 #include "ash/display/display_controller.h" 12 #include "ash/display/display_controller.h"
13 #include "ash/display/display_manager.h" 13 #include "ash/display/display_manager.h"
14 #include "ash/focus_cycler.h" 14 #include "ash/focus_cycler.h"
15 #include "ash/shelf_types.h" 15 #include "ash/shelf/shelf_layout_manager.h"
16 #include "ash/shelf/shelf_types.h"
17 #include "ash/shelf/shelf_widget.h"
16 #include "ash/shell.h" 18 #include "ash/shell.h"
17 #include "ash/shell_delegate.h" 19 #include "ash/shell_delegate.h"
18 #include "ash/shell_factory.h" 20 #include "ash/shell_factory.h"
19 #include "ash/shell_window_ids.h" 21 #include "ash/shell_window_ids.h"
20 #include "ash/system/status_area_widget.h" 22 #include "ash/system/status_area_widget.h"
21 #include "ash/system/tray/system_tray_delegate.h" 23 #include "ash/system/tray/system_tray_delegate.h"
22 #include "ash/wm/base_layout_manager.h" 24 #include "ash/wm/base_layout_manager.h"
23 #include "ash/wm/boot_splash_screen.h" 25 #include "ash/wm/boot_splash_screen.h"
24 #include "ash/wm/panel_layout_manager.h" 26 #include "ash/wm/panel_layout_manager.h"
25 #include "ash/wm/property_util.h" 27 #include "ash/wm/property_util.h"
26 #include "ash/wm/root_window_layout_manager.h" 28 #include "ash/wm/root_window_layout_manager.h"
27 #include "ash/wm/screen_dimmer.h" 29 #include "ash/wm/screen_dimmer.h"
28 #include "ash/wm/shelf_layout_manager.h"
29 #include "ash/wm/stacking_controller.h" 30 #include "ash/wm/stacking_controller.h"
30 #include "ash/wm/status_area_layout_manager.h" 31 #include "ash/wm/status_area_layout_manager.h"
31 #include "ash/wm/system_background_controller.h" 32 #include "ash/wm/system_background_controller.h"
32 #include "ash/wm/system_modal_container_layout_manager.h" 33 #include "ash/wm/system_modal_container_layout_manager.h"
33 #include "ash/wm/toplevel_window_event_handler.h" 34 #include "ash/wm/toplevel_window_event_handler.h"
34 #include "ash/wm/window_properties.h" 35 #include "ash/wm/window_properties.h"
35 #include "ash/wm/workspace_controller.h" 36 #include "ash/wm/workspace_controller.h"
36 #include "base/command_line.h" 37 #include "base/command_line.h"
37 #include "base/time.h" 38 #include "base/time.h"
38 #include "ui/aura/client/activation_client.h" 39 #include "ui/aura/client/activation_client.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 container->SetProperty(internal::kUsesScreenCoordinatesKey, true); 159 container->SetProperty(internal::kUsesScreenCoordinatesKey, true);
159 } 160 }
160 161
161 } // namespace 162 } // namespace
162 163
163 namespace internal { 164 namespace internal {
164 165
165 RootWindowController::RootWindowController(aura::RootWindow* root_window) 166 RootWindowController::RootWindowController(aura::RootWindow* root_window)
166 : root_window_(root_window), 167 : root_window_(root_window),
167 root_window_layout_(NULL), 168 root_window_layout_(NULL),
168 status_area_widget_(NULL),
169 shelf_(NULL), 169 shelf_(NULL),
170 panel_layout_manager_(NULL) { 170 panel_layout_manager_(NULL) {
171 SetRootWindowController(root_window, this); 171 SetRootWindowController(root_window, this);
172 screen_dimmer_.reset(new ScreenDimmer(root_window)); 172 screen_dimmer_.reset(new ScreenDimmer(root_window));
173 173
174 stacking_controller_.reset(new ash::StackingController); 174 stacking_controller_.reset(new ash::StackingController);
175 aura::client::SetStackingClient(root_window, stacking_controller_.get()); 175 aura::client::SetStackingClient(root_window, stacking_controller_.get());
176 } 176 }
177 177
178 RootWindowController::~RootWindowController() { 178 RootWindowController::~RootWindowController() {
(...skipping 30 matching lines...) Expand all
209 SetRootWindowController(root_window_.get(), NULL); 209 SetRootWindowController(root_window_.get(), NULL);
210 screen_dimmer_.reset(); 210 screen_dimmer_.reset();
211 workspace_controller_.reset(); 211 workspace_controller_.reset();
212 // Forget with the display ID so that display lookup 212 // Forget with the display ID so that display lookup
213 // ends up with invalid display. 213 // ends up with invalid display.
214 root_window_->ClearProperty(kDisplayIdKey); 214 root_window_->ClearProperty(kDisplayIdKey);
215 // And this root window should no longer process events. 215 // And this root window should no longer process events.
216 root_window_->PrepareForShutdown(); 216 root_window_->PrepareForShutdown();
217 217
218 system_background_.reset(); 218 system_background_.reset();
219
220 // Launcher widget has an InputMethodBridge that references to
221 // |input_method_filter_|'s |input_method_|. So explicitly release
222 // |launcher_| before |input_method_filter_|. And this needs to be
223 // after we delete all containers in case there are still live
224 // browser windows which access LauncherModel during close.
225 launcher_.reset();
226 } 219 }
227 220
228 SystemModalContainerLayoutManager* 221 SystemModalContainerLayoutManager*
229 RootWindowController::GetSystemModalLayoutManager(aura::Window* window) { 222 RootWindowController::GetSystemModalLayoutManager(aura::Window* window) {
230 aura::Window* container = NULL; 223 aura::Window* container = NULL;
231 if (window) { 224 if (window) {
232 if (window->parent() && 225 if (window->parent() &&
233 window->parent()->id() >= kShellWindowId_LockScreenContainer) { 226 window->parent()->id() >= kShellWindowId_LockScreenContainer) {
234 container = GetContainer(kShellWindowId_LockSystemModalContainer); 227 container = GetContainer(kShellWindowId_LockSystemModalContainer);
235 } else { 228 } else {
(...skipping 29 matching lines...) Expand all
265 new WorkspaceController(default_container)); 258 new WorkspaceController(default_container));
266 259
267 aura::Window* always_on_top_container = 260 aura::Window* always_on_top_container =
268 GetContainer(kShellWindowId_AlwaysOnTopContainer); 261 GetContainer(kShellWindowId_AlwaysOnTopContainer);
269 always_on_top_container->SetLayoutManager( 262 always_on_top_container->SetLayoutManager(
270 new BaseLayoutManager( 263 new BaseLayoutManager(
271 always_on_top_container->GetRootWindow())); 264 always_on_top_container->GetRootWindow()));
272 } 265 }
273 266
274 void RootWindowController::InitForPrimaryDisplay() { 267 void RootWindowController::InitForPrimaryDisplay() {
275 DCHECK(!status_area_widget_); 268 DCHECK(!shelf_.get());
269 aura::Window* shelf_container =
270 GetContainer(ash::internal::kShellWindowId_ShelfContainer);
271 // TODO(harrym): Remove when status area is view.
276 aura::Window* status_container = 272 aura::Window* status_container =
277 GetContainer(ash::internal::kShellWindowId_StatusContainer); 273 GetContainer(ash::internal::kShellWindowId_StatusContainer);
278 // Initialize Primary RootWindow specific items. 274 shelf_.reset(new ash::ShelfWidget(
279 status_area_widget_ = new internal::StatusAreaWidget(status_container); 275 shelf_container, status_container, workspace_controller()));
280 status_area_widget_->CreateTrayViews();
281 // Login screen manages status area visibility by itself.
282 ShellDelegate* shell_delegate = Shell::GetInstance()->delegate();
283 if (shell_delegate->IsSessionStarted())
284 status_area_widget_->Show();
285
286 Shell::GetInstance()->focus_cycler()->AddWidget(status_area_widget_);
287
288 internal::ShelfLayoutManager* shelf_layout_manager =
289 new internal::ShelfLayoutManager(status_area_widget_);
290 GetContainer(internal::kShellWindowId_LauncherContainer)->
291 SetLayoutManager(shelf_layout_manager);
292 shelf_ = shelf_layout_manager;
293
294 internal::StatusAreaLayoutManager* status_area_layout_manager =
295 new internal::StatusAreaLayoutManager(shelf_layout_manager);
296 GetContainer(internal::kShellWindowId_StatusContainer)->
297 SetLayoutManager(status_area_layout_manager);
298
299 shelf_layout_manager->set_workspace_controller(
300 workspace_controller());
301
302 workspace_controller()->SetShelf(shelf_);
303 276
304 if (Shell::IsLauncherPerDisplayEnabled() || 277 if (Shell::IsLauncherPerDisplayEnabled() ||
305 root_window_ == Shell::GetPrimaryRootWindow()) { 278 root_window_ == Shell::GetPrimaryRootWindow()) {
306 // Create Panel layout manager 279 // Create Panel layout manager
307 aura::Window* panel_container = GetContainer( 280 aura::Window* panel_container = GetContainer(
308 internal::kShellWindowId_PanelContainer); 281 internal::kShellWindowId_PanelContainer);
309 panel_layout_manager_ = 282 panel_layout_manager_ =
310 new internal::PanelLayoutManager(panel_container); 283 new internal::PanelLayoutManager(panel_container);
311 panel_container_handler_.reset( 284 panel_container_handler_.reset(
312 new ToplevelWindowEventHandler(panel_container)); 285 new ToplevelWindowEventHandler(panel_container));
313 panel_container->SetLayoutManager(panel_layout_manager_); 286 panel_container->SetLayoutManager(panel_layout_manager_);
287 if (Shell::GetInstance()->delegate()->IsUserLoggedIn())
Mr4D (OOO till 08-26) 2013/03/04 19:18:04 Are you sure that you want to move this into the "
Harry McCleave 2013/03/04 20:29:24 Done.
288 shelf_->CreateLauncher();
314 } 289 }
315
316 if (shell_delegate->IsUserLoggedIn())
317 CreateLauncher();
318 } 290 }
319 291
320 void RootWindowController::CreateContainers() { 292 void RootWindowController::CreateContainers() {
321 CreateContainersInRootWindow(root_window_.get()); 293 CreateContainersInRootWindow(root_window_.get());
322 } 294 }
323 295
324 void RootWindowController::CreateSystemBackground( 296 void RootWindowController::CreateSystemBackground(
325 bool is_first_run_after_boot) { 297 bool is_first_run_after_boot) {
326 SkColor color = SK_ColorBLACK; 298 SkColor color = SK_ColorBLACK;
327 #if defined(OS_CHROMEOS) 299 #if defined(OS_CHROMEOS)
328 if (is_first_run_after_boot) 300 if (is_first_run_after_boot)
329 color = kChromeOsBootColor; 301 color = kChromeOsBootColor;
330 #endif 302 #endif
331 system_background_.reset( 303 system_background_.reset(
332 new SystemBackgroundController(root_window_.get(), color)); 304 new SystemBackgroundController(root_window_.get(), color));
333 305
334 #if defined(OS_CHROMEOS) 306 #if defined(OS_CHROMEOS)
335 // Make a copy of the system's boot splash screen so we can composite it 307 // Make a copy of the system's boot splash screen so we can composite it
336 // onscreen until the desktop background is ready. 308 // onscreen until the desktop background is ready.
337 if (is_first_run_after_boot && 309 if (is_first_run_after_boot &&
338 (CommandLine::ForCurrentProcess()->HasSwitch( 310 (CommandLine::ForCurrentProcess()->HasSwitch(
339 switches::kAshCopyHostBackgroundAtBoot) || 311 switches::kAshCopyHostBackgroundAtBoot) ||
340 CommandLine::ForCurrentProcess()->HasSwitch( 312 CommandLine::ForCurrentProcess()->HasSwitch(
341 switches::kAshAnimateFromBootSplashScreen))) 313 switches::kAshAnimateFromBootSplashScreen)))
342 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get())); 314 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get()));
343 #endif 315 #endif
344 } 316 }
345 317
346 void RootWindowController::CreateLauncher() { 318 void RootWindowController::OnLauncherCreated() {
347 if (launcher_.get()) 319 panel_layout_manager_->SetLauncher(shelf_->launcher());
Mr4D (OOO till 08-26) 2013/03/04 19:18:04 Shouldn't this be: if (panel_layout_manager_) {..}
Harry McCleave 2013/03/04 20:29:24 Done.
348 return;
349
350 aura::Window* default_container =
351 GetContainer(internal::kShellWindowId_DefaultContainer);
352 // Get the delegate first to make sure the launcher model is created.
353 LauncherDelegate* launcher_delegate =
354 Shell::GetInstance()->GetLauncherDelegate();
355 launcher_.reset(new Launcher(Shell::GetInstance()->launcher_model(),
356 launcher_delegate,
357 default_container,
358 shelf_));
359
360 launcher_->SetFocusCycler(Shell::GetInstance()->focus_cycler());
361 shelf_->SetLauncher(launcher_.get());
362
363 if (panel_layout_manager_)
364 panel_layout_manager_->SetLauncher(launcher_.get());
365
366 ShellDelegate* delegate = Shell::GetInstance()->delegate();
367 if (delegate)
368 launcher_->SetVisible(delegate->IsSessionStarted());
369 launcher_->widget()->Show();
370 } 320 }
371 321
372 void RootWindowController::ShowLauncher() { 322 void RootWindowController::ShowLauncher() {
373 if (!launcher_.get()) 323 if (!shelf_->launcher())
Mr4D (OOO till 08-26) 2013/03/04 19:18:04 Since shelf_ can also be NULL - shouldn't we test
Harry McCleave 2013/03/04 20:29:24 Done.
374 return; 324 return;
375 launcher_->SetVisible(true); 325 shelf_->launcher()->SetVisible(true);
376 status_area_widget_->Show(); 326 shelf_->status_area_widget()->Show();
377 } 327 }
378 328
379 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { 329 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) {
380 // TODO(oshima): remove if when launcher per display is enabled by 330 // TODO(oshima): remove if when launcher per display is enabled by
381 // default. 331 // default.
382 if (shelf_) 332 if (shelf_)
383 shelf_->UpdateVisibilityState(); 333 shelf_->shelf_layout_manager()->UpdateVisibilityState();
384 } 334 }
385 335
386 void RootWindowController::UpdateAfterLoginStatusChange( 336 void RootWindowController::UpdateAfterLoginStatusChange(
387 user::LoginStatus status) { 337 user::LoginStatus status) {
388 if (status_area_widget_) 338 if (shelf_->status_area_widget())
Mr4D (OOO till 08-26) 2013/03/04 19:18:04 same here.
Harry McCleave 2013/03/04 20:29:24 Done.
389 status_area_widget_->UpdateAfterLoginStatusChange(status); 339 shelf_->status_area_widget()->UpdateAfterLoginStatusChange(status);
390 } 340 }
391 341
392 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() { 342 void RootWindowController::HandleInitialDesktopBackgroundAnimationStarted() {
393 if (CommandLine::ForCurrentProcess()->HasSwitch( 343 if (CommandLine::ForCurrentProcess()->HasSwitch(
394 switches::kAshAnimateFromBootSplashScreen) && 344 switches::kAshAnimateFromBootSplashScreen) &&
395 boot_splash_screen_.get()) { 345 boot_splash_screen_.get()) {
396 // Make the splash screen fade out so it doesn't obscure the desktop 346 // Make the splash screen fade out so it doesn't obscure the desktop
397 // wallpaper's brightness/grayscale animation. 347 // wallpaper's brightness/grayscale animation.
398 boot_splash_screen_->StartHideAnimation( 348 boot_splash_screen_->StartHideAnimation(
399 base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs)); 349 base::TimeDelta::FromMilliseconds(kBootSplashScreenHideDurationMs));
400 } 350 }
401 } 351 }
402 352
403 void RootWindowController::HandleDesktopBackgroundVisible() { 353 void RootWindowController::HandleDesktopBackgroundVisible() {
404 system_background_->SetColor(SK_ColorBLACK); 354 system_background_->SetColor(SK_ColorBLACK);
405 boot_splash_screen_.reset(); 355 boot_splash_screen_.reset();
406 } 356 }
407 357
408 void RootWindowController::CloseChildWindows() { 358 void RootWindowController::CloseChildWindows() {
409 // The status area needs to be shut down before the windows are destroyed.
410 if (status_area_widget_) {
411 status_area_widget_->Shutdown();
412 status_area_widget_ = NULL;
413 }
414
415 // panel_layout_manager_ needs to be shut down before windows are destroyed. 359 // panel_layout_manager_ needs to be shut down before windows are destroyed.
416 if (panel_layout_manager_) { 360 if (panel_layout_manager_) {
417 panel_layout_manager_->Shutdown(); 361 panel_layout_manager_->Shutdown();
418 panel_layout_manager_ = NULL; 362 panel_layout_manager_ = NULL;
419 } 363 }
420 364
421 // Closing the windows frees the workspace controller. 365 // TODO(HarryM): Remove when Status Area Widget is a child view.
422 if (shelf_) 366 if (shelf_.get() && shelf_->status_area_widget())
423 shelf_->set_workspace_controller(NULL); 367 shelf_->status_area_widget()->Shutdown();
368
369 if (shelf_.get() && shelf_->shelf_layout_manager())
370 shelf_->shelf_layout_manager()->set_workspace_controller(NULL);
424 371
425 // Close background widget first as it depends on tooltip. 372 // Close background widget first as it depends on tooltip.
426 root_window_->SetProperty(kDesktopController, 373 root_window_->SetProperty(kDesktopController,
427 static_cast<DesktopBackgroundWidgetController*>(NULL)); 374 static_cast<DesktopBackgroundWidgetController*>(NULL));
428 root_window_->SetProperty(kAnimatingDesktopController, 375 root_window_->SetProperty(kAnimatingDesktopController,
429 static_cast<AnimatingDesktopController*>(NULL)); 376 static_cast<AnimatingDesktopController*>(NULL));
430 377
431 workspace_controller_.reset(); 378 workspace_controller_.reset();
432 aura::client::SetTooltipClient(root_window_.get(), NULL); 379 aura::client::SetTooltipClient(root_window_.get(), NULL);
433 380
434 while (!root_window_->children().empty()) { 381 while (!root_window_->children().empty()) {
435 aura::Window* child = root_window_->children()[0]; 382 aura::Window* child = root_window_->children()[0];
436 delete child; 383 delete child;
437 } 384 }
438 launcher_.reset(); 385
439 // All containers are deleted, so reset shelf_. 386 if (shelf_.get())
Mr4D (OOO till 08-26) 2013/03/04 19:18:04 You don't need the if (shelf_.get()) here - you ca
Harry McCleave 2013/03/04 20:29:24 Done.
440 shelf_ = NULL; 387 shelf_.reset(NULL);
441 } 388 }
442 389
443 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { 390 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) {
444 aura::Window* focused = aura::client::GetFocusClient(dst)->GetFocusedWindow(); 391 aura::Window* focused = aura::client::GetFocusClient(dst)->GetFocusedWindow();
445 aura::WindowTracker tracker; 392 aura::WindowTracker tracker;
446 if (focused) 393 if (focused)
447 tracker.Add(focused); 394 tracker.Add(focused);
448 aura::client::ActivationClient* activation_client = 395 aura::client::ActivationClient* activation_client =
449 aura::client::GetActivationClient(dst); 396 aura::client::GetActivationClient(dst);
450 aura::Window* active = activation_client->GetActiveWindow(); 397 aura::Window* active = activation_client->GetActiveWindow();
(...skipping 17 matching lines...) Expand all
468 ReparentAllWindows(root_window_.get(), dst); 415 ReparentAllWindows(root_window_.get(), dst);
469 416
470 // Restore focused or active window if it's still alive. 417 // Restore focused or active window if it's still alive.
471 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { 418 if (focused && tracker.Contains(focused) && dst->Contains(focused)) {
472 aura::client::GetFocusClient(dst)->FocusWindow(focused); 419 aura::client::GetFocusClient(dst)->FocusWindow(focused);
473 } else if (active && tracker.Contains(active) && dst->Contains(active)) { 420 } else if (active && tracker.Contains(active) && dst->Contains(active)) {
474 activation_client->ActivateWindow(active); 421 activation_client->ActivateWindow(active);
475 } 422 }
476 } 423 }
477 424
425 ShelfLayoutManager* RootWindowController::shelf_layout_manager() const {
426 return shelf_.get() ? shelf_->shelf_layout_manager() : NULL;
Mr4D (OOO till 08-26) 2013/03/04 19:18:04 Somehow this makes me worry. It could be that we r
Harry McCleave 2013/03/04 20:29:24 Currently the classes that use this only exist onc
Mr4D (OOO till 08-26) 2013/03/04 22:59:00 Okay. Sounds good to me then.
427 }
428
478 SystemTray* RootWindowController::GetSystemTray() { 429 SystemTray* RootWindowController::GetSystemTray() {
479 // We assume in throughout the code that this will not return NULL. If code 430 // We assume in throughout the code that this will not return NULL. If code
480 // triggers this for valid reasons, it should test status_area_widget first. 431 // triggers this for valid reasons, it should test status_area_widget first.
481 internal::StatusAreaWidget* status_area = status_area_widget(); 432 CHECK(shelf_.get() && shelf_->status_area_widget());
482 CHECK(status_area); 433 return shelf_->status_area_widget()->system_tray();
483 return status_area->system_tray();
484 } 434 }
485 435
486 void RootWindowController::ShowContextMenu( 436 void RootWindowController::ShowContextMenu(
487 const gfx::Point& location_in_screen) { 437 const gfx::Point& location_in_screen) {
488 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ? 438 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ?
489 root_window() : Shell::GetPrimaryRootWindow(); 439 root_window() : Shell::GetPrimaryRootWindow();
490 DCHECK(Shell::GetInstance()->delegate()); 440 DCHECK(Shell::GetInstance()->delegate());
491 scoped_ptr<ui::MenuModel> menu_model( 441 scoped_ptr<ui::MenuModel> menu_model(
492 Shell::GetInstance()->delegate()->CreateContextMenu(target)); 442 Shell::GetInstance()->delegate()->CreateContextMenu(target));
493 if (!menu_model.get()) 443 if (!menu_model.get())
494 return; 444 return;
495 445
496 views::MenuModelAdapter menu_model_adapter(menu_model.get()); 446 views::MenuModelAdapter menu_model_adapter(menu_model.get());
497 views::MenuRunner menu_runner(menu_model_adapter.CreateMenu()); 447 views::MenuRunner menu_runner(menu_model_adapter.CreateMenu());
498 views::Widget* widget = 448 views::Widget* widget =
499 root_window_->GetProperty(kDesktopController)->widget(); 449 root_window_->GetProperty(kDesktopController)->widget();
500 450
501 if (menu_runner.RunMenuAt( 451 if (menu_runner.RunMenuAt(
502 widget, NULL, gfx::Rect(location_in_screen, gfx::Size()), 452 widget, NULL, gfx::Rect(location_in_screen, gfx::Size()),
503 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == 453 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) ==
504 views::MenuRunner::MENU_DELETED) 454 views::MenuRunner::MENU_DELETED)
505 return; 455 return;
506 456
507 Shell::GetInstance()->UpdateShelfVisibility(); 457 Shell::GetInstance()->UpdateShelfVisibility();
508 } 458 }
509 459
510 void RootWindowController::UpdateShelfVisibility() { 460 void RootWindowController::UpdateShelfVisibility() {
511 shelf_->UpdateVisibilityState(); 461 shelf_->shelf_layout_manager()->UpdateVisibilityState();
512 }
513
514 void RootWindowController::SetShelfAutoHideBehavior(
515 ShelfAutoHideBehavior behavior) {
516 shelf_->SetAutoHideBehavior(behavior);
517 }
518
519 ShelfAutoHideBehavior RootWindowController::GetShelfAutoHideBehavior() const {
520 return shelf_->auto_hide_behavior();
521 }
522
523 bool RootWindowController::SetShelfAlignment(ShelfAlignment alignment) {
524 return shelf_->SetAlignment(alignment);
525 }
526
527 ShelfAlignment RootWindowController::GetShelfAlignment() {
528 return shelf_->GetAlignment();
529 } 462 }
530 463
531 bool RootWindowController::IsImmersiveMode() const { 464 bool RootWindowController::IsImmersiveMode() const {
532 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); 465 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow();
533 for (size_t i = 0; i < container->children().size(); ++i) { 466 for (size_t i = 0; i < container->children().size(); ++i) {
534 aura::Window* child = container->children()[i]; 467 aura::Window* child = container->children()[i];
535 if (child->IsVisible() && child->GetProperty(kImmersiveModeKey)) 468 if (child->IsVisible() && child->GetProperty(kImmersiveModeKey))
536 return true; 469 return true;
537 } 470 }
538 return false; 471 return false;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 always_on_top_container); 535 always_on_top_container);
603 SetUsesScreenCoordinates(always_on_top_container); 536 SetUsesScreenCoordinates(always_on_top_container);
604 537
605 aura::Window* panel_container = CreateContainer( 538 aura::Window* panel_container = CreateContainer(
606 kShellWindowId_PanelContainer, 539 kShellWindowId_PanelContainer,
607 "PanelContainer", 540 "PanelContainer",
608 non_lock_screen_containers); 541 non_lock_screen_containers);
609 SetUsesScreenCoordinates(panel_container); 542 SetUsesScreenCoordinates(panel_container);
610 543
611 aura::Window* launcher_container = 544 aura::Window* launcher_container =
612 CreateContainer(kShellWindowId_LauncherContainer, 545 CreateContainer(kShellWindowId_ShelfContainer,
613 "LauncherContainer", 546 "LauncherContainer",
614 non_lock_screen_containers); 547 non_lock_screen_containers);
615 SetUsesScreenCoordinates(launcher_container); 548 SetUsesScreenCoordinates(launcher_container);
616 549
617 aura::Window* app_list_container = 550 aura::Window* app_list_container =
618 CreateContainer(kShellWindowId_AppListContainer, 551 CreateContainer(kShellWindowId_AppListContainer,
619 "AppListContainer", 552 "AppListContainer",
620 non_lock_screen_containers); 553 non_lock_screen_containers);
621 SetUsesScreenCoordinates(app_list_container); 554 SetUsesScreenCoordinates(app_list_container);
622 555
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 "OverlayContainer", 625 "OverlayContainer",
693 lock_screen_related_containers); 626 lock_screen_related_containers);
694 SetUsesScreenCoordinates(overlay_container); 627 SetUsesScreenCoordinates(overlay_container);
695 628
696 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, 629 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
697 "PowerButtonAnimationContainer", root_window) ; 630 "PowerButtonAnimationContainer", root_window) ;
698 } 631 }
699 632
700 } // namespace internal 633 } // namespace internal
701 } // namespace ash 634 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698