#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"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/browser/profiles/profile.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/notification_types.h"
#include "extensions/common/extension.h"
using extensions::Extension;
AppLoadService::AppLoadService(Profile* profile)
: profile_(profile) {
- registrar_.Add(
- this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
- content::NotificationService::AllSources());
- registrar_.Add(
- this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
- content::NotificationService::AllSources());
+ registrar_.Add(this,
+ extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
+ content::NotificationService::AllSources());
+ registrar_.Add(this,
+ extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
+ content::NotificationService::AllSources());
}
AppLoadService::~AppLoadService() {}
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) {
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: {
+ case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: {
extensions::ExtensionHost* host =
content::Details<extensions::ExtensionHost>(details).ptr();
const Extension* extension = host->extension();
post_reload_actions_.erase(it);
break;
}
- case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
+ case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
const extensions::UnloadedExtensionInfo* unload_info =
content::Details<extensions::UnloadedExtensionInfo>(details).ptr();
if (!unload_info->extension->is_platform_app())