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

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

Issue 1087713002: [Reland] [Extensions] Make extension message bubble factory platform-abstract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finnur's Created 5 years, 8 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.cc
diff --git a/chrome/browser/extensions/extension_toolbar_model.cc b/chrome/browser/extensions/extension_toolbar_model.cc
index a0ee22a3d98f8f8ab7fa865954f192a5e0a09a23..5a61ea6dc293d40264a38ff95711586dfb2c3e2d 100644
--- a/chrome/browser/extensions/extension_toolbar_model.cc
+++ b/chrome/browser/extensions/extension_toolbar_model.cc
@@ -717,10 +717,13 @@ bool ExtensionToolbarModel::HighlightExtensions(
// mode.
if (highlighted_items_.size()) {
old_visible_icon_count_ = visible_icon_count_;
- is_highlighting_ = true;
if (visible_icon_count() < extension_ids.size())
SetVisibleIconCount(extension_ids.size());
+ // It's important that is_highlighting_ is changed right immediately before
+ // the observers are notified since it changes the result of
+ // toolbar_items().
+ is_highlighting_ = true;
FOR_EACH_OBSERVER(Observer, observers_,
OnToolbarHighlightModeChanged(true));
return true;
@@ -736,9 +739,13 @@ bool ExtensionToolbarModel::HighlightExtensions(
void ExtensionToolbarModel::StopHighlighting() {
if (is_highlighting_) {
highlighted_items_.clear();
- is_highlighting_ = false;
if (old_visible_icon_count_ != visible_icon_count_)
SetVisibleIconCount(old_visible_icon_count_);
+
+ // It's important that is_highlighting_ is changed right immediately before
+ // the observers are notified since it changes the result of
+ // toolbar_items().
+ is_highlighting_ = false;
FOR_EACH_OBSERVER(Observer, observers_,
OnToolbarHighlightModeChanged(false));
}

Powered by Google App Engine
This is Rietveld 408576698