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

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

Issue 4132005: Kill Extension::RuntimeData and move its guts to ExtensionsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops Created 10 years, 2 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
« no previous file with comments | « chrome/browser/extensions/extensions_service.h ('k') | chrome/browser/views/browser_actions_container.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extensions_service.cc
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index f97ea92ecc458d841c79c76bca8d13126dd2156b..25bace0ac47d82c57a9c3d94b2c19855dd122511 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -150,6 +150,15 @@ PendingExtensionInfo::PendingExtensionInfo()
enable_incognito_on_install(false),
install_source(Extension::INVALID) {}
+
+ExtensionsService::ExtensionRuntimeData::ExtensionRuntimeData()
+ : background_page_ready(false),
+ being_upgraded(false) {
+}
+
+ExtensionsService::ExtensionRuntimeData::~ExtensionRuntimeData() {
+}
+
// ExtensionsService.
const char* ExtensionsService::kInstallDirectoryName = "Extensions";
@@ -1327,6 +1336,9 @@ void ExtensionsService::UnloadExtension(const std::string& extension_id) {
// Clean up if the extension is meant to be enabled after a reload.
disabled_extension_paths_.erase(extension->id());
+ // Clean up runtime data.
+ extension_runtime_data_.erase(extension_id);
+
ExtensionDOMUI::UnregisterChromeURLOverrides(profile_,
extension->GetChromeURLOverrides());
@@ -1354,6 +1366,7 @@ void ExtensionsService::UnloadExtension(const std::string& extension_id) {
void ExtensionsService::UnloadAllExtensions() {
extensions_.clear();
disabled_extensions_.clear();
+ extension_runtime_data_.clear();
// TODO(erikkay) should there be a notification for this? We can't use
// EXTENSION_UNLOADED since that implies that the extension has been disabled
@@ -1426,8 +1439,8 @@ void ExtensionsService::OnExtensionLoaded(const Extension* extension,
// Extensions get upgraded if silent upgrades are allowed, otherwise
// they get disabled.
if (allow_silent_upgrade) {
- old->set_being_upgraded(true);
- extension->set_being_upgraded(true);
+ SetBeingUpgraded(old, true);
+ SetBeingUpgraded(extension, true);
}
// To upgrade an extension in place, unload the old one and
@@ -1465,7 +1478,7 @@ void ExtensionsService::OnExtensionLoaded(const Extension* extension,
}
}
- extension->set_being_upgraded(false);
+ SetBeingUpgraded(extension, false);
UpdateActiveExtensionsInCrashReporter();
@@ -1841,3 +1854,26 @@ ExtensionIdSet ExtensionsService::GetAppIds() const {
return result;
}
+
+bool ExtensionsService::IsBackgroundPageReady(const Extension* extension) {
+ return (extension->background_url().is_empty() ||
+ extension_runtime_data_[extension->id()].background_page_ready);
+}
+
+void ExtensionsService::SetBackgroundPageReady(const Extension* extension) {
+ DCHECK(!extension->background_url().is_empty());
+ extension_runtime_data_[extension->id()].background_page_ready = true;
+ NotificationService::current()->Notify(
+ NotificationType::EXTENSION_BACKGROUND_PAGE_READY,
+ Source<const Extension>(extension),
+ NotificationService::NoDetails());
+}
+
+bool ExtensionsService::IsBeingUpgraded(const Extension* extension) {
+ return extension_runtime_data_[extension->id()].being_upgraded;
+}
+
+void ExtensionsService::SetBeingUpgraded(const Extension* extension,
+ bool value) {
+ extension_runtime_data_[extension->id()].being_upgraded = value;
+}
« no previous file with comments | « chrome/browser/extensions/extensions_service.h ('k') | chrome/browser/views/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698