diff options
5 files changed, 15 insertions, 15 deletions
diff --git a/apps/app_load_service.cc b/apps/app_load_service.cc index 8d816f5..8378c41 100644 --- a/apps/app_load_service.cc +++ b/apps/app_load_service.cc @@ -5,6 +5,7 @@ #include "apps/app_load_service.h" #include "apps/app_load_service_factory.h" +#include "apps/app_restore_service.h" #include "apps/app_window_registry.h" #include "apps/launcher.h" #include "chrome/browser/chrome_notification_types.h" @@ -50,6 +51,12 @@ void AppLoadService::RestartApplication(const std::string& extension_id) { service->ReloadExtension(extension_id); } +void AppLoadService::RestartApplicationIfRunning( + const std::string& extension_id) { + if (apps::AppRestoreService::Get(profile_)->IsAppRestorable(extension_id)) + RestartApplication(extension_id); +} + bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path, const CommandLine& command_line, const base::FilePath& current_dir) { diff --git a/apps/app_load_service.h b/apps/app_load_service.h index c79915d..1f49980 100644 --- a/apps/app_load_service.h +++ b/apps/app_load_service.h @@ -48,6 +48,9 @@ class AppLoadService : public KeyedService, // event. void RestartApplication(const std::string& extension_id); + // Reload the application with the given id if it is currently running. + void RestartApplicationIfRunning(const std::string& extension_id); + // Loads (or reloads) the app with |extension_path|, then launches it. Any // command line parameters from |command_line| will be passed along via // launch parameters. Returns true if loading the extension has begun diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index 3229315..af8accd 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc @@ -5,7 +5,6 @@ #include "chrome/browser/extensions/api/developer_private/developer_private_api.h" #include "apps/app_load_service.h" -#include "apps/app_restore_service.h" #include "apps/app_window.h" #include "apps/app_window_registry.h" #include "apps/saved_files_service.h" @@ -774,8 +773,8 @@ void DeveloperPrivateShowPermissionsDialogFunction::InstallUIProceed() { const Extension* extension = ExtensionRegistry::Get( profile)->GetExtensionById(extension_id_, ExtensionRegistry::EVERYTHING); apps::SavedFilesService::Get(profile)->ClearQueue(extension); - if (apps::AppRestoreService::Get(profile)->IsAppRestorable(extension_id_)) - apps::AppLoadService::Get(profile)->RestartApplication(extension_id_); + apps::AppLoadService::Get(profile) + ->RestartApplicationIfRunning(extension_id_); SendResponse(true); Release(); } diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc index f6eddec..08c8c5a 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc @@ -8,7 +8,6 @@ #include <vector> #include "apps/app_load_service.h" -#include "apps/app_restore_service.h" #include "apps/saved_files_service.h" #include "base/files/file_path.h" #include "extensions/common/extension.h" @@ -210,11 +209,7 @@ AppInfoPermissionsPanel::GetRetainedFilePaths() const { void AppInfoPermissionsPanel::RevokeFilePermissions() { apps::SavedFilesService::Get(profile_)->ClearQueue(app_); - - // TODO(benwells): Fix this to call something like - // AppLoadService::RestartApplicationIfRunning. - if (apps::AppRestoreService::Get(profile_)->IsAppRestorable(app_->id())) - apps::AppLoadService::Get(profile_)->RestartApplication(app_->id()); + apps::AppLoadService::Get(profile_)->RestartApplicationIfRunning(app_->id()); GetWidget()->Close(); } diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index 9d99cbb..735dc6f 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -5,7 +5,6 @@ #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" #include "apps/app_load_service.h" -#include "apps/app_restore_service.h" #include "apps/app_window.h" #include "apps/app_window_registry.h" #include "apps/saved_files_service.h" @@ -780,11 +779,8 @@ void ExtensionSettingsHandler::InstallUIProceed() { Profile* profile = Profile::FromWebUI(web_ui()); apps::SavedFilesService::Get(profile)->ClearQueue( extension_service_->GetExtensionById(extension_id_prompting_, true)); - if (apps::AppRestoreService::Get(profile)-> - IsAppRestorable(extension_id_prompting_)) { - apps::AppLoadService::Get(profile)->RestartApplication( - extension_id_prompting_); - } + apps::AppLoadService::Get(profile) + ->RestartApplicationIfRunning(extension_id_prompting_); extension_id_prompting_.clear(); } |