Index: apps/shell/browser/shell_extension_system.cc |
diff --git a/apps/shell/browser/shell_extension_system.cc b/apps/shell/browser/shell_extension_system.cc |
index 7d56884fcf6bc3e02b7a49a93d104952acbc857e..11dfbc67ab7030695b7f7cc8b4723d636a5f29bc 100644 |
--- a/apps/shell/browser/shell_extension_system.cc |
+++ b/apps/shell/browser/shell_extension_system.cc |
@@ -37,21 +37,21 @@ ShellExtensionSystem::ShellExtensionSystem(BrowserContext* browser_context) |
ShellExtensionSystem::~ShellExtensionSystem() { |
} |
-bool ShellExtensionSystem::LoadAndLaunchApp(const base::FilePath& app_dir) { |
+bool ShellExtensionSystem::LoadApp(const base::FilePath& app_dir) { |
// app_shell only supports unpacked extensions. |
// NOTE: If you add packed extension support consider removing the flag |
// FOLLOW_SYMLINKS_ANYWHERE below. Packed extensions should not have symlinks. |
CHECK(base::DirectoryExists(app_dir)) << app_dir.AsUTF8Unsafe(); |
int load_flags = Extension::FOLLOW_SYMLINKS_ANYWHERE; |
std::string load_error; |
- scoped_refptr<Extension> extension = file_util::LoadExtension( |
+ extension_ = file_util::LoadExtension( |
app_dir, Manifest::COMMAND_LINE, load_flags, &load_error); |
- if (!extension) { |
+ if (!extension_) { |
LOG(ERROR) << "Loading extension at " << app_dir.value() |
<< " failed with: " << load_error; |
return false; |
} |
- app_id_ = extension->id(); |
+ app_id_ = extension_->id(); |
// TODO(jamescook): We may want to do some of these things here: |
// * Create a PermissionsUpdater. |
@@ -60,14 +60,14 @@ bool ShellExtensionSystem::LoadAndLaunchApp(const base::FilePath& app_dir) { |
// * Call ExtensionPrefs::OnExtensionInstalled(). |
// * Send NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED. |
- ExtensionRegistry::Get(browser_context_)->AddEnabled(extension); |
+ ExtensionRegistry::Get(browser_context_)->AddEnabled(extension_); |
- RegisterExtensionWithRequestContexts(extension); |
+ RegisterExtensionWithRequestContexts(extension_); |
content::NotificationService::current()->Notify( |
chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
content::Source<BrowserContext>(browser_context_), |
- content::Details<const Extension>(extension)); |
+ content::Details<const Extension>(extension_)); |
// Inform the rest of the extensions system to start. |
ready_.Signal(); |
@@ -75,11 +75,14 @@ bool ShellExtensionSystem::LoadAndLaunchApp(const base::FilePath& app_dir) { |
chrome::NOTIFICATION_EXTENSIONS_READY, |
content::Source<BrowserContext>(browser_context_), |
content::NotificationService::NoDetails()); |
+ return true; |
+} |
+void ShellExtensionSystem::LaunchApp() { |
// Send the onLaunched event. |
- apps::ShellAPI::DispatchOnLaunchedEvent(event_router_.get(), extension.get()); |
- |
- return true; |
+ DCHECK(extension_.get()); |
+ apps::ShellAPI::DispatchOnLaunchedEvent(event_router_.get(), |
+ extension_.get()); |
} |
void ShellExtensionSystem::Shutdown() { |