| 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 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 //////////////////////////////////////////////////////////////////////////////// | 35 //////////////////////////////////////////////////////////////////////////////// |
| 36 // ToolbarActionView | 36 // ToolbarActionView |
| 37 // A wrapper around a ToolbarActionViewController to display a toolbar action | 37 // A wrapper around a ToolbarActionViewController to display a toolbar action |
| 38 // action in the BrowserActionsContainer. | 38 // action in the BrowserActionsContainer. |
| 39 class ToolbarActionView : public views::MenuButton, | 39 class ToolbarActionView : public views::MenuButton, |
| 40 public ToolbarActionViewDelegateViews, | 40 public ToolbarActionViewDelegateViews, |
| 41 public views::MenuButtonListener, | 41 public views::MenuButtonListener, |
| 42 public views::ContextMenuController, | 42 public views::ContextMenuController, |
| 43 public content::NotificationObserver, | |
| 44 public views::InkDropHost { | 43 public views::InkDropHost { |
| 45 public: | 44 public: |
| 46 // Need DragController here because ToolbarActionView could be | 45 // Need DragController here because ToolbarActionView could be |
| 47 // dragged/dropped. | 46 // dragged/dropped. |
| 48 class Delegate : public views::DragController { | 47 class Delegate : public views::DragController { |
| 49 public: | 48 public: |
| 50 // Returns the current web contents. | 49 // Returns the current web contents. |
| 51 virtual content::WebContents* GetCurrentWebContents() = 0; | 50 virtual content::WebContents* GetCurrentWebContents() = 0; |
| 52 | 51 |
| 53 // Whether the container for this button is shown inside a menu. | 52 // Whether the container for this button is shown inside a menu. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 69 | 68 |
| 70 // Callback type used for testing. | 69 // Callback type used for testing. |
| 71 using ContextMenuCallback = base::Callback<void(ToolbarActionView*)>; | 70 using ContextMenuCallback = base::Callback<void(ToolbarActionView*)>; |
| 72 | 71 |
| 73 ToolbarActionView(ToolbarActionViewController* view_controller, | 72 ToolbarActionView(ToolbarActionViewController* view_controller, |
| 74 Profile* profile, | 73 Profile* profile, |
| 75 Delegate* delegate); | 74 Delegate* delegate); |
| 76 ~ToolbarActionView() override; | 75 ~ToolbarActionView() override; |
| 77 | 76 |
| 78 // views::MenuButton: | 77 // views::MenuButton: |
| 78 void OnThemeChanged() override; |
| 79 void GetAccessibleState(ui::AXViewState* state) override; | 79 void GetAccessibleState(ui::AXViewState* state) override; |
| 80 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; | 80 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; |
| 81 void OnMouseEntered(const ui::MouseEvent& event) override; | 81 void OnMouseEntered(const ui::MouseEvent& event) override; |
| 82 bool ShouldEnterPushedState(const ui::Event& event) override; | 82 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 83 | 83 |
| 84 // ToolbarActionViewDelegateViews: | 84 // ToolbarActionViewDelegateViews: |
| 85 content::WebContents* GetCurrentWebContents() const override; | 85 content::WebContents* GetCurrentWebContents() const override; |
| 86 void UpdateState() override; | 86 void UpdateState() override; |
| 87 | 87 |
| 88 // views::MenuButtonListener: | 88 // views::MenuButtonListener: |
| 89 void OnMenuButtonClicked(views::View* sender, | 89 void OnMenuButtonClicked(views::View* sender, |
| 90 const gfx::Point& point) override; | 90 const gfx::Point& point) override; |
| 91 | 91 |
| 92 // content::NotificationObserver: | |
| 93 void Observe(int type, | |
| 94 const content::NotificationSource& source, | |
| 95 const content::NotificationDetails& details) override; | |
| 96 | |
| 97 // views::InkDropHost: | 92 // views::InkDropHost: |
| 98 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 93 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 99 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 94 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 100 | 95 |
| 101 ToolbarActionViewController* view_controller() { | 96 ToolbarActionViewController* view_controller() { |
| 102 return view_controller_; | 97 return view_controller_; |
| 103 } | 98 } |
| 104 | 99 |
| 105 // Returns button icon so it can be accessed during tests. | 100 // Returns button icon so it can be accessed during tests. |
| 106 gfx::ImageSkia GetIconForTest(); | 101 gfx::ImageSkia GetIconForTest(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 base::TimeTicks popup_closed_time_; | 177 base::TimeTicks popup_closed_time_; |
| 183 | 178 |
| 184 content::NotificationRegistrar registrar_; | 179 content::NotificationRegistrar registrar_; |
| 185 | 180 |
| 186 base::WeakPtrFactory<ToolbarActionView> weak_factory_; | 181 base::WeakPtrFactory<ToolbarActionView> weak_factory_; |
| 187 | 182 |
| 188 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); | 183 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); |
| 189 }; | 184 }; |
| 190 | 185 |
| 191 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 186 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
| OLD | NEW |