| 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 "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" | 8 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" |
| 9 #include "content/public/browser/notification_observer.h" | 9 #include "content/public/browser/notification_observer.h" |
| 10 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Whether the container for this button is shown inside a menu. | 49 // Whether the container for this button is shown inside a menu. |
| 50 virtual bool ShownInsideMenu() const = 0; | 50 virtual bool ShownInsideMenu() const = 0; |
| 51 | 51 |
| 52 // Notifies that a drag completed. | 52 // Notifies that a drag completed. |
| 53 virtual void OnToolbarActionViewDragDone() = 0; | 53 virtual void OnToolbarActionViewDragDone() = 0; |
| 54 | 54 |
| 55 // Returns the view of the toolbar actions overflow menu to use as a | 55 // Returns the view of the toolbar actions overflow menu to use as a |
| 56 // reference point for a popup when this view isn't visible. | 56 // reference point for a popup when this view isn't visible. |
| 57 virtual views::MenuButton* GetOverflowReferenceView() = 0; | 57 virtual views::MenuButton* GetOverflowReferenceView() = 0; |
| 58 | 58 |
| 59 // Notifies the delegate that the mouse entered the view. |
| 60 virtual void OnMouseEnteredToolbarActionView() = 0; |
| 61 |
| 59 protected: | 62 protected: |
| 60 ~Delegate() override {} | 63 ~Delegate() override {} |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 ToolbarActionView(ToolbarActionViewController* view_controller, | 66 ToolbarActionView(ToolbarActionViewController* view_controller, |
| 64 Profile* profile, | 67 Profile* profile, |
| 65 Delegate* delegate); | 68 Delegate* delegate); |
| 66 ~ToolbarActionView() override; | 69 ~ToolbarActionView() override; |
| 67 | 70 |
| 68 // views::MenuButton: | 71 // views::MenuButton: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 79 // MenuButton behavior overrides. These methods all default to LabelButton | 82 // MenuButton behavior overrides. These methods all default to LabelButton |
| 80 // behavior unless this button is a popup. In that case, it uses MenuButton | 83 // behavior unless this button is a popup. In that case, it uses MenuButton |
| 81 // behavior. MenuButton has the notion of a child popup being shown where the | 84 // behavior. MenuButton has the notion of a child popup being shown where the |
| 82 // button will stay in the pushed state until the "menu" (a popup in this | 85 // button will stay in the pushed state until the "menu" (a popup in this |
| 83 // case) is dismissed. | 86 // case) is dismissed. |
| 84 // TODO(devlin): This is a good idea, but it has some funny UI side-effects, | 87 // TODO(devlin): This is a good idea, but it has some funny UI side-effects, |
| 85 // like the fact that label buttons enter a pressed state immediately, but | 88 // like the fact that label buttons enter a pressed state immediately, but |
| 86 // menu buttons only enter a pressed state on release (if they're draggable). | 89 // menu buttons only enter a pressed state on release (if they're draggable). |
| 87 // We should probably just pick a behavior, and stick to it. | 90 // We should probably just pick a behavior, and stick to it. |
| 88 bool Activate() override; | 91 bool Activate() override; |
| 92 void OnMouseEntered(const ui::MouseEvent& event) override; |
| 89 bool OnMousePressed(const ui::MouseEvent& event) override; | 93 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 90 void OnMouseReleased(const ui::MouseEvent& event) override; | 94 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 91 void OnMouseExited(const ui::MouseEvent& event) override; | 95 void OnMouseExited(const ui::MouseEvent& event) override; |
| 92 bool OnKeyReleased(const ui::KeyEvent& event) override; | 96 bool OnKeyReleased(const ui::KeyEvent& event) override; |
| 93 void OnGestureEvent(ui::GestureEvent* event) override; | 97 void OnGestureEvent(ui::GestureEvent* event) override; |
| 94 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; | 98 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; |
| 95 bool ShouldEnterPushedState(const ui::Event& event) override; | 99 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 96 | 100 |
| 97 // ToolbarActionViewDelegate: (public because called by others). | 101 // ToolbarActionViewDelegate: (public because called by others). |
| 98 void UpdateState() override; | 102 void UpdateState() override; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 base::Closure followup_context_menu_task_; | 173 base::Closure followup_context_menu_task_; |
| 170 | 174 |
| 171 content::NotificationRegistrar registrar_; | 175 content::NotificationRegistrar registrar_; |
| 172 | 176 |
| 173 base::WeakPtrFactory<ToolbarActionView> weak_factory_; | 177 base::WeakPtrFactory<ToolbarActionView> weak_factory_; |
| 174 | 178 |
| 175 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); | 179 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); |
| 176 }; | 180 }; |
| 177 | 181 |
| 178 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 182 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
| OLD | NEW |