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

Unified Diff: apps/shell/shell_extension_system.cc

Issue 101203008: Allow app_shell to run past extension manifest parsing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup register_manifest Created 6 years, 11 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/shell_extension_system.h ('k') | apps/shell/shell_extensions_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/shell/shell_extension_system.cc
diff --git a/apps/shell/shell_extension_system.cc b/apps/shell/shell_extension_system.cc
index 5d94ef0d39af34828c3f6d1c6b14a9282e4cb7b2..f3ba941db297cf04688e3fd80e99a7db7539bdf1 100644
--- a/apps/shell/shell_extension_system.cc
+++ b/apps/shell/shell_extension_system.cc
@@ -4,10 +4,19 @@
#include "apps/shell/shell_extension_system.h"
+#include <string>
+
#include "base/command_line.h"
+#include "base/files/file_path.h"
+#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_prefs.h"
+#include "chrome/common/extensions/extension_file_util.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_registry.h"
#include "extensions/browser/lazy_background_task_queue.h"
#include "extensions/browser/process_manager.h"
@@ -22,6 +31,42 @@ ShellExtensionSystem::ShellExtensionSystem(BrowserContext* browser_context)
ShellExtensionSystem::~ShellExtensionSystem() {
}
+bool ShellExtensionSystem::LoadAndLaunchApp(const base::FilePath& app_dir) {
+ std::string load_error;
+ scoped_refptr<Extension> extension =
+ extension_file_util::LoadExtension(app_dir,
+ extensions::Manifest::COMMAND_LINE,
+ Extension::NO_FLAGS,
+ &load_error);
+ if (!extension) {
+ LOG(ERROR) << "Loading extension at " << app_dir.value()
+ << " failed with: " << load_error;
+ return false;
+ }
+
+ ExtensionRegistry::Get(browser_context_)->AddEnabled(extension);
+
+ // TODO(jamescook): If RegisterExtensionWithRequestContexts() did something,
+ // this would be the place to call it.
+
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_EXTENSION_LOADED,
+ content::Source<BrowserContext>(browser_context_),
+ content::Details<const Extension>(extension));
+
+ // Inform the rest of the extensions system to start.
+ ready_.Signal();
+ LOG(WARNING) << "-----------------------------------";
+ LOG(WARNING) << "app_shell is expected to crash now.";
+ LOG(WARNING) << "-----------------------------------";
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_EXTENSIONS_READY,
+ content::Source<BrowserContext>(browser_context_),
+ content::NotificationService::NoDetails());
+
+ return true;
+}
+
void ShellExtensionSystem::Shutdown() {
}
@@ -34,7 +79,7 @@ void ShellExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
}
ExtensionService* ShellExtensionSystem::extension_service() {
- // This class only has an ExtensionServiceInterface.
+ NOTREACHED();
return NULL;
}
« no previous file with comments | « apps/shell/shell_extension_system.h ('k') | apps/shell/shell_extensions_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698