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

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

Issue 263703002: Allow shared modules to whitelist extensions that import them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback 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 | Annotate | Revision Log
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 <vector> 7 #include <vector>
8 8
9 #include "base/version.h" 9 #include "base/version.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 ExtensionRegistry::EVERYTHING); 55 ExtensionRegistry::EVERYTHING);
56 if (!imported_module) { 56 if (!imported_module) {
57 if (extension->from_webstore()) { 57 if (extension->from_webstore()) {
58 status = IMPORT_STATUS_UNSATISFIED; 58 status = IMPORT_STATUS_UNSATISFIED;
59 missing_modules->push_back(*iter); 59 missing_modules->push_back(*iter);
60 } else { 60 } else {
61 return IMPORT_STATUS_UNRECOVERABLE; 61 return IMPORT_STATUS_UNRECOVERABLE;
62 } 62 }
63 } else if (!SharedModuleInfo::IsSharedModule(imported_module)) { 63 } else if (!SharedModuleInfo::IsSharedModule(imported_module)) {
64 return IMPORT_STATUS_UNRECOVERABLE; 64 return IMPORT_STATUS_UNRECOVERABLE;
65 } else if (!SharedModuleInfo::IsExportAllowedByWhitelist(imported_module,
66 extension->id())) {
67 return IMPORT_STATUS_UNRECOVERABLE;
65 } else if (version_required.IsValid() && 68 } else if (version_required.IsValid() &&
66 imported_module->version()->CompareTo(version_required) < 0) { 69 imported_module->version()->CompareTo(version_required) < 0) {
67 if (imported_module->from_webstore()) { 70 if (imported_module->from_webstore()) {
68 outdated_modules->push_back(*iter); 71 outdated_modules->push_back(*iter);
69 status = IMPORT_STATUS_UNSATISFIED; 72 status = IMPORT_STATUS_UNSATISFIED;
70 } else { 73 } else {
71 return IMPORT_STATUS_UNRECOVERABLE; 74 return IMPORT_STATUS_UNRECOVERABLE;
72 } 75 }
73 } 76 }
74 } 77 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 void SharedModuleService::OnExtensionUninstalled(const Extension* extension) { 164 void SharedModuleService::OnExtensionUninstalled(const Extension* extension) {
162 PruneSharedModulesOnUninstall(extension); 165 PruneSharedModulesOnUninstall(extension);
163 } 166 }
164 167
165 void SharedModuleService::OnShutdown() { 168 void SharedModuleService::OnShutdown() {
166 InstallTracker::Get(context_)->RemoveObserver(this); 169 InstallTracker::Get(context_)->RemoveObserver(this);
167 observing_ = false; 170 observing_ = false;
168 } 171 }
169 172
170 } // namespace extensions 173 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/shared_module_apitest.cc ('k') | chrome/browser/extensions/shared_module_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698