Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: chrome/browser/ui/views/toolbar/browser_action_view.h

Issue 148143004: Add notification mechanism when BrowserActionButton's icon has been updated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 // The BrowserActionButton is a specialization of the MenuButton class. 105 // The BrowserActionButton is a specialization of the MenuButton class.
106 // It acts on a ExtensionAction, in this case a BrowserAction and handles 106 // It acts on a ExtensionAction, in this case a BrowserAction and handles
107 // loading the image for the button asynchronously on the file thread. 107 // loading the image for the button asynchronously on the file thread.
108 class BrowserActionButton : public views::MenuButton, 108 class BrowserActionButton : public views::MenuButton,
109 public views::ButtonListener, 109 public views::ButtonListener,
110 public views::ContextMenuController, 110 public views::ContextMenuController,
111 public content::NotificationObserver, 111 public content::NotificationObserver,
112 public ExtensionActionIconFactory::Observer { 112 public ExtensionActionIconFactory::Observer {
113 public: 113 public:
114 // The IconObserver will receive a notification when the button's icon has
115 // been updated.
116 class IconObserver {
117 public:
118 virtual ~IconObserver() {}
119 virtual void OnIconUpdated(const gfx::ImageSkia& icon) = 0;
120 };
121
122 void set_icon_observer(IconObserver* icon_observer) {
123 icon_observer_ = icon_observer;
124 }
125
114 BrowserActionButton(const extensions::Extension* extension, 126 BrowserActionButton(const extensions::Extension* extension,
115 Browser* browser_, 127 Browser* browser_,
116 BrowserActionView::Delegate* delegate); 128 BrowserActionView::Delegate* delegate);
117 129
118 // Call this instead of delete. 130 // Call this instead of delete.
119 void Destroy(); 131 void Destroy();
120 132
121 ExtensionAction* browser_action() const { return browser_action_; } 133 ExtensionAction* browser_action() const { return browser_action_; }
122 const extensions::Extension* extension() { return extension_; } 134 const extensions::Extension* extension() { return extension_; }
123 135
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 235
224 content::NotificationRegistrar registrar_; 236 content::NotificationRegistrar registrar_;
225 237
226 // The extension key binding accelerator this browser action is listening for 238 // The extension key binding accelerator this browser action is listening for
227 // (to show the popup). 239 // (to show the popup).
228 scoped_ptr<ui::Accelerator> keybinding_; 240 scoped_ptr<ui::Accelerator> keybinding_;
229 241
230 // Responsible for running the menu. 242 // Responsible for running the menu.
231 scoped_ptr<views::MenuRunner> menu_runner_; 243 scoped_ptr<views::MenuRunner> menu_runner_;
232 244
245 IconObserver* icon_observer_;
Finnur 2014/02/10 10:41:41 nit: Document.
246
233 friend class base::DeleteHelper<BrowserActionButton>; 247 friend class base::DeleteHelper<BrowserActionButton>;
234 248
235 DISALLOW_COPY_AND_ASSIGN(BrowserActionButton); 249 DISALLOW_COPY_AND_ASSIGN(BrowserActionButton);
236 }; 250 };
237 251
238 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ 252 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698