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

Side by Side Diff: ui/views/controls/menu/menu_controller.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_controller.h ('k') | ui/views/controls/menu/menu_runner.h » ('j') | 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 "ui/views/controls/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 MenuController* MenuController::GetActiveInstance() { 283 MenuController* MenuController::GetActiveInstance() {
284 return active_instance_; 284 return active_instance_;
285 } 285 }
286 286
287 MenuItemView* MenuController::Run(Widget* parent, 287 MenuItemView* MenuController::Run(Widget* parent,
288 MenuButton* button, 288 MenuButton* button,
289 MenuItemView* root, 289 MenuItemView* root,
290 const gfx::Rect& bounds, 290 const gfx::Rect& bounds,
291 MenuAnchorPosition position, 291 MenuAnchorPosition position,
292 bool context_menu, 292 bool context_menu,
293 bool is_nested_drag,
293 int* result_event_flags) { 294 int* result_event_flags) {
294 exit_type_ = EXIT_NONE; 295 exit_type_ = EXIT_NONE;
295 possible_drag_ = false; 296 possible_drag_ = false;
296 drag_in_progress_ = false; 297 drag_in_progress_ = false;
297 did_initiate_drag_ = false; 298 did_initiate_drag_ = false;
298 closing_event_time_ = base::TimeDelta(); 299 closing_event_time_ = base::TimeDelta();
299 menu_start_time_ = base::TimeTicks::Now(); 300 menu_start_time_ = base::TimeTicks::Now();
300 menu_start_mouse_press_loc_ = gfx::Point(); 301 menu_start_mouse_press_loc_ = gfx::Point();
301 302
302 // If we are shown on mouse press, we will eat the subsequent mouse down and 303 // If we are shown on mouse press, we will eat the subsequent mouse down and
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 if (owner_) 342 if (owner_)
342 owner_->RemoveObserver(this); 343 owner_->RemoveObserver(this);
343 owner_ = parent; 344 owner_ = parent;
344 if (owner_) 345 if (owner_)
345 owner_->AddObserver(this); 346 owner_->AddObserver(this);
346 347
347 // Set the selection, which opens the initial menu. 348 // Set the selection, which opens the initial menu.
348 SetSelection(root, SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); 349 SetSelection(root, SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY);
349 350
350 if (!blocking_run_) { 351 if (!blocking_run_) {
351 // Start the timer to hide the menu. This is needed as we get no 352 if (!is_nested_drag) {
352 // notification when the drag has finished. 353 // Start the timer to hide the menu. This is needed as we get no
353 StartCancelAllTimer(); 354 // notification when the drag has finished.
355 StartCancelAllTimer();
356 }
354 return NULL; 357 return NULL;
355 } 358 }
356 359
357 if (button) 360 if (button)
358 menu_button_ = button; 361 menu_button_ = button;
359 362
360 // Make sure Chrome doesn't attempt to shut down while the menu is showing. 363 // Make sure Chrome doesn't attempt to shut down while the menu is showing.
361 if (ViewsDelegate::views_delegate) 364 if (ViewsDelegate::views_delegate)
362 ViewsDelegate::views_delegate->AddRef(); 365 ViewsDelegate::views_delegate->AddRef();
363 366
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 } 811 }
809 } 812 }
810 813
811 void MenuController::OnWidgetDestroying(Widget* widget) { 814 void MenuController::OnWidgetDestroying(Widget* widget) {
812 DCHECK_EQ(owner_, widget); 815 DCHECK_EQ(owner_, widget);
813 owner_->RemoveObserver(this); 816 owner_->RemoveObserver(this);
814 owner_ = NULL; 817 owner_ = NULL;
815 message_loop_->ClearOwner(); 818 message_loop_->ClearOwner();
816 } 819 }
817 820
821 bool MenuController::IsCancelAllTimerRunningForTest() {
822 return cancel_all_timer_.IsRunning();
823 }
824
818 // static 825 // static
819 void MenuController::TurnOffMenuSelectionHoldForTest() { 826 void MenuController::TurnOffMenuSelectionHoldForTest() {
820 menu_selection_hold_time_ms = -1; 827 menu_selection_hold_time_ms = -1;
821 } 828 }
822 829
823 void MenuController::SetSelection(MenuItemView* menu_item, 830 void MenuController::SetSelection(MenuItemView* menu_item,
824 int selection_types) { 831 int selection_types) {
825 size_t paths_differ_at = 0; 832 size_t paths_differ_at = 0;
826 std::vector<MenuItemView*> current_path; 833 std::vector<MenuItemView*> current_path;
827 std::vector<MenuItemView*> new_path; 834 std::vector<MenuItemView*> new_path;
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 } 2306 }
2300 } 2307 }
2301 2308
2302 gfx::Screen* MenuController::GetScreen() { 2309 gfx::Screen* MenuController::GetScreen() {
2303 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; 2310 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL;
2304 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) 2311 return root ? gfx::Screen::GetScreenFor(root->GetNativeView())
2305 : gfx::Screen::GetNativeScreen(); 2312 : gfx::Screen::GetNativeScreen();
2306 } 2313 }
2307 2314
2308 } // namespace views 2315 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/controls/menu/menu_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698