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

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

Issue 280013003: More implementation details of extension content verification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready for review 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 #if defined(OS_CHROMEOS) 72 #if defined(OS_CHROMEOS)
73 #include "chrome/browser/chromeos/extensions/install_limiter.h" 73 #include "chrome/browser/chromeos/extensions/install_limiter.h"
74 #include "webkit/browser/fileapi/file_system_backend.h" 74 #include "webkit/browser/fileapi/file_system_backend.h"
75 #include "webkit/browser/fileapi/file_system_context.h" 75 #include "webkit/browser/fileapi/file_system_context.h"
76 #endif 76 #endif
77 77
78 using content::BrowserContext; 78 using content::BrowserContext;
79 using content::BrowserThread; 79 using content::BrowserThread;
80 using content::DevToolsAgentHost; 80 using content::DevToolsAgentHost;
81 using extensions::ContentVerifierKey;
81 using extensions::CrxInstaller; 82 using extensions::CrxInstaller;
82 using extensions::Extension; 83 using extensions::Extension;
83 using extensions::ExtensionIdSet; 84 using extensions::ExtensionIdSet;
84 using extensions::ExtensionInfo; 85 using extensions::ExtensionInfo;
85 using extensions::ExtensionRegistry; 86 using extensions::ExtensionRegistry;
86 using extensions::ExtensionSet; 87 using extensions::ExtensionSet;
87 using extensions::FeatureSwitch; 88 using extensions::FeatureSwitch;
88 using extensions::InstallVerifier; 89 using extensions::InstallVerifier;
89 using extensions::ManagementPolicy; 90 using extensions::ManagementPolicy;
90 using extensions::Manifest; 91 using extensions::Manifest;
92 using extensions::ManifestURL;
91 using extensions::PermissionMessage; 93 using extensions::PermissionMessage;
92 using extensions::PermissionMessages; 94 using extensions::PermissionMessages;
93 using extensions::PermissionSet; 95 using extensions::PermissionSet;
94 using extensions::SharedModuleInfo; 96 using extensions::SharedModuleInfo;
95 using extensions::SharedModuleService; 97 using extensions::SharedModuleService;
96 using extensions::UnloadedExtensionInfo; 98 using extensions::UnloadedExtensionInfo;
97 99
98 namespace errors = extensions::manifest_errors; 100 namespace errors = extensions::manifest_errors;
99 101
100 namespace { 102 namespace {
(...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 continue; 2390 continue;
2389 } 2391 }
2390 greylist_.Insert(extension); 2392 greylist_.Insert(extension);
2391 extension_prefs_->SetExtensionBlacklistState(extension->id(), 2393 extension_prefs_->SetExtensionBlacklistState(extension->id(),
2392 state_map.find(*it)->second); 2394 state_map.find(*it)->second);
2393 if (registry_->enabled_extensions().Contains(extension->id())) 2395 if (registry_->enabled_extensions().Contains(extension->id()))
2394 DisableExtension(*it, extensions::Extension::DISABLE_GREYLIST); 2396 DisableExtension(*it, extensions::Extension::DISABLE_GREYLIST);
2395 } 2397 }
2396 } 2398 }
2397 2399
2398 void ExtensionService::ContentVerifyFailed(const std::string& extension_id) { 2400 bool ExtensionService::ShouldBeVerified(const Extension& extension) {
2401 return ((extension.is_extension() || extension.is_legacy_packaged_app()) &&
2402 ManifestURL::UpdatesFromGallery(&extension) &&
2403 Manifest::IsAutoUpdateableLocation(extension.location()));
2404 return false;
2405 }
2406
2407 const ContentVerifierKey& ExtensionService::PublicKey() {
2408 static ContentVerifierKey key(
2409 extension_misc::kWebstoreSignaturesPublicKey,
2410 extension_misc::kWebstoreSignaturesPublicKeySize);
2411 return key;
2412 }
2413
2414 GURL ExtensionService::GetSignatureFetchUrl(const std::string& extension_id,
2415 const base::Version& version) {
2416 return GURL();
2417 }
2418
2419 void ExtensionService::VerifyFailed(const std::string& extension_id) {
2399 DisableExtension(extension_id, Extension::DISABLE_CORRUPTED); 2420 DisableExtension(extension_id, Extension::DISABLE_CORRUPTED);
2400 } 2421 }
2401 2422
2402 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { 2423 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
2403 update_observers_.AddObserver(observer); 2424 update_observers_.AddObserver(observer);
2404 } 2425 }
2405 2426
2406 void ExtensionService::RemoveUpdateObserver( 2427 void ExtensionService::RemoveUpdateObserver(
2407 extensions::UpdateObserver* observer) { 2428 extensions::UpdateObserver* observer) {
2408 update_observers_.RemoveObserver(observer); 2429 update_observers_.RemoveObserver(observer);
2409 } 2430 }
2410 2431
2411 // Used only by test code. 2432 // Used only by test code.
2412 void ExtensionService::UnloadAllExtensionsInternal() { 2433 void ExtensionService::UnloadAllExtensionsInternal() {
2413 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); 2434 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions();
2414 2435
2415 registry_->ClearAll(); 2436 registry_->ClearAll();
2416 system_->runtime_data()->ClearAll(); 2437 system_->runtime_data()->ClearAll();
2417 2438
2418 // TODO(erikkay) should there be a notification for this? We can't use 2439 // TODO(erikkay) should there be a notification for this? We can't use
2419 // EXTENSION_UNLOADED since that implies that the extension has been disabled 2440 // EXTENSION_UNLOADED since that implies that the extension has been disabled
2420 // or uninstalled. 2441 // or uninstalled.
2421 } 2442 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698