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

Side by Side Diff: extensions/browser/extension_registry.cc

Issue 289073008: Add TriggerOnUninstalled to ExtensionRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comment Created 6 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/browser/extension_registry.h" 5 #include "extensions/browser/extension_registry.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "extensions/browser/extension_registry_factory.h" 8 #include "extensions/browser/extension_registry_factory.h"
9 #include "extensions/browser/extension_registry_observer.h" 9 #include "extensions/browser/extension_registry_observer.h"
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 const std::string& old_name) { 58 const std::string& old_name) {
59 DCHECK(is_update == 59 DCHECK(is_update ==
60 GenerateInstalledExtensionsSet()->Contains(extension->id())); 60 GenerateInstalledExtensionsSet()->Contains(extension->id()));
61 DCHECK(is_update == !old_name.empty()); 61 DCHECK(is_update == !old_name.empty());
62 FOR_EACH_OBSERVER(ExtensionRegistryObserver, 62 FOR_EACH_OBSERVER(ExtensionRegistryObserver,
63 observers_, 63 observers_,
64 OnExtensionWillBeInstalled( 64 OnExtensionWillBeInstalled(
65 browser_context_, extension, is_update, old_name)); 65 browser_context_, extension, is_update, old_name));
66 } 66 }
67 67
68 void ExtensionRegistry::TriggerOnUninstalled(const Extension* extension) {
69 DCHECK(!GenerateInstalledExtensionsSet()->Contains(extension->id()));
70 FOR_EACH_OBSERVER(ExtensionRegistryObserver,
71 observers_,
72 OnExtensionUninstalled(browser_context_, extension));
73 }
74
68 const Extension* ExtensionRegistry::GetExtensionById(const std::string& id, 75 const Extension* ExtensionRegistry::GetExtensionById(const std::string& id,
69 int include_mask) const { 76 int include_mask) const {
70 std::string lowercase_id = StringToLowerASCII(id); 77 std::string lowercase_id = StringToLowerASCII(id);
71 if (include_mask & ENABLED) { 78 if (include_mask & ENABLED) {
72 const Extension* extension = enabled_extensions_.GetByID(lowercase_id); 79 const Extension* extension = enabled_extensions_.GetByID(lowercase_id);
73 if (extension) 80 if (extension)
74 return extension; 81 return extension;
75 } 82 }
76 if (include_mask & DISABLED) { 83 if (include_mask & DISABLED) {
77 const Extension* extension = disabled_extensions_.GetByID(lowercase_id); 84 const Extension* extension = disabled_extensions_.GetByID(lowercase_id);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 const ExtensionSet::ModificationCallback& callback) { 145 const ExtensionSet::ModificationCallback& callback) {
139 disabled_extensions_.set_modification_callback(callback); 146 disabled_extensions_.set_modification_callback(callback);
140 } 147 }
141 148
142 void ExtensionRegistry::Shutdown() { 149 void ExtensionRegistry::Shutdown() {
143 // Release references to all Extension objects in the sets. 150 // Release references to all Extension objects in the sets.
144 ClearAll(); 151 ClearAll();
145 } 152 }
146 153
147 } // namespace extensions 154 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_registry.h ('k') | extensions/browser/extension_registry_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698