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

Unified Diff: ui/views/controls/menu/menu_controller.cc

Issue 1159033008: Refactor ViewsDelegate singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/menu/menu_controller.cc
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index 8d6a7a283dd347f197075042e926b94729d00add..062c5f18aafe5565f2fb16b62970062fe7c81aab 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -361,8 +361,8 @@ MenuItemView* MenuController::Run(Widget* parent,
pressed_lock_.reset(new MenuButton::PressedLock(button));
// Make sure Chrome doesn't attempt to shut down while the menu is showing.
- if (ViewsDelegate::views_delegate)
- ViewsDelegate::views_delegate->AddRef();
+ if (ViewsDelegate::GetInstance())
+ ViewsDelegate::GetInstance()->AddRef();
// We need to turn on nestable tasks as in some situations (pressing alt-f for
// one) the menus are run from a task. If we don't do this and are invoked
@@ -373,8 +373,8 @@ MenuItemView* MenuController::Run(Widget* parent,
RunMessageLoop(nested_menu);
message_loop_depth_--;
- if (ViewsDelegate::views_delegate)
- ViewsDelegate::views_delegate->ReleaseRef();
+ if (ViewsDelegate::GetInstance())
+ ViewsDelegate::GetInstance()->ReleaseRef();
// Close any open menus.
SetSelection(NULL, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT);
@@ -2125,8 +2125,8 @@ void MenuController::RepostEvent(SubmenuView* source,
// coordinates to be in pixels.
// PostMessage() to metro windows isn't allowed (access will be denied). Don't
// try to repost with Win32 if the window under the mouse press is in metro.
- if (!ViewsDelegate::views_delegate ||
- !ViewsDelegate::views_delegate->IsWindowInMetro(window)) {
+ if (!ViewsDelegate::GetInstance() ||
+ !ViewsDelegate::GetInstance()->IsWindowInMetro(window)) {
gfx::Point screen_loc_pixels = gfx::win::DIPToScreenPoint(screen_loc);
HWND target_window = window ? HWNDForNativeWindow(window) :
WindowFromPoint(screen_loc_pixels.ToPOINT());

Powered by Google App Engine
This is Rietveld 408576698