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

Side by Side Diff: trunk/src/ui/views/controls/menu/menu_controller.cc

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

Powered by Google App Engine
This is Rietveld 408576698