OLD | NEW |
---|---|
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 Loading... | |
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 views::MenuRunner menu_runner(menu_model.get()); | 467 internal::DesktopBackgroundWidgetController* background = |
468 views::Widget* widget = | 468 root_window_->GetProperty(kDesktopController); |
469 root_window_->GetProperty(kDesktopController)->widget(); | 469 views::Widget* widget = background ? background->widget() : NULL; |
oshima
2013/04/03 15:14:12
when it can become null?
Dmitry Polukhin
2013/04/03 18:50:00
I wasn't able to reproduce this crash but you can
| |
470 | 470 if (widget) { |
471 if (menu_runner.RunMenuAt( | 471 views::MenuRunner menu_runner(menu_model.get()); |
472 widget, NULL, gfx::Rect(location_in_screen, gfx::Size()), | 472 if (menu_runner.RunMenuAt( |
473 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == | 473 widget, NULL, gfx::Rect(location_in_screen, gfx::Size()), |
474 views::MenuRunner::MENU_DELETED) | 474 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == |
475 views::MenuRunner::MENU_DELETED) | |
476 return; | |
477 } else { | |
475 return; | 478 return; |
479 } | |
oshima
2013/04/03 15:14:12
if (!widget)
return;
if (menu_runner.RunMenuAt(.
Dmitry Polukhin
2013/04/03 18:50:00
Done.
| |
476 | 480 |
477 Shell::GetInstance()->UpdateShelfVisibility(); | 481 Shell::GetInstance()->UpdateShelfVisibility(); |
478 } | 482 } |
479 | 483 |
480 void RootWindowController::UpdateShelfVisibility() { | 484 void RootWindowController::UpdateShelfVisibility() { |
481 shelf_->shelf_layout_manager()->UpdateVisibilityState(); | 485 shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
482 } | 486 } |
483 | 487 |
484 bool RootWindowController::IsImmersiveMode() const { | 488 bool RootWindowController::IsImmersiveMode() const { |
485 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); | 489 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
645 "OverlayContainer", | 649 "OverlayContainer", |
646 lock_screen_related_containers); | 650 lock_screen_related_containers); |
647 SetUsesScreenCoordinates(overlay_container); | 651 SetUsesScreenCoordinates(overlay_container); |
648 | 652 |
649 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 653 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
650 "PowerButtonAnimationContainer", root_window) ; | 654 "PowerButtonAnimationContainer", root_window) ; |
651 } | 655 } |
652 | 656 |
653 } // namespace internal | 657 } // namespace internal |
654 } // namespace ash | 658 } // namespace ash |
OLD | NEW |