| 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" |
| 11 #include "ui/views/context_menu_controller.h" | 11 #include "ui/views/context_menu_controller.h" |
| 12 #include "ui/views/controls/button/menu_button.h" | 12 #include "ui/views/controls/button/menu_button.h" |
| 13 #include "ui/views/controls/button/menu_button_listener.h" | 13 #include "ui/views/controls/button/menu_button_listener.h" |
| 14 #include "ui/views/drag_controller.h" | 14 #include "ui/views/drag_controller.h" |
| 15 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
| 16 | 16 |
| 17 class ExtensionAction; | 17 class ExtensionAction; |
| 18 class Profile; | |
| 19 | 18 |
| 20 namespace extensions { | 19 namespace extensions { |
| 21 class Extension; | 20 class Extension; |
| 22 } | 21 } |
| 23 | 22 |
| 24 namespace gfx { | 23 namespace gfx { |
| 25 class Image; | 24 class Image; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace views { | 27 namespace views { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 virtual void OnMouseEnteredToolbarActionView() = 0; | 59 virtual void OnMouseEnteredToolbarActionView() = 0; |
| 61 | 60 |
| 62 protected: | 61 protected: |
| 63 ~Delegate() override {} | 62 ~Delegate() override {} |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 // Callback type used for testing. | 65 // Callback type used for testing. |
| 67 using ContextMenuCallback = base::Callback<void(ToolbarActionView*)>; | 66 using ContextMenuCallback = base::Callback<void(ToolbarActionView*)>; |
| 68 | 67 |
| 69 ToolbarActionView(ToolbarActionViewController* view_controller, | 68 ToolbarActionView(ToolbarActionViewController* view_controller, |
| 70 Profile* profile, | |
| 71 Delegate* delegate); | 69 Delegate* delegate); |
| 72 ~ToolbarActionView() override; | 70 ~ToolbarActionView() override; |
| 73 | 71 |
| 74 // views::MenuButton: | 72 // views::MenuButton: |
| 75 void GetAccessibleState(ui::AXViewState* state) override; | 73 void GetAccessibleState(ui::AXViewState* state) override; |
| 76 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; | 74 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; |
| 77 void OnMouseEntered(const ui::MouseEvent& event) override; | 75 void OnMouseEntered(const ui::MouseEvent& event) override; |
| 78 bool ShouldEnterPushedState(const ui::Event& event) override; | 76 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 79 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 77 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 80 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 78 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // opened. | 131 // opened. |
| 134 // Returns true if a menu was closed, false otherwise. | 132 // Returns true if a menu was closed, false otherwise. |
| 135 bool CloseActiveMenuIfNeeded(); | 133 bool CloseActiveMenuIfNeeded(); |
| 136 | 134 |
| 137 // A lock to keep the MenuButton pressed when a menu or popup is visible. | 135 // A lock to keep the MenuButton pressed when a menu or popup is visible. |
| 138 scoped_ptr<views::MenuButton::PressedLock> pressed_lock_; | 136 scoped_ptr<views::MenuButton::PressedLock> pressed_lock_; |
| 139 | 137 |
| 140 // The controller for this toolbar action view. | 138 // The controller for this toolbar action view. |
| 141 ToolbarActionViewController* view_controller_; | 139 ToolbarActionViewController* view_controller_; |
| 142 | 140 |
| 143 // The associated profile. | |
| 144 Profile* profile_; | |
| 145 | |
| 146 // Delegate that usually represents a container for ToolbarActionView. | 141 // Delegate that usually represents a container for ToolbarActionView. |
| 147 Delegate* delegate_; | 142 Delegate* delegate_; |
| 148 | 143 |
| 149 // Used to make sure we only register the command once. | 144 // Used to make sure we only register the command once. |
| 150 bool called_register_command_; | 145 bool called_register_command_; |
| 151 | 146 |
| 152 // The cached value of whether or not the action wants to run on the current | 147 // The cached value of whether or not the action wants to run on the current |
| 153 // tab. | 148 // tab. |
| 154 bool wants_to_run_; | 149 bool wants_to_run_; |
| 155 | 150 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 168 base::TimeTicks popup_closed_time_; | 163 base::TimeTicks popup_closed_time_; |
| 169 | 164 |
| 170 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; | 165 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; |
| 171 | 166 |
| 172 base::WeakPtrFactory<ToolbarActionView> weak_factory_; | 167 base::WeakPtrFactory<ToolbarActionView> weak_factory_; |
| 173 | 168 |
| 174 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); | 169 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); |
| 175 }; | 170 }; |
| 176 | 171 |
| 177 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 172 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
| OLD | NEW |