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

Side by Side Diff: ash/root_window_controller.cc

Issue 13434005: Prevent crash when desktop controller is NULL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added comment Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 void RootWindowController::ShowContextMenu( 457 void RootWindowController::ShowContextMenu(
458 const gfx::Point& location_in_screen) { 458 const gfx::Point& location_in_screen) {
459 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ? 459 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ?
460 root_window() : Shell::GetPrimaryRootWindow(); 460 root_window() : Shell::GetPrimaryRootWindow();
461 DCHECK(Shell::GetInstance()->delegate()); 461 DCHECK(Shell::GetInstance()->delegate());
462 scoped_ptr<ui::MenuModel> menu_model( 462 scoped_ptr<ui::MenuModel> menu_model(
463 Shell::GetInstance()->delegate()->CreateContextMenu(target)); 463 Shell::GetInstance()->delegate()->CreateContextMenu(target));
464 if (!menu_model.get()) 464 if (!menu_model.get())
465 return; 465 return;
466 466
467 internal::DesktopBackgroundWidgetController* background =
468 root_window_->GetProperty(kDesktopController);
469 // Background controller may not be set yet if user clicked on status are
470 // before initial animation completion. See crbug.com/222218
471 if (!background)
472 return;
473
467 views::MenuRunner menu_runner(menu_model.get()); 474 views::MenuRunner menu_runner(menu_model.get());
468 views::Widget* widget = 475 if (menu_runner.RunMenuAt(background->widget(),
469 root_window_->GetProperty(kDesktopController)->widget(); 476 NULL, gfx::Rect(location_in_screen, gfx::Size()),
470
471 if (menu_runner.RunMenuAt(
472 widget, NULL, gfx::Rect(location_in_screen, gfx::Size()),
473 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == 477 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) ==
474 views::MenuRunner::MENU_DELETED) 478 views::MenuRunner::MENU_DELETED) {
475 return; 479 return;
480 }
476 481
477 Shell::GetInstance()->UpdateShelfVisibility(); 482 Shell::GetInstance()->UpdateShelfVisibility();
478 } 483 }
479 484
480 void RootWindowController::UpdateShelfVisibility() { 485 void RootWindowController::UpdateShelfVisibility() {
481 shelf_->shelf_layout_manager()->UpdateVisibilityState(); 486 shelf_->shelf_layout_manager()->UpdateVisibilityState();
482 } 487 }
483 488
484 bool RootWindowController::IsImmersiveMode() const { 489 bool RootWindowController::IsImmersiveMode() const {
485 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); 490 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 "OverlayContainer", 650 "OverlayContainer",
646 lock_screen_related_containers); 651 lock_screen_related_containers);
647 SetUsesScreenCoordinates(overlay_container); 652 SetUsesScreenCoordinates(overlay_container);
648 653
649 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, 654 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
650 "PowerButtonAnimationContainer", root_window) ; 655 "PowerButtonAnimationContainer", root_window) ;
651 } 656 }
652 657
653 } // namespace internal 658 } // namespace internal
654 } // namespace ash 659 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698