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

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

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_toolbar_model.h" 5 #include "chrome/browser/extensions/extension_toolbar_model.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/histogram_base.h" 10 #include "base/metrics/histogram_base.h"
(...skipping 30 matching lines...) Expand all
41 41
42 ExtensionToolbarModel::ExtensionToolbarModel( 42 ExtensionToolbarModel::ExtensionToolbarModel(
43 Profile* profile, 43 Profile* profile,
44 extensions::ExtensionPrefs* extension_prefs) 44 extensions::ExtensionPrefs* extension_prefs)
45 : profile_(profile), 45 : profile_(profile),
46 extension_prefs_(extension_prefs), 46 extension_prefs_(extension_prefs),
47 prefs_(profile_->GetPrefs()), 47 prefs_(profile_->GetPrefs()),
48 extensions_initialized_(false), 48 extensions_initialized_(false),
49 is_highlighting_(false), 49 is_highlighting_(false),
50 weak_ptr_factory_(this) { 50 weak_ptr_factory_(this) {
51 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 51 registrar_.Add(this,
52 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
52 content::Source<Profile>(profile_)); 53 content::Source<Profile>(profile_));
53 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 54 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
54 content::Source<Profile>(profile_)); 55 content::Source<Profile>(profile_));
55 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, 56 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY,
56 content::Source<Profile>(profile_)); 57 content::Source<Profile>(profile_));
57 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 58 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
58 content::Source<Profile>(profile_)); 59 content::Source<Profile>(profile_));
59 registrar_.Add( 60 registrar_.Add(
60 this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, 61 this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED,
61 content::Source<extensions::ExtensionPrefs>(extension_prefs_)); 62 content::Source<extensions::ExtensionPrefs>(extension_prefs_));
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { 198 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) {
198 extension = content::Details<extensions::UnloadedExtensionInfo>( 199 extension = content::Details<extensions::UnloadedExtensionInfo>(
199 details)->extension; 200 details)->extension;
200 } else if (type == 201 } else if (type ==
201 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED) { 202 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED) {
202 extension = extension_service->GetExtensionById( 203 extension = extension_service->GetExtensionById(
203 *content::Details<const std::string>(details).ptr(), true); 204 *content::Details<const std::string>(details).ptr(), true);
204 } else { 205 } else {
205 extension = content::Details<const Extension>(details).ptr(); 206 extension = content::Details<const Extension>(details).ptr();
206 } 207 }
207 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { 208 if (type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED) {
208 // We don't want to add the same extension twice. It may have already been 209 // We don't want to add the same extension twice. It may have already been
209 // added by EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED below, if the user 210 // added by EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED below, if the user
210 // hides the browser action and then disables and enables the extension. 211 // hides the browser action and then disables and enables the extension.
211 for (size_t i = 0; i < toolbar_items_.size(); i++) { 212 for (size_t i = 0; i < toolbar_items_.size(); i++) {
212 if (toolbar_items_[i].get() == extension) 213 if (toolbar_items_[i].get() == extension)
213 return; // Already exists. 214 return; // Already exists.
214 } 215 }
215 if (ExtensionActionAPI::GetBrowserActionVisibility( 216 if (ExtensionActionAPI::GetBrowserActionVisibility(
216 extension_prefs_, extension->id())) { 217 extension_prefs_, extension->id())) {
217 AddExtension(extension); 218 AddExtension(extension);
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 is_highlighting_ = false; 585 is_highlighting_ = false;
585 if (old_visible_icon_count_ != visible_icon_count_) { 586 if (old_visible_icon_count_ != visible_icon_count_) {
586 SetVisibleIconCount(old_visible_icon_count_); 587 SetVisibleIconCount(old_visible_icon_count_);
587 FOR_EACH_OBSERVER(Observer, observers_, VisibleCountChanged()); 588 FOR_EACH_OBSERVER(Observer, observers_, VisibleCountChanged());
588 } 589 }
589 FOR_EACH_OBSERVER(Observer, observers_, HighlightModeChanged(false)); 590 FOR_EACH_OBSERVER(Observer, observers_, HighlightModeChanged(false));
590 } 591 }
591 }; 592 };
592 593
593 } // namespace extensions 594 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698