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 "base/macros.h" | 9 #include "base/macros.h" |
10 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" | 10 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 // Callback type used for testing. | 64 // Callback type used for testing. |
65 using ContextMenuCallback = base::Callback<void(ToolbarActionView*)>; | 65 using ContextMenuCallback = base::Callback<void(ToolbarActionView*)>; |
66 | 66 |
67 ToolbarActionView(ToolbarActionViewController* view_controller, | 67 ToolbarActionView(ToolbarActionViewController* view_controller, |
68 Delegate* delegate); | 68 Delegate* delegate); |
69 ~ToolbarActionView() override; | 69 ~ToolbarActionView() override; |
70 | 70 |
71 // views::MenuButton: | 71 // views::MenuButton: |
72 void GetAccessibleState(ui::AXViewState* state) override; | 72 void GetAccessibleState(ui::AXViewState* state) override; |
73 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; | 73 std::unique_ptr<views::LabelButtonBorder> CreateDefaultBorder() |
| 74 const override; |
74 bool IsTriggerableEvent(const ui::Event& event) override; | 75 bool IsTriggerableEvent(const ui::Event& event) override; |
75 SkColor GetInkDropBaseColor() const override; | 76 SkColor GetInkDropBaseColor() const override; |
76 bool ShouldShowInkDropHover() const override; | 77 bool ShouldShowInkDropHover() const override; |
77 | 78 |
78 // ToolbarActionViewDelegateViews: | 79 // ToolbarActionViewDelegateViews: |
79 content::WebContents* GetCurrentWebContents() const override; | 80 content::WebContents* GetCurrentWebContents() const override; |
80 void UpdateState() override; | 81 void UpdateState() override; |
81 | 82 |
82 // views::MenuButtonListener: | 83 // views::MenuButtonListener: |
83 void OnMenuButtonClicked(views::MenuButton* source, | 84 void OnMenuButtonClicked(views::MenuButton* source, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Closes the currently-active menu, if needed. This is the case when there | 129 // Closes the currently-active menu, if needed. This is the case when there |
129 // is an active menu that wouldn't close automatically when a new one is | 130 // is an active menu that wouldn't close automatically when a new one is |
130 // opened. | 131 // opened. |
131 // Returns true if a menu was closed, false otherwise. | 132 // Returns true if a menu was closed, false otherwise. |
132 bool CloseActiveMenuIfNeeded(); | 133 bool CloseActiveMenuIfNeeded(); |
133 | 134 |
134 // Callback for MenuModelAdapter. | 135 // Callback for MenuModelAdapter. |
135 void OnMenuClosed(); | 136 void OnMenuClosed(); |
136 | 137 |
137 // A lock to keep the MenuButton pressed when a menu or popup is visible. | 138 // A lock to keep the MenuButton pressed when a menu or popup is visible. |
138 scoped_ptr<views::MenuButton::PressedLock> pressed_lock_; | 139 std::unique_ptr<views::MenuButton::PressedLock> pressed_lock_; |
139 | 140 |
140 // The controller for this toolbar action view. | 141 // The controller for this toolbar action view. |
141 ToolbarActionViewController* view_controller_; | 142 ToolbarActionViewController* view_controller_; |
142 | 143 |
143 // Delegate that usually represents a container for ToolbarActionView. | 144 // Delegate that usually represents a container for ToolbarActionView. |
144 Delegate* delegate_; | 145 Delegate* delegate_; |
145 | 146 |
146 // Used to make sure we only register the command once. | 147 // Used to make sure we only register the command once. |
147 bool called_register_command_; | 148 bool called_register_command_; |
148 | 149 |
149 // The cached value of whether or not the action wants to run on the current | 150 // The cached value of whether or not the action wants to run on the current |
150 // tab. | 151 // tab. |
151 bool wants_to_run_; | 152 bool wants_to_run_; |
152 | 153 |
153 // Responsible for converting the context menu model into |menu_|. | 154 // Responsible for converting the context menu model into |menu_|. |
154 scoped_ptr<views::MenuModelAdapter> menu_adapter_; | 155 std::unique_ptr<views::MenuModelAdapter> menu_adapter_; |
155 | 156 |
156 // Responsible for running the menu. | 157 // Responsible for running the menu. |
157 scoped_ptr<views::MenuRunner> menu_runner_; | 158 std::unique_ptr<views::MenuRunner> menu_runner_; |
158 | 159 |
159 // The root MenuItemView for the context menu, or null if no menu is being | 160 // The root MenuItemView for the context menu, or null if no menu is being |
160 // shown. | 161 // shown. |
161 views::MenuItemView* menu_; | 162 views::MenuItemView* menu_; |
162 | 163 |
163 // The time the popup was last closed. | 164 // The time the popup was last closed. |
164 base::TimeTicks popup_closed_time_; | 165 base::TimeTicks popup_closed_time_; |
165 | 166 |
166 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; | 167 std::unique_ptr<views::InkDropDelegate> ink_drop_delegate_; |
167 | 168 |
168 base::WeakPtrFactory<ToolbarActionView> weak_factory_; | 169 base::WeakPtrFactory<ToolbarActionView> weak_factory_; |
169 | 170 |
170 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); | 171 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); |
171 }; | 172 }; |
172 | 173 |
173 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 174 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
OLD | NEW |