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_TOOLBAR_ACTION_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" | 9 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace extensions { | 22 namespace extensions { |
23 class Extension; | 23 class Extension; |
24 } | 24 } |
25 | 25 |
26 namespace gfx { | 26 namespace gfx { |
27 class Image; | 27 class Image; |
28 } | 28 } |
29 | 29 |
30 namespace views { | 30 namespace views { |
31 class InkDropAnimationController; | |
32 class MenuItemView; | 31 class MenuItemView; |
33 class MenuRunner; | 32 class MenuRunner; |
34 } | 33 } |
35 | 34 |
36 //////////////////////////////////////////////////////////////////////////////// | 35 //////////////////////////////////////////////////////////////////////////////// |
37 // ToolbarActionView | 36 // ToolbarActionView |
38 // A wrapper around a ToolbarActionViewController to display a toolbar action | 37 // A wrapper around a ToolbarActionViewController to display a toolbar action |
39 // action in the BrowserActionsContainer. | 38 // action in the BrowserActionsContainer. |
40 class ToolbarActionView : public views::MenuButton, | 39 class ToolbarActionView : public views::MenuButton, |
41 public ToolbarActionViewDelegateViews, | 40 public ToolbarActionViewDelegateViews, |
(...skipping 30 matching lines...) Expand all Loading... |
72 Profile* profile, | 71 Profile* profile, |
73 Delegate* delegate); | 72 Delegate* delegate); |
74 ~ToolbarActionView() override; | 73 ~ToolbarActionView() override; |
75 | 74 |
76 // views::MenuButton: | 75 // views::MenuButton: |
77 void GetAccessibleState(ui::AXViewState* state) override; | 76 void GetAccessibleState(ui::AXViewState* state) override; |
78 | 77 |
79 // views::MenuButtonListener: | 78 // views::MenuButtonListener: |
80 void OnMenuButtonClicked(views::View* sender, | 79 void OnMenuButtonClicked(views::View* sender, |
81 const gfx::Point& point) override; | 80 const gfx::Point& point) override; |
82 void OnMenuButtonClickCanceled(views::View* sender) override; | |
83 | 81 |
84 // content::NotificationObserver: | 82 // content::NotificationObserver: |
85 void Observe(int type, | 83 void Observe(int type, |
86 const content::NotificationSource& source, | 84 const content::NotificationSource& source, |
87 const content::NotificationDetails& details) override; | 85 const content::NotificationDetails& details) override; |
88 | 86 |
89 // views::MenuButton: | 87 // views::MenuButton: |
90 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; | 88 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; |
91 void OnMouseEntered(const ui::MouseEvent& event) override; | 89 void OnMouseEntered(const ui::MouseEvent& event) override; |
92 bool ShouldEnterPushedState(const ui::Event& event) override; | 90 bool ShouldEnterPushedState(const ui::Event& event) override; |
(...skipping 17 matching lines...) Expand all Loading... |
110 static void set_context_menu_callback_for_testing( | 108 static void set_context_menu_callback_for_testing( |
111 ContextMenuCallback* callback); | 109 ContextMenuCallback* callback); |
112 | 110 |
113 views::MenuItemView* menu_for_testing() { return menu_; } | 111 views::MenuItemView* menu_for_testing() { return menu_; } |
114 | 112 |
115 // views::InkDropHost: | 113 // views::InkDropHost: |
116 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 114 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
117 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 115 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
118 | 116 |
119 protected: | 117 protected: |
120 // Returns the Point where the ink drop should be centered. | 118 // views::InkDropHost: |
121 virtual gfx::Point CalculateInkDropCenter() const; | 119 gfx::Point CalculateInkDropCenter() const override; |
122 | 120 |
123 views::InkDropAnimationController* ink_drop_animation_controller() { | 121 // views::View: |
124 return ink_drop_animation_controller_.get(); | 122 views::InkDropDelegate* GetInkDropDelegate() const override; |
125 } | |
126 | 123 |
127 private: | 124 private: |
128 // views::MenuButton: | 125 // views::MenuButton: |
129 gfx::Size GetPreferredSize() const override; | 126 gfx::Size GetPreferredSize() const override; |
130 void Layout() override; | |
131 bool OnMousePressed(const ui::MouseEvent& event) override; | |
132 void OnGestureEvent(ui::GestureEvent* event) override; | 127 void OnGestureEvent(ui::GestureEvent* event) override; |
133 void OnDragDone() override; | 128 void OnDragDone() override; |
134 void ViewHierarchyChanged( | 129 void ViewHierarchyChanged( |
135 const ViewHierarchyChangedDetails& details) override; | 130 const ViewHierarchyChangedDetails& details) override; |
136 | 131 |
137 // ToolbarActionViewDelegateViews: | 132 // ToolbarActionViewDelegateViews: |
138 views::View* GetAsView() override; | 133 views::View* GetAsView() override; |
139 views::FocusManager* GetFocusManagerForAccelerator() override; | 134 views::FocusManager* GetFocusManagerForAccelerator() override; |
140 views::View* GetReferenceViewForPopup() override; | 135 views::View* GetReferenceViewForPopup() override; |
141 bool IsMenuRunning() const override; | 136 bool IsMenuRunning() const override; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 179 |
185 // If non-null, this is the next toolbar action context menu that wants to run | 180 // If non-null, this is the next toolbar action context menu that wants to run |
186 // once the current owner (this one) is done. | 181 // once the current owner (this one) is done. |
187 base::Closure followup_context_menu_task_; | 182 base::Closure followup_context_menu_task_; |
188 | 183 |
189 // The time the popup was last closed. | 184 // The time the popup was last closed. |
190 base::TimeTicks popup_closed_time_; | 185 base::TimeTicks popup_closed_time_; |
191 | 186 |
192 content::NotificationRegistrar registrar_; | 187 content::NotificationRegistrar registrar_; |
193 | 188 |
194 // Animation controller for the ink drop ripple effect. | 189 // Animation delegate for the ink drop ripple effect. |
195 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_; | 190 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; |
196 | 191 |
197 base::WeakPtrFactory<ToolbarActionView> weak_factory_; | 192 base::WeakPtrFactory<ToolbarActionView> weak_factory_; |
198 | 193 |
199 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); | 194 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); |
200 }; | 195 }; |
201 | 196 |
202 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 197 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
OLD | NEW |