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

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

Issue 345693002: Extensions: Split extensions utility IPC messages into its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index ee810bfcd62dd2271a6cab07763deed1856111c7..fce9e82609f8fe28be097c8ed08380386357ecca 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -20,7 +20,6 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/component_loader.h"
-#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/data_deleter.h"
#include "chrome/browser/extensions/extension_assets_manager.h"
#include "chrome/browser/extensions/extension_disabled_ui.h"
@@ -29,7 +28,6 @@
#include "chrome/browser/extensions/extension_special_storage_policy.h"
#include "chrome/browser/extensions/extension_sync_service.h"
#include "chrome/browser/extensions/extension_util.h"
-#include "chrome/browser/extensions/external_install_ui.h"
#include "chrome/browser/extensions/external_provider_impl.h"
#include "chrome/browser/extensions/install_verifier.h"
#include "chrome/browser/extensions/installed_loader.h"
@@ -38,7 +36,6 @@
#include "chrome/browser/extensions/shared_module_service.h"
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/browser/extensions/updater/extension_cache.h"
-#include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/browser/ui/webui/favicon_source.h"
@@ -80,6 +77,14 @@
#include "webkit/browser/fileapi/file_system_context.h"
#endif
+// TODO(thestig) Eventually remove the #ifdefs when ExtensionService is no
+// longer used on mobile.
+#if defined(ENABLE_EXTENSIONS)
+#include "chrome/browser/extensions/crx_installer.h"
+#include "chrome/browser/extensions/external_install_ui.h"
+#include "chrome/browser/extensions/updater/extension_updater.h"
+#endif
+
using content::BrowserContext;
using content::BrowserThread;
using content::DevToolsAgentHost;
@@ -319,6 +324,7 @@ ExtensionService::ExtensionService(Profile* profile,
callback);
pref_change_registrar_.Add(extensions::pref_names::kAllowedTypes, callback);
+#if defined(ENABLE_EXTENSIONS)
// Set up the ExtensionUpdater
if (autoupdate_enabled) {
int update_frequency = extensions::kDefaultUpdateFrequencySeconds;
@@ -335,6 +341,7 @@ ExtensionService::ExtensionService(Profile* profile,
update_frequency,
extensions::ExtensionCache::GetInstance()));
}
+#endif
component_loader_.reset(
new extensions::ComponentLoader(this,
@@ -508,6 +515,7 @@ bool ExtensionService::UpdateExtension(const std::string& id,
bool file_ownership_passed,
CrxInstaller** out_crx_installer) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+#if defined(ENABLE_EXTENSIONS)
if (browser_terminating_) {
LOG(WARNING) << "Skipping UpdateExtension due to browser shutdown";
// Leak the temp file at extension_path. We don't want to add to the disk
@@ -596,6 +604,9 @@ bool ExtensionService::UpdateExtension(const std::string& id,
*out_crx_installer = installer.get();
return true;
+#else
+ return false;
+#endif
}
void ExtensionService::ReloadExtension(
@@ -1177,6 +1188,7 @@ void ExtensionService::CheckManagementPolicy() {
}
void ExtensionService::CheckForUpdatesSoon() {
+#if defined(ENABLE_EXTENSIONS)
// This can legitimately happen in unit tests.
if (!updater_.get())
return;
@@ -1189,6 +1201,7 @@ void ExtensionService::CheckForUpdatesSoon() {
// but not before.
update_once_all_providers_are_ready_ = true;
}
+#endif
}
// Some extensions will autoupdate themselves externally from Chrome. These
@@ -1246,6 +1259,7 @@ bool ExtensionService::AreAllExternalProvidersReady() const {
void ExtensionService::OnAllExternalProvidersReady() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+#if defined(ENABLE_EXTENSIONS)
base::TimeDelta elapsed = base::Time::Now() - profile_->GetStartTime();
UMA_HISTOGRAM_TIMES("Extension.ExternalProvidersReadyAfter", elapsed);
@@ -1269,6 +1283,7 @@ void ExtensionService::OnAllExternalProvidersReady() {
error_controller_->ShowErrorIfNeeded();
UpdateExternalExtensionAlert();
+#endif
}
void ExtensionService::AcknowledgeExternalExtension(const std::string& id) {
@@ -1332,6 +1347,7 @@ void ExtensionService::ReconcileKnownDisabled() {
}
void ExtensionService::UpdateExternalExtensionAlert() {
+#if defined(ENABLE_EXTENSIONS)
if (!FeatureSwitch::prompt_for_external_extensions()->IsEnabled())
return;
@@ -1381,6 +1397,7 @@ void ExtensionService::UpdateExternalExtensionAlert() {
} else {
extensions::RemoveExternalInstallError(this);
}
+#endif // defined(ENABLE_EXTENSIONS)
}
void ExtensionService::UnloadExtension(
@@ -1465,10 +1482,12 @@ void ExtensionService::SetReadyAndNotifyListeners() {
}
void ExtensionService::OnLoadedInstalledExtensions() {
+#if defined(ENABLE_EXTENSIONS)
if (updater_)
updater_->Start();
OnBlacklistUpdated();
+#endif
}
void ExtensionService::AddExtension(const Extension* extension) {
@@ -2078,6 +2097,7 @@ bool ExtensionService::OnExternalExtensionFileFound(
int creation_flags,
bool mark_acknowledged) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+#if defined(ENABLE_EXTENSIONS)
CHECK(Extension::IdIsValid(id));
if (extension_prefs_->IsExternalExtensionUninstalled(id))
return false;
@@ -2141,6 +2161,9 @@ bool ExtensionService::OnExternalExtensionFileFound(
AcknowledgeExternalExtension(id);
return true;
+#else
+ return false;
+#endif // defined(ENABLE_EXTENSIONS)
}
void ExtensionService::DidCreateRenderViewForBackgroundPage(

Powered by Google App Engine
This is Rietveld 408576698