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

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

Issue 297263003: Optimize promotion of ephemeral apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments and added more tests Created 6 years, 6 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const Extension* extension, 48 const Extension* extension,
49 UnloadedExtensionInfo::Reason reason) { 49 UnloadedExtensionInfo::Reason reason) {
50 DCHECK(!enabled_extensions_.Contains(extension->id())); 50 DCHECK(!enabled_extensions_.Contains(extension->id()));
51 FOR_EACH_OBSERVER(ExtensionRegistryObserver, 51 FOR_EACH_OBSERVER(ExtensionRegistryObserver,
52 observers_, 52 observers_,
53 OnExtensionUnloaded(browser_context_, extension, reason)); 53 OnExtensionUnloaded(browser_context_, extension, reason));
54 } 54 }
55 55
56 void ExtensionRegistry::TriggerOnWillBeInstalled(const Extension* extension, 56 void ExtensionRegistry::TriggerOnWillBeInstalled(const Extension* extension,
57 bool is_update, 57 bool is_update,
58 bool from_ephemeral,
58 const std::string& old_name) { 59 const std::string& old_name) {
59 DCHECK(is_update == 60 DCHECK(is_update ==
60 GenerateInstalledExtensionsSet()->Contains(extension->id())); 61 GenerateInstalledExtensionsSet()->Contains(extension->id()));
61 DCHECK(is_update == !old_name.empty()); 62 DCHECK(is_update == !old_name.empty());
62 FOR_EACH_OBSERVER(ExtensionRegistryObserver, 63 FOR_EACH_OBSERVER(
63 observers_, 64 ExtensionRegistryObserver,
64 OnExtensionWillBeInstalled( 65 observers_,
65 browser_context_, extension, is_update, old_name)); 66 OnExtensionWillBeInstalled(
67 browser_context_, extension, is_update, from_ephemeral, old_name));
66 } 68 }
67 69
68 void ExtensionRegistry::TriggerOnUninstalled(const Extension* extension) { 70 void ExtensionRegistry::TriggerOnUninstalled(const Extension* extension) {
69 DCHECK(!GenerateInstalledExtensionsSet()->Contains(extension->id())); 71 DCHECK(!GenerateInstalledExtensionsSet()->Contains(extension->id()));
70 FOR_EACH_OBSERVER(ExtensionRegistryObserver, 72 FOR_EACH_OBSERVER(ExtensionRegistryObserver,
71 observers_, 73 observers_,
72 OnExtensionUninstalled(browser_context_, extension)); 74 OnExtensionUninstalled(browser_context_, extension));
73 } 75 }
74 76
75 const Extension* ExtensionRegistry::GetExtensionById(const std::string& id, 77 const Extension* ExtensionRegistry::GetExtensionById(const std::string& id,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 const ExtensionSet::ModificationCallback& callback) { 147 const ExtensionSet::ModificationCallback& callback) {
146 disabled_extensions_.set_modification_callback(callback); 148 disabled_extensions_.set_modification_callback(callback);
147 } 149 }
148 150
149 void ExtensionRegistry::Shutdown() { 151 void ExtensionRegistry::Shutdown() {
150 // Release references to all Extension objects in the sets. 152 // Release references to all Extension objects in the sets.
151 ClearAll(); 153 ClearAll();
152 } 154 }
153 155
154 } // namespace extensions 156 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698