OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_ACTION_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BROWSER_ACTION_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_ACTION_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_ACTION_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/extensions/image_loading_tracker.h" | 10 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 11 #include "chrome/common/extensions/extension_action.h" |
11 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
12 #include "ui/views/context_menu_controller.h" | 13 #include "ui/views/context_menu_controller.h" |
13 #include "ui/views/controls/button/menu_button.h" | 14 #include "ui/views/controls/button/menu_button.h" |
14 #include "ui/views/controls/button/menu_button_listener.h" | 15 #include "ui/views/controls/button/menu_button_listener.h" |
15 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
16 | 17 |
17 class BrowserActionsContainer; | 18 class BrowserActionsContainer; |
18 class ExtensionAction; | 19 class ExtensionAction; |
19 | 20 |
20 namespace views { | 21 namespace views { |
(...skipping 17 matching lines...) Expand all Loading... |
38 | 39 |
39 // Call this instead of delete. | 40 // Call this instead of delete. |
40 void Destroy(); | 41 void Destroy(); |
41 | 42 |
42 ExtensionAction* browser_action() const { return browser_action_; } | 43 ExtensionAction* browser_action() const { return browser_action_; } |
43 const extensions::Extension* extension() { return extension_; } | 44 const extensions::Extension* extension() { return extension_; } |
44 | 45 |
45 // Called to update the display to match the browser action's state. | 46 // Called to update the display to match the browser action's state. |
46 void UpdateState(); | 47 void UpdateState(); |
47 | 48 |
48 // Returns the default icon, if any. | 49 // Returns the icon that were loaded from paths, if any. |
49 const SkBitmap& default_icon() const { return default_icon_; } | 50 const ExtensionAction::PathToIconCache& loaded_icons() const { |
| 51 return loaded_icons_; |
| 52 } |
50 | 53 |
51 // Does this button's action have a popup? | 54 // Does this button's action have a popup? |
52 virtual bool IsPopup(); | 55 virtual bool IsPopup(); |
53 virtual GURL GetPopupUrl(); | 56 virtual GURL GetPopupUrl(); |
54 | 57 |
55 // Overridden from views::View: | 58 // Overridden from views::View: |
56 virtual bool CanHandleAccelerators() const OVERRIDE; | 59 virtual bool CanHandleAccelerators() const OVERRIDE; |
57 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 60 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
58 | 61 |
59 // Overridden from views::ButtonListener: | 62 // Overridden from views::ButtonListener: |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // by this class. | 121 // by this class. |
119 ExtensionAction* browser_action_; | 122 ExtensionAction* browser_action_; |
120 | 123 |
121 // The extension associated with the browser action we're displaying. | 124 // The extension associated with the browser action we're displaying. |
122 const extensions::Extension* extension_; | 125 const extensions::Extension* extension_; |
123 | 126 |
124 // The object that is waiting for the image loading to complete | 127 // The object that is waiting for the image loading to complete |
125 // asynchronously. | 128 // asynchronously. |
126 ImageLoadingTracker tracker_; | 129 ImageLoadingTracker tracker_; |
127 | 130 |
128 // The default icon for our browser action. This might be non-empty if the | 131 // Icons loaded from paths. Currently just the browser action's default icon |
129 // browser action had a value for default_icon in the manifest. | 132 // if any. |
130 SkBitmap default_icon_; | 133 ExtensionAction::PathToIconCache loaded_icons_; |
131 | 134 |
132 // The browser action shelf. | 135 // The browser action shelf. |
133 BrowserActionsContainer* panel_; | 136 BrowserActionsContainer* panel_; |
134 | 137 |
135 // The context menu. This member is non-NULL only when the menu is shown. | 138 // The context menu. This member is non-NULL only when the menu is shown. |
136 views::MenuItemView* context_menu_; | 139 views::MenuItemView* context_menu_; |
137 | 140 |
138 content::NotificationRegistrar registrar_; | 141 content::NotificationRegistrar registrar_; |
139 | 142 |
140 // The extension keybinding accelerator this browser action is listening for | 143 // The extension keybinding accelerator this browser action is listening for |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // The container for this view. | 180 // The container for this view. |
178 BrowserActionsContainer* panel_; | 181 BrowserActionsContainer* panel_; |
179 | 182 |
180 // The button this view contains. | 183 // The button this view contains. |
181 BrowserActionButton* button_; | 184 BrowserActionButton* button_; |
182 | 185 |
183 DISALLOW_COPY_AND_ASSIGN(BrowserActionView); | 186 DISALLOW_COPY_AND_ASSIGN(BrowserActionView); |
184 }; | 187 }; |
185 | 188 |
186 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTION_VIEW_H_ | 189 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTION_VIEW_H_ |
OLD | NEW |