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

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

Issue 1890163004: extensions: Abstract out install delay strategy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for comments in #4 Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/shared_module_service.h" 5 #include "chrome/browser/extensions/shared_module_service.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ++iter) { 127 ++iter) {
128 if (SharedModuleInfo::ImportsExtensionById(iter->get(), 128 if (SharedModuleInfo::ImportsExtensionById(iter->get(),
129 extension->id())) { 129 extension->id())) {
130 dependents->Insert(*iter); 130 dependents->Insert(*iter);
131 } 131 }
132 } 132 }
133 } 133 }
134 return dependents; 134 return dependents;
135 } 135 }
136 136
137 InstallGate::Action SharedModuleService::ShouldDelay(const Extension* extension,
138 bool install_immediately) {
139 ImportStatus status = SatisfyImports(extension);
140 switch (status) {
141 case IMPORT_STATUS_OK:
142 return INSTALL;
143 case IMPORT_STATUS_UNSATISFIED:
144 return DELAY;
145 case IMPORT_STATUS_UNRECOVERABLE:
146 return ABORT;
147 }
148
149 NOTREACHED();
150 return INSTALL;
151 }
152
137 void SharedModuleService::PruneSharedModules() { 153 void SharedModuleService::PruneSharedModules() {
138 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); 154 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_);
139 ExtensionService* service = 155 ExtensionService* service =
140 ExtensionSystem::Get(browser_context_)->extension_service(); 156 ExtensionSystem::Get(browser_context_)->extension_service();
141 157
142 ExtensionSet set_to_check; 158 ExtensionSet set_to_check;
143 set_to_check.InsertAll(registry->enabled_extensions()); 159 set_to_check.InsertAll(registry->enabled_extensions());
144 set_to_check.InsertAll(registry->disabled_extensions()); 160 set_to_check.InsertAll(registry->disabled_extensions());
145 set_to_check.InsertAll(*service->delayed_installs()); 161 set_to_check.InsertAll(*service->delayed_installs());
146 162
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 extensions::UninstallReason reason) { 205 extensions::UninstallReason reason) {
190 // Do not call PruneSharedModules() for an uninstall that we were responsible 206 // Do not call PruneSharedModules() for an uninstall that we were responsible
191 // for. 207 // for.
192 if (reason == extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE) 208 if (reason == extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE)
193 return; 209 return;
194 210
195 PruneSharedModules(); 211 PruneSharedModules();
196 } 212 }
197 213
198 } // namespace extensions 214 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/shared_module_service.h ('k') | chrome/browser/extensions/update_install_gate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698