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

Unified Diff: chrome/browser/extensions/extension_toolbar_model.h

Issue 10533086: Action box menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Action box menu Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_toolbar_model.h
diff --git a/chrome/browser/extensions/extension_toolbar_model.h b/chrome/browser/extensions/extension_toolbar_model.h
index 2c4f27d6224e47e2e1f8badec951284deb527466..74d73d96b80599409ea1230085dafef31200c80b 100644
--- a/chrome/browser/extensions/extension_toolbar_model.h
+++ b/chrome/browser/extensions/extension_toolbar_model.h
@@ -8,6 +8,7 @@
#include "base/compiler_specific.h"
#include "base/observer_list.h"
#include "chrome/common/extensions/extension.h"
+#include "chrome/browser/extensions/extension_prefs.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -73,24 +74,34 @@ class ExtensionToolbarModel : public content::NotificationObserver {
bool extensions_initialized() const { return extensions_initialized_; }
size_t size() const {
- return toolitems_.size();
+ return toolbar_items_.size();
}
extensions::ExtensionList::iterator begin() {
- return toolitems_.begin();
+ return toolbar_items_.begin();
}
extensions::ExtensionList::iterator end() {
- return toolitems_.end();
+ return toolbar_items_.end();
}
- const extensions::Extension* GetExtensionByIndex(int index) const;
+ const extensions::Extension* GetExtensionByIndex(int index) const {
+ return toolbar_items_[index];
+ }
// Utility functions for converting between an index into the list of
// incognito-enabled browser actions, and the list of all browser actions.
int IncognitoIndexToOriginal(int incognito_index);
int OriginalIndexToIncognito(int original_index);
+ size_t action_box_extensions_size() {
+ return action_box_menu_items_.size();
+ }
+
+ const extensions::Extension* GetActionBoxExtensionByIndex(int index) const {
+ return action_box_menu_items_[index];
+ }
+
private:
// content::NotificationObserver implementation.
virtual void Observe(int type,
@@ -99,8 +110,21 @@ class ExtensionToolbarModel : public content::NotificationObserver {
// To be called after the extension service is ready; gets loaded extensions
// from the extension service and their saved order from the pref service
- // and constructs |toolitems_| from these data.
- void InitializeExtensionList();
+ // and constructs |toolbar_items_| and |action_box_items_| from these data.
+ void InitializeExtensionLists();
+ void PopulateForActionBoxMode();
+ void PopulateForNonActionBoxMode();
+
+ // A few helper functions to work with extension lists.
msw 2012/07/24 23:41:55 nit: describe these in a bit more detail.
yefimt 2012/07/25 21:09:21 Done.
+ void AddToProperList(const extensions::Extension* extension,
+ const extensions::ExtensionPrefs::ExtensionIdSet& order,
+ extensions::ExtensionList* sorted,
+ extensions::ExtensionList* unsorted);
+ void FillExtensionList(
+ const extensions::ExtensionPrefs::ExtensionIdSet& order,
+ extensions::ExtensionList* result_list);
+ bool FindInExtensionList(const extensions::Extension* extension,
msw 2012/07/24 23:41:55 nit: |IsInExtensionList| seems better. Or reimplem
yefimt 2012/07/25 21:09:21 Done.
+ const extensions::ExtensionList& extension_list);
// Save the model to prefs.
void UpdatePrefs();
@@ -108,8 +132,10 @@ class ExtensionToolbarModel : public content::NotificationObserver {
// Our observers.
ObserverList<Observer> observers_;
- void AddExtension(const extensions::Extension* extension);
- void RemoveExtension(const extensions::Extension* extension);
+ void AddExtension(const extensions::Extension* extension,
+ extensions::ExtensionList* result_list);
+ void RemoveExtension(const extensions::Extension* extension,
+ extensions::ExtensionList* result_list);
// Our ExtensionService, guaranteed to outlive us.
ExtensionService* service_;
@@ -120,7 +146,10 @@ class ExtensionToolbarModel : public content::NotificationObserver {
bool extensions_initialized_;
// Ordered list of browser action buttons.
- extensions::ExtensionList toolitems_;
+ extensions::ExtensionList toolbar_items_;
+
+ // List of browser action buttons visible in an action box menu.
+ extensions::ExtensionList action_box_menu_items_;
// Keeps track of what the last extension to get disabled was.
std::string last_extension_removed_;

Powered by Google App Engine
This is Rietveld 408576698