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_BROWSER_ACTION_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/extensions/extension_action_icon_factory.h" | 10 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 // Called when the user clicks on the browser action icon. | 51 // Called when the user clicks on the browser action icon. |
52 virtual void OnBrowserActionExecuted(BrowserActionButton* button) = 0; | 52 virtual void OnBrowserActionExecuted(BrowserActionButton* button) = 0; |
53 | 53 |
54 // Called when a browser action becomes visible/hidden. | 54 // Called when a browser action becomes visible/hidden. |
55 virtual void OnBrowserActionVisibilityChanged() = 0; | 55 virtual void OnBrowserActionVisibilityChanged() = 0; |
56 | 56 |
57 // Whether the container for this button is shown inside a menu. | 57 // Whether the container for this button is shown inside a menu. |
58 virtual bool ShownInsideMenu() const = 0; | 58 virtual bool ShownInsideMenu() const = 0; |
59 | 59 |
60 // Notifies that a drag completed. Note this will only happen if the view | |
61 // wasn't removed during the drag-and-drop process (i.e., not when there | |
62 // was a move in the browser actions, since we re-create the views each | |
63 // time we re-order the browser actions). | |
64 virtual void OnBrowserActionViewDragDone() = 0; | |
65 | |
66 protected: | 60 protected: |
67 virtual ~Delegate() {} | 61 virtual ~Delegate() {} |
68 }; | 62 }; |
69 | 63 |
70 BrowserActionView(const extensions::Extension* extension, | 64 BrowserActionView(const extensions::Extension* extension, |
71 Browser* browser, | 65 Browser* browser, |
72 Delegate* delegate); | 66 Delegate* delegate); |
73 virtual ~BrowserActionView(); | 67 virtual ~BrowserActionView(); |
74 | 68 |
75 BrowserActionButton* button() { return button_; } | 69 BrowserActionButton* button() { return button_; } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // Gets the icon of this button and its badge. | 194 // Gets the icon of this button and its badge. |
201 gfx::ImageSkia GetIconWithBadge(); | 195 gfx::ImageSkia GetIconWithBadge(); |
202 | 196 |
203 // Returns button icon so it can be accessed during tests. | 197 // Returns button icon so it can be accessed during tests. |
204 gfx::ImageSkia GetIconForTest(); | 198 gfx::ImageSkia GetIconForTest(); |
205 | 199 |
206 protected: | 200 protected: |
207 // Overridden from views::View: | 201 // Overridden from views::View: |
208 virtual void ViewHierarchyChanged( | 202 virtual void ViewHierarchyChanged( |
209 const ViewHierarchyChangedDetails& details) OVERRIDE; | 203 const ViewHierarchyChangedDetails& details) OVERRIDE; |
210 virtual void OnDragDone() OVERRIDE; | |
211 | 204 |
212 private: | 205 private: |
213 virtual ~BrowserActionButton(); | 206 virtual ~BrowserActionButton(); |
214 | 207 |
215 // Register an extension command if the extension has an active one. | 208 // Register an extension command if the extension has an active one. |
216 void MaybeRegisterExtensionCommand(); | 209 void MaybeRegisterExtensionCommand(); |
217 | 210 |
218 // Unregisters an extension command, if the extension has registered one and | 211 // Unregisters an extension command, if the extension has registered one and |
219 // it is active. | 212 // it is active. |
220 void MaybeUnregisterExtensionCommand(bool only_if_active); | 213 void MaybeUnregisterExtensionCommand(bool only_if_active); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // The observer that we need to notify when the icon of the button has been | 247 // The observer that we need to notify when the icon of the button has been |
255 // updated. | 248 // updated. |
256 IconObserver* icon_observer_; | 249 IconObserver* icon_observer_; |
257 | 250 |
258 friend class base::DeleteHelper<BrowserActionButton>; | 251 friend class base::DeleteHelper<BrowserActionButton>; |
259 | 252 |
260 DISALLOW_COPY_AND_ASSIGN(BrowserActionButton); | 253 DISALLOW_COPY_AND_ASSIGN(BrowserActionButton); |
261 }; | 254 }; |
262 | 255 |
263 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ | 256 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ |
OLD | NEW |