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

Unified Diff: apps/shell/browser/shell_extension_system.cc

Issue 313733005: Introduces --app flag to athena to load an app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 6 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 | « apps/shell/browser/shell_extension_system.h ('k') | apps/shell/test/shell_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « apps/shell/browser/shell_extension_system.h ('k') | apps/shell/test/shell_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698