| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // content::NotificationObserver: | 80 // content::NotificationObserver: |
| 81 void Observe(int type, | 81 void Observe(int type, |
| 82 const content::NotificationSource& source, | 82 const content::NotificationSource& source, |
| 83 const content::NotificationDetails& details) override; | 83 const content::NotificationDetails& details) override; |
| 84 | 84 |
| 85 // MenuButton behavior overrides. These methods all default to LabelButton | 85 // MenuButton behavior overrides. These methods all default to LabelButton |
| 86 // behavior unless this button is a popup. In that case, it uses MenuButton | 86 // behavior unless this button is a popup. In that case, it uses MenuButton |
| 87 // behavior. MenuButton has the notion of a child popup being shown where the | 87 // behavior. MenuButton has the notion of a child popup being shown where the |
| 88 // button will stay in the pushed state until the "menu" (a popup in this | 88 // button will stay in the pushed state until the "menu" (a popup in this |
| 89 // case) is dismissed. | 89 // case) is dismissed. |
| 90 // TODO(devlin): This is a good idea, but it has some funny UI side-effects, |
| 91 // like the fact that label buttons enter a pressed state immediately, but |
| 92 // menu buttons only enter a pressed state on release (if they're draggable). |
| 93 // We should probably just pick a behavior, and stick to it. |
| 90 bool Activate() override; | 94 bool Activate() override; |
| 91 bool OnMousePressed(const ui::MouseEvent& event) override; | 95 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 92 void OnMouseReleased(const ui::MouseEvent& event) override; | 96 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 93 void OnMouseExited(const ui::MouseEvent& event) override; | 97 void OnMouseExited(const ui::MouseEvent& event) override; |
| 94 bool OnKeyReleased(const ui::KeyEvent& event) override; | 98 bool OnKeyReleased(const ui::KeyEvent& event) override; |
| 95 void OnGestureEvent(ui::GestureEvent* event) override; | 99 void OnGestureEvent(ui::GestureEvent* event) override; |
| 96 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; | 100 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; |
| 101 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 97 | 102 |
| 98 // ToolbarActionViewDelegate: (public because called by others). | 103 // ToolbarActionViewDelegate: (public because called by others). |
| 99 void UpdateState() override; | 104 void UpdateState() override; |
| 100 content::WebContents* GetCurrentWebContents() const override; | 105 content::WebContents* GetCurrentWebContents() const override; |
| 101 | 106 |
| 102 ToolbarActionViewController* view_controller() { | 107 ToolbarActionViewController* view_controller() { |
| 103 return view_controller_; | 108 return view_controller_; |
| 104 } | 109 } |
| 105 | 110 |
| 106 // Returns button icon so it can be accessed during tests. | 111 // Returns button icon so it can be accessed during tests. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 156 |
| 152 // A special border to draw when the action wants to run. | 157 // A special border to draw when the action wants to run. |
| 153 scoped_ptr<views::LabelButtonBorder> wants_to_run_border_; | 158 scoped_ptr<views::LabelButtonBorder> wants_to_run_border_; |
| 154 | 159 |
| 155 content::NotificationRegistrar registrar_; | 160 content::NotificationRegistrar registrar_; |
| 156 | 161 |
| 157 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); | 162 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); |
| 158 }; | 163 }; |
| 159 | 164 |
| 160 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 165 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
| OLD | NEW |