diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 18:14:40 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 18:14:40 +0000 |
commit | e1dcaa35aa42316781e96cfe7b808f5ec7b0e55a (patch) | |
tree | e4c9ad658c4226404a5d1881682b269bf427bc1c /chrome | |
parent | d1894cea41b1c4bff639ea125645daf8a7ce57de (diff) | |
download | chromium_src-e1dcaa35aa42316781e96cfe7b808f5ec7b0e55a.zip chromium_src-e1dcaa35aa42316781e96cfe7b808f5ec7b0e55a.tar.gz chromium_src-e1dcaa35aa42316781e96cfe7b808f5ec7b0e55a.tar.bz2 |
Fix a bug where an open incognito window's browser actions would not update
when enabling an extension to run in incognito mode.
BUG=39355
Review URL: http://codereview.chromium.org/1569003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43110 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
4 files changed, 11 insertions, 3 deletions
diff --git a/chrome/browser/extensions/extension_toolbar_model.cc b/chrome/browser/extensions/extension_toolbar_model.cc index 0d8472e..f99928a 100644 --- a/chrome/browser/extensions/extension_toolbar_model.cc +++ b/chrome/browser/extensions/extension_toolbar_model.cc @@ -14,7 +14,8 @@ ExtensionToolbarModel::ExtensionToolbarModel(ExtensionsService* service) : service_(service), - prefs_(service->profile()->GetPrefs()) { + prefs_(service->profile()->GetPrefs()), + extensions_initialized_(false) { DCHECK(service_); registrar_.Add(this, NotificationType::EXTENSION_LOADED, @@ -186,6 +187,8 @@ void ExtensionToolbarModel::InitializeExtensionList() { } UpdatePrefs(); + + extensions_initialized_ = true; } void ExtensionToolbarModel::UpdatePrefs() { diff --git a/chrome/browser/extensions/extension_toolbar_model.h b/chrome/browser/extensions/extension_toolbar_model.h index 44f7950..a4e5c64 100644 --- a/chrome/browser/extensions/extension_toolbar_model.h +++ b/chrome/browser/extensions/extension_toolbar_model.h @@ -44,6 +44,8 @@ class ExtensionToolbarModel : public NotificationObserver { // As above, a return value of -1 represents "show all actions". int GetVisibleIconCount() { return visible_icon_count_; } + bool extensions_initialized() const { return extensions_initialized_; } + size_t size() const { return toolitems_.size(); } @@ -88,6 +90,9 @@ class ExtensionToolbarModel : public NotificationObserver { PrefService* prefs_; + // True if we've handled the initial EXTENSIONS_READY notification. + bool extensions_initialized_; + // Ordered list of browser action buttons. ExtensionList toolitems_; diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc index d177fab..5870929 100644 --- a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc @@ -490,7 +490,7 @@ void BrowserActionsToolbarGtk::BrowserActionAdded(Extension* extension, CreateButtonForExtension(extension, index); // If we are still initializing the container, don't bother animating. - if (model_->size() != extension_button_map_.size()) + if (!model_->extensions_initialized()) return; // Animate the addition if we are showing all browser action buttons. diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc index ec57c82..d7d917d 100644 --- a/chrome/browser/views/browser_actions_container.cc +++ b/chrome/browser/views/browser_actions_container.cc @@ -944,7 +944,7 @@ void BrowserActionsContainer::BrowserActionAdded(Extension* extension, AddChildView(index, view); // If we are still initializing the container, don't bother animating. - if (model_->size() != browser_action_views_.size()) + if (!model_->extensions_initialized()) return; // For details on why we do the following see the class comments in the |