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)); |
} |