| 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 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| 11 #include <list> | 11 #include <list> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
| 18 #include "base/timer.h" | 18 #include "base/timer.h" |
| 19 #include "ui/base/events.h" | 19 #include "ui/base/events.h" |
| 20 #include "ui/views/controls/menu/menu_delegate.h" | 20 #include "ui/views/controls/menu/menu_delegate.h" |
| 21 #include "ui/views/controls/menu/menu_item_view.h" | 21 #include "ui/views/controls/menu/menu_item_view.h" |
| 22 | 22 |
| 23 #if defined(USE_AURA) |
| 24 namespace aura { |
| 25 class RootWindow; |
| 26 } |
| 27 #endif |
| 28 |
| 23 namespace ui { | 29 namespace ui { |
| 24 class OSExchangeData; | 30 class OSExchangeData; |
| 25 } | 31 } |
| 26 using ui::OSExchangeData; | |
| 27 | |
| 28 namespace views { | 32 namespace views { |
| 29 | 33 |
| 30 class DropTargetEvent; | 34 class DropTargetEvent; |
| 31 class MenuButton; | 35 class MenuButton; |
| 32 class MenuHostRootView; | 36 class MenuHostRootView; |
| 33 class MouseEvent; | 37 class MouseEvent; |
| 34 class SubmenuView; | 38 class SubmenuView; |
| 35 class View; | 39 class View; |
| 36 | 40 |
| 37 namespace internal { | 41 namespace internal { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 void OnMouseEntered(SubmenuView* source, const MouseEvent& event); | 107 void OnMouseEntered(SubmenuView* source, const MouseEvent& event); |
| 104 #if defined(OS_LINUX) | 108 #if defined(OS_LINUX) |
| 105 bool OnMouseWheel(SubmenuView* source, const MouseWheelEvent& event); | 109 bool OnMouseWheel(SubmenuView* source, const MouseWheelEvent& event); |
| 106 #endif | 110 #endif |
| 107 ui::GestureStatus OnGestureEvent(SubmenuView* source, | 111 ui::GestureStatus OnGestureEvent(SubmenuView* source, |
| 108 const GestureEvent& event); | 112 const GestureEvent& event); |
| 109 | 113 |
| 110 bool GetDropFormats( | 114 bool GetDropFormats( |
| 111 SubmenuView* source, | 115 SubmenuView* source, |
| 112 int* formats, | 116 int* formats, |
| 113 std::set<OSExchangeData::CustomFormat>* custom_formats); | 117 std::set<ui::OSExchangeData::CustomFormat>* custom_formats); |
| 114 bool AreDropTypesRequired(SubmenuView* source); | 118 bool AreDropTypesRequired(SubmenuView* source); |
| 115 bool CanDrop(SubmenuView* source, const OSExchangeData& data); | 119 bool CanDrop(SubmenuView* source, const ui::OSExchangeData& data); |
| 116 void OnDragEntered(SubmenuView* source, const DropTargetEvent& event); | 120 void OnDragEntered(SubmenuView* source, const DropTargetEvent& event); |
| 117 int OnDragUpdated(SubmenuView* source, const DropTargetEvent& event); | 121 int OnDragUpdated(SubmenuView* source, const DropTargetEvent& event); |
| 118 void OnDragExited(SubmenuView* source); | 122 void OnDragExited(SubmenuView* source); |
| 119 int OnPerformDrop(SubmenuView* source, const DropTargetEvent& event); | 123 int OnPerformDrop(SubmenuView* source, const DropTargetEvent& event); |
| 120 | 124 |
| 121 // Invoked from the scroll buttons of the MenuScrollViewContainer. | 125 // Invoked from the scroll buttons of the MenuScrollViewContainer. |
| 122 void OnDragEnteredScrollButton(SubmenuView* source, bool is_up); | 126 void OnDragEnteredScrollButton(SubmenuView* source, bool is_up); |
| 123 void OnDragExitedScrollButton(SubmenuView* source); | 127 void OnDragExitedScrollButton(SubmenuView* source); |
| 124 | 128 |
| 125 // Invoked once for any Widget activation change. This allows the menu | 129 // Invoked once for any Widget activation change. This allows the menu |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 // side. | 492 // side. |
| 489 base::OneShotTimer<MenuController> cancel_all_timer_; | 493 base::OneShotTimer<MenuController> cancel_all_timer_; |
| 490 | 494 |
| 491 // Drop target. | 495 // Drop target. |
| 492 MenuItemView* drop_target_; | 496 MenuItemView* drop_target_; |
| 493 MenuDelegate::DropPosition drop_position_; | 497 MenuDelegate::DropPosition drop_position_; |
| 494 | 498 |
| 495 // Owner of child windows. | 499 // Owner of child windows. |
| 496 Widget* owner_; | 500 Widget* owner_; |
| 497 | 501 |
| 502 #if defined(USE_AURA) |
| 503 // |owner_|s RootWindow. Cached as at the time we need it |owner_| may have |
| 504 // been deleted. |
| 505 aura::RootWindow* root_window_; |
| 506 #endif |
| 507 |
| 498 // Indicates a possible drag operation. | 508 // Indicates a possible drag operation. |
| 499 bool possible_drag_; | 509 bool possible_drag_; |
| 500 | 510 |
| 501 // True when drag operation is in progress. | 511 // True when drag operation is in progress. |
| 502 bool drag_in_progress_; | 512 bool drag_in_progress_; |
| 503 | 513 |
| 504 // Location the mouse was pressed at. Used to detect d&d. | 514 // Location the mouse was pressed at. Used to detect d&d. |
| 505 gfx::Point press_pt_; | 515 gfx::Point press_pt_; |
| 506 | 516 |
| 507 // We get a slew of drag updated messages as the mouse is over us. To avoid | 517 // We get a slew of drag updated messages as the mouse is over us. To avoid |
| (...skipping 20 matching lines...) Expand all Loading... |
| 528 // How deep we are in nested message loops. This should be at most 2 (when | 538 // How deep we are in nested message loops. This should be at most 2 (when |
| 529 // showing a context menu from a menu). | 539 // showing a context menu from a menu). |
| 530 int message_loop_depth_; | 540 int message_loop_depth_; |
| 531 | 541 |
| 532 DISALLOW_COPY_AND_ASSIGN(MenuController); | 542 DISALLOW_COPY_AND_ASSIGN(MenuController); |
| 533 }; | 543 }; |
| 534 | 544 |
| 535 } // namespace views | 545 } // namespace views |
| 536 | 546 |
| 537 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 547 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| OLD | NEW |