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

Unified Diff: chrome/browser/extensions/extension_system_impl.cc

Issue 266963003: Beginning of support for extension content verification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops, forgot to upload minor cosmetic changes to test 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_system_impl.cc
diff --git a/chrome/browser/extensions/extension_system_impl.cc b/chrome/browser/extensions/extension_system_impl.cc
index 2e4d29376b636ca0d912b43bb02238f0f7fd63f8..8f814a4bffcfa976766a435d2312c4616e1ca885 100644
--- a/chrome/browser/extensions/extension_system_impl.cc
+++ b/chrome/browser/extensions/extension_system_impl.cc
@@ -32,6 +32,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/extensions/features/feature_channel.h"
+#include "chrome/common/extensions/manifest_url_handler.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/url_data_source.h"
#include "extensions/browser/event_router.h"
@@ -137,6 +138,12 @@ void ExtensionSystemImpl::Shared::RegisterManagementPolicyProviders() {
#endif // defined(ENABLE_EXTENSIONS)
}
+static bool VerifyExtensionContentFilter(const Extension* extension) {
Yoyo Zhou 2014/05/07 02:25:59 I'd find this clearer with a name like ShouldVerif
asargent_no_longer_on_chrome 2014/05/07 06:56:42 Good suggestion, done.
+ return ((extension->is_extension() || extension->is_legacy_packaged_app()) &&
+ ManifestURL::UpdatesFromGallery(extension) &&
+ Manifest::IsAutoUpdateableLocation(extension->location()));
+}
+
void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
@@ -171,6 +178,11 @@ void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) {
install_verifier_.reset(
new InstallVerifier(ExtensionPrefs::Get(profile_), profile_));
install_verifier_->Init();
+ ContentVerifierFilter filter = base::Bind(&VerifyExtensionContentFilter);
+ content_verifier_ = new ContentVerifier(profile_, filter);
+ content_verifier_->AddObserver(this);
+ content_verifier_->Start();
+ info_map()->SetContentVerifier(content_verifier_.get());
management_policy_.reset(new ManagementPolicy);
RegisterManagementPolicyProviders();
@@ -243,10 +255,18 @@ void ExtensionSystemImpl::Shared::Shutdown() {
extension_warning_service_->RemoveObserver(
extension_warning_badge_service_.get());
}
+ content_verifier_->RemoveObserver(this);
+ content_verifier_->Shutdown();
if (extension_service_)
extension_service_->Shutdown();
}
+void ExtensionSystemImpl::Shared::ContentVerifyFailed(
Yoyo Zhou 2014/05/07 02:25:59 Should ExtensionService be the observer instead?
asargent_no_longer_on_chrome 2014/05/07 06:56:42 Yeah, I think I like that better. Done.
+ const std::string& extension_id) {
+ extension_service_->DisableExtension(extension_id,
+ Extension::DISABLE_CORRUPTED);
+}
+
StateStore* ExtensionSystemImpl::Shared::state_store() {
return state_store_.get();
}
@@ -306,6 +326,10 @@ QuotaService* ExtensionSystemImpl::Shared::quota_service() {
return quota_service_.get();
}
+ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() {
+ return content_verifier_.get();
+}
+
//
// ExtensionSystemImpl
//
@@ -403,6 +427,10 @@ QuotaService* ExtensionSystemImpl::quota_service() {
return shared_->quota_service();
}
+ContentVerifier* ExtensionSystemImpl::content_verifier() {
+ return shared_->content_verifier();
+}
+
void ExtensionSystemImpl::RegisterExtensionWithRequestContexts(
const Extension* extension) {
base::Time install_time;

Powered by Google App Engine
This is Rietveld 408576698