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

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: simplify if 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 if (!background)
oshima 2013/04/04 13:44:51 can you explain when this happens in the comment w
Dmitry Polukhin 2013/04/04 14:42:45 Done.
470 return;
471
472 views::Widget* widget = background->widget();
473 if (!widget)
474 return;
oshima 2013/04/04 13:44:51 can this happen?
Dmitry Polukhin 2013/04/04 14:42:45 I haven't seen this - removed.
475
467 views::MenuRunner menu_runner(menu_model.get()); 476 views::MenuRunner menu_runner(menu_model.get());
468 views::Widget* widget =
469 root_window_->GetProperty(kDesktopController)->widget();
470
471 if (menu_runner.RunMenuAt( 477 if (menu_runner.RunMenuAt(
472 widget, NULL, gfx::Rect(location_in_screen, gfx::Size()), 478 widget, NULL, gfx::Rect(location_in_screen, gfx::Size()),
473 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == 479 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) ==
474 views::MenuRunner::MENU_DELETED) 480 views::MenuRunner::MENU_DELETED)
475 return; 481 return;
476 482
477 Shell::GetInstance()->UpdateShelfVisibility(); 483 Shell::GetInstance()->UpdateShelfVisibility();
478 } 484 }
479 485
480 void RootWindowController::UpdateShelfVisibility() { 486 void RootWindowController::UpdateShelfVisibility() {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 "OverlayContainer", 651 "OverlayContainer",
646 lock_screen_related_containers); 652 lock_screen_related_containers);
647 SetUsesScreenCoordinates(overlay_container); 653 SetUsesScreenCoordinates(overlay_container);
648 654
649 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, 655 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
650 "PowerButtonAnimationContainer", root_window) ; 656 "PowerButtonAnimationContainer", root_window) ;
651 } 657 }
652 658
653 } // namespace internal 659 } // namespace internal
654 } // namespace ash 660 } // 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