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

Side by Side Diff: chrome/browser/extensions/extension_toolbar_model.h

Issue 462026: Extensions: create a simple model for the browser action buttons toolstrip an... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_toolbar_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_
7
8 #include "base/observer_list.h"
9 #include "chrome/common/extensions/extension.h"
10 #include "chrome/common/notification_observer.h"
11 #include "chrome/common/notification_registrar.h"
12
13 class ExtensionsService;
14
15 // Model for the browser actions toolbar.
16 class ExtensionToolbarModel : public NotificationObserver {
17 public:
18 explicit ExtensionToolbarModel(ExtensionsService* service);
19 ~ExtensionToolbarModel();
20
21 // A class which is informed of changes to the model; represents the view of
22 // MVC.
23 class Observer {
24 public:
25 // An extension with a browser action button has been added, and should go
26 // in the toolbar at |index|.
27 virtual void BrowserActionAdded(Extension* extension, int index) {}
28
29 // The browser action button for |extension| should no longer show.
30 virtual void BrowserActionRemoved(Extension* extension) {}
31 };
32
33 void AddObserver(Observer* observer);
34 void RemoveObserver(Observer* observer);
35
36 ExtensionList::iterator begin() {
37 return toolitems_.begin();
38 }
39
40 ExtensionList::iterator end() {
41 return toolitems_.end();
42 }
43
44 private:
45 // NotificationObserver implementation.
46 virtual void Observe(NotificationType type,
47 const NotificationSource& source,
48 const NotificationDetails& details);
49
50 // Our observers.
51 ObserverList<Observer> observers_;
52
53 void AddExtension(Extension* extension);
54 void RemoveExtension(Extension* extension);
55
56 // Our ExtensionsService, guaranteed to outlive us.
57 ExtensionsService* service_;
58
59 // Ordered list of browser action buttons.
60 ExtensionList toolitems_;
61
62 NotificationRegistrar registrar_;
63 };
64 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLBAR_MODEL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_toolbar_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698