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

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

Issue 15947007: Move application restart and relaunch code out of ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pafooey Created 7 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
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/extension_system.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index f1cb6c0fca5eb92a9142da64f0add913356c6922..e3ac3d37d34bde8a1d150d823035a2ed684500d5 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -686,17 +686,6 @@ bool ExtensionService::UpdateExtension(const std::string& id,
}
void ExtensionService::ReloadExtension(const std::string& extension_id) {
- int events = HasShellWindows(extension_id) ? EVENT_LAUNCHED : EVENT_NONE;
- ReloadExtensionWithEvents(extension_id, events);
-}
-
-void ExtensionService::RestartExtension(const std::string& extension_id) {
- ReloadExtensionWithEvents(extension_id, EVENT_RESTARTED);
-}
-
-void ExtensionService::ReloadExtensionWithEvents(
- const std::string& extension_id,
- int events) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// If the extension is already reloading, don't reload again.
@@ -732,8 +721,6 @@ void ExtensionService::ReloadExtensionWithEvents(
path = unloaded_extension_paths_[extension_id];
}
- on_load_events_[extension_id] = events;
-
if (delayed_updates_for_idle_.Contains(extension_id)) {
FinishDelayedInstallation(extension_id);
return;
@@ -2096,7 +2083,6 @@ void ExtensionService::AddExtension(const Extension* extension) {
// Replace the old extension with the new version.
CHECK(!disabled_extensions_.Insert(extension));
EnableExtension(extension->id());
- DoPostLoadTasks(extension);
} else {
// All apps that are displayed in the launcher are ordered by their ordinals
// so we must ensure they have valid ordinals.
@@ -2112,7 +2098,6 @@ void ExtensionService::AddExtension(const Extension* extension) {
extensions_.Insert(extension);
SyncExtensionChangeIfNeeded(*extension);
NotifyExtensionLoaded(extension);
- DoPostLoadTasks(extension);
}
SetBeingUpgraded(extension, false);
}
@@ -2275,10 +2260,6 @@ void ExtensionService::UpdateActiveExtensionsInCrashReporter() {
child_process_logging::SetActiveExtensions(extension_ids);
}
-void ExtensionService::ScheduleLaunchOnLoad(const std::string& extension_id) {
- on_load_events_[extension_id] = EVENT_LAUNCHED;
-}
-
void ExtensionService::OnExtensionInstalled(
const Extension* extension,
const syncer::StringOrdinal& page_ordinal,
@@ -2890,60 +2871,6 @@ ExtensionService::NaClModuleInfoList::iterator
return nacl_module_list_.end();
}
-void ExtensionService::DoPostLoadTasks(const Extension* extension) {
- std::map<std::string, int>::iterator it =
- on_load_events_.find(extension->id());
- if (it == on_load_events_.end())
- return;
-
- int events_to_fire = it->second;
- extensions::LazyBackgroundTaskQueue* queue =
- system_->lazy_background_task_queue();
- if (queue->ShouldEnqueueTask(profile(), extension)) {
- if (events_to_fire & EVENT_LAUNCHED)
- queue->AddPendingTask(profile(), extension->id(),
- base::Bind(&ExtensionService::LaunchApplication));
- if (events_to_fire & EVENT_RESTARTED) {
- queue->AddPendingTask(profile(), extension->id(),
- base::Bind(&ExtensionService::RestartApplication));
- }
- }
-
- on_load_events_.erase(it);
-}
-
-// static
-void ExtensionService::LaunchApplication(
- extensions::ExtensionHost* extension_host) {
- if (!extension_host)
- return;
-
-#if !defined(OS_ANDROID)
- extensions::LaunchPlatformApp(extension_host->profile(),
- extension_host->extension(),
- NULL, base::FilePath());
-#endif
-}
-
-// static
-void ExtensionService::RestartApplication(
- extensions::ExtensionHost* extension_host) {
- if (!extension_host)
- return;
-
-#if !defined(OS_ANDROID)
- extensions::RestartPlatformApp(
- extension_host->profile(), extension_host->extension());
-#endif
-}
-
-bool ExtensionService::HasShellWindows(const std::string& extension_id) {
- const Extension* current_extension = GetExtensionById(extension_id, false);
- return current_extension && current_extension->is_platform_app() &&
- !extensions::ShellWindowRegistry::Get(profile_)->
- GetShellWindowsForApp(extension_id).empty();
-}
-
void ExtensionService::InspectExtensionHost(
extensions::ExtensionHost* host) {
if (host)
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/extension_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698