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

Side by Side Diff: ui/views/controls/menu/menu_runner_impl.cc

Issue 399143004: Open the WrenchMenu on mouseover when dragging a browser action (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Win/Test Fix Created 6 years, 5 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
« no previous file with comments | « ui/views/controls/menu/menu_runner.h ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/controls/menu/menu_runner_impl.h" 5 #include "ui/views/controls/menu/menu_runner_impl.h"
6 6
7 #include "ui/native_theme/native_theme.h" 7 #include "ui/native_theme/native_theme.h"
8 #include "ui/views/controls/button/menu_button.h" 8 #include "ui/views/controls/button/menu_button.h"
9 #include "ui/views/controls/menu/menu_controller.h" 9 #include "ui/views/controls/menu/menu_controller.h"
10 #include "ui/views/controls/menu/menu_delegate.h" 10 #include "ui/views/controls/menu/menu_delegate.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return MenuRunner::NORMAL_EXIT; 98 return MenuRunner::NORMAL_EXIT;
99 } 99 }
100 // Drop menus don't block the message loop, so it's ok to create a new 100 // Drop menus don't block the message loop, so it's ok to create a new
101 // MenuController. 101 // MenuController.
102 controller = NULL; 102 controller = NULL;
103 } 103 }
104 } 104 }
105 105
106 running_ = true; 106 running_ = true;
107 for_drop_ = (run_types & MenuRunner::FOR_DROP) != 0; 107 for_drop_ = (run_types & MenuRunner::FOR_DROP) != 0;
108 bool has_mnemonics = 108 bool has_mnemonics = (run_types & MenuRunner::HAS_MNEMONICS) != 0;
109 (run_types & MenuRunner::HAS_MNEMONICS) != 0 && !for_drop_;
110 owns_controller_ = false; 109 owns_controller_ = false;
111 if (!controller) { 110 if (!controller) {
112 // No menus are showing, show one. 111 // No menus are showing, show one.
113 ui::NativeTheme* theme = 112 ui::NativeTheme* theme =
114 parent ? parent->GetNativeTheme() : ui::NativeTheme::instance(); 113 parent ? parent->GetNativeTheme() : ui::NativeTheme::instance();
115 controller = new MenuController(theme, !for_drop_, this); 114 controller = new MenuController(theme, !for_drop_, this);
116 owns_controller_ = true; 115 owns_controller_ = true;
117 } 116 }
118 controller->set_is_combobox((run_types & MenuRunner::COMBOBOX) != 0); 117 controller->set_is_combobox((run_types & MenuRunner::COMBOBOX) != 0);
119 controller_ = controller; 118 controller_ = controller;
120 menu_->set_controller(controller_); 119 menu_->set_controller(controller_);
121 menu_->PrepareForRun(owns_controller_, 120 menu_->PrepareForRun(owns_controller_,
122 has_mnemonics, 121 has_mnemonics,
123 !for_drop_ && ShouldShowMnemonics(button)); 122 !for_drop_ && ShouldShowMnemonics(button));
124 123
125 // Run the loop. 124 // Run the loop.
126 int mouse_event_flags = 0; 125 int mouse_event_flags = 0;
127 MenuItemView* result = 126 MenuItemView* result =
128 controller->Run(parent, 127 controller->Run(parent,
129 button, 128 button,
130 menu_, 129 menu_,
131 bounds, 130 bounds,
132 anchor, 131 anchor,
133 (run_types & MenuRunner::CONTEXT_MENU) != 0, 132 (run_types & MenuRunner::CONTEXT_MENU) != 0,
133 (run_types & MenuRunner::NESTED_DRAG) != 0,
134 &mouse_event_flags); 134 &mouse_event_flags);
135 // Get the time of the event which closed this menu. 135 // Get the time of the event which closed this menu.
136 closing_event_time_ = controller->closing_event_time(); 136 closing_event_time_ = controller->closing_event_time();
137 if (for_drop_) { 137 if (for_drop_) {
138 // Drop menus return immediately. We finish processing in DropMenuClosed. 138 // Drop menus return immediately. We finish processing in DropMenuClosed.
139 return MenuRunner::NORMAL_EXIT; 139 return MenuRunner::NORMAL_EXIT;
140 } 140 }
141 return MenuDone(result, mouse_event_flags); 141 return MenuDone(result, mouse_event_flags);
142 } 142 }
143 143
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 #if defined(OS_WIN) 208 #if defined(OS_WIN)
209 // This is only needed on Windows. 209 // This is only needed on Windows.
210 if (!show_mnemonics) 210 if (!show_mnemonics)
211 show_mnemonics = base::win::IsAltPressed(); 211 show_mnemonics = base::win::IsAltPressed();
212 #endif 212 #endif
213 return show_mnemonics; 213 return show_mnemonics;
214 } 214 }
215 215
216 } // namespace internal 216 } // namespace internal
217 } // namespace views 217 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698