OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "chrome/browser/ui/toolbar/app_menu_icon_painter.h" | 11 #include "chrome/browser/ui/toolbar/app_menu_icon_painter.h" |
12 #include "ui/views/animation/ink_drop_host.h" | 12 #include "ui/views/animation/ink_drop_host.h" |
13 #include "ui/views/controls/button/menu_button.h" | 13 #include "ui/views/controls/button/menu_button.h" |
14 #include "ui/views/controls/button/menu_button_listener.h" | 14 #include "ui/views/controls/button/menu_button_listener.h" |
15 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
16 | 16 |
17 class AppMenu; | 17 class AppMenu; |
18 class AppMenuModel; | 18 class AppMenuModel; |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 class InkDropAnimationController; | |
22 class LabelButtonBorder; | 21 class LabelButtonBorder; |
23 class MenuListener; | 22 class MenuListener; |
24 } | 23 } |
25 | 24 |
26 class ToolbarView; | 25 class ToolbarView; |
27 | 26 |
28 class AppMenuButton : public views::InkDropHost, | 27 class AppMenuButton : public views::InkDropHost, |
29 public views::MenuButton, | 28 public views::MenuButton, |
30 public AppMenuIconPainter::Delegate { | 29 public AppMenuIconPainter::Delegate { |
31 public: | 30 public: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 77 |
79 // views::MenuButton: | 78 // views::MenuButton: |
80 const char* GetClassName() const override; | 79 const char* GetClassName() const override; |
81 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; | 80 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; |
82 gfx::Rect GetThemePaintRect() const override; | 81 gfx::Rect GetThemePaintRect() const override; |
83 bool GetDropFormats( | 82 bool GetDropFormats( |
84 int* formats, | 83 int* formats, |
85 std::set<ui::Clipboard::FormatType>* format_types) override; | 84 std::set<ui::Clipboard::FormatType>* format_types) override; |
86 bool AreDropTypesRequired() override; | 85 bool AreDropTypesRequired() override; |
87 bool CanDrop(const ui::OSExchangeData& data) override; | 86 bool CanDrop(const ui::OSExchangeData& data) override; |
88 void Layout() override; | |
89 void OnDragEntered(const ui::DropTargetEvent& event) override; | 87 void OnDragEntered(const ui::DropTargetEvent& event) override; |
90 int OnDragUpdated(const ui::DropTargetEvent& event) override; | 88 int OnDragUpdated(const ui::DropTargetEvent& event) override; |
91 void OnDragExited() override; | 89 void OnDragExited() override; |
92 int OnPerformDrop(const ui::DropTargetEvent& event) override; | 90 int OnPerformDrop(const ui::DropTargetEvent& event) override; |
93 void OnPaint(gfx::Canvas* canvas) override; | 91 void OnPaint(gfx::Canvas* canvas) override; |
94 | 92 |
95 // Only used in pre-MD. | 93 // Only used in pre-MD. |
96 scoped_ptr<AppMenuIconPainter> icon_painter_; | 94 scoped_ptr<AppMenuIconPainter> icon_painter_; |
97 | 95 |
98 // Only used in MD. | 96 // Only used in MD. |
99 AppMenuIconPainter::Severity severity_; | 97 AppMenuIconPainter::Severity severity_; |
100 | 98 |
101 // Animation controller for the ink drop ripple effect. | |
102 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_; | |
103 | |
104 // Our owning toolbar view. | 99 // Our owning toolbar view. |
105 ToolbarView* toolbar_view_; | 100 ToolbarView* toolbar_view_; |
106 | 101 |
107 // Whether or not we should allow dragging extension icons onto this button | 102 // Whether or not we should allow dragging extension icons onto this button |
108 // (in order to open the overflow in the app menu). | 103 // (in order to open the overflow in the app menu). |
109 bool allow_extension_dragging_; | 104 bool allow_extension_dragging_; |
110 | 105 |
111 // Listeners to call when the menu opens. | 106 // Listeners to call when the menu opens. |
112 base::ObserverList<views::MenuListener> menu_listeners_; | 107 base::ObserverList<views::MenuListener> menu_listeners_; |
113 | 108 |
(...skipping 11 matching lines...) Expand all Loading... |
125 // a maximized state to extend to the full window width. | 120 // a maximized state to extend to the full window width. |
126 int margin_trailing_; | 121 int margin_trailing_; |
127 | 122 |
128 // Used to spawn weak pointers for delayed tasks to open the overflow menu. | 123 // Used to spawn weak pointers for delayed tasks to open the overflow menu. |
129 base::WeakPtrFactory<AppMenuButton> weak_factory_; | 124 base::WeakPtrFactory<AppMenuButton> weak_factory_; |
130 | 125 |
131 DISALLOW_COPY_AND_ASSIGN(AppMenuButton); | 126 DISALLOW_COPY_AND_ASSIGN(AppMenuButton); |
132 }; | 127 }; |
133 | 128 |
134 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ | 129 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_APP_MENU_BUTTON_H_ |
OLD | NEW |