Index: apps/shell/app/shell_main.cc |
diff --git a/apps/shell/app/shell_main.cc b/apps/shell/app/shell_main.cc |
index cd44b99d7c9d504fb4263040e1d802753df97be2..4f6a055992fca141d0796f46fb634183e6cad6df 100644 |
--- a/apps/shell/app/shell_main.cc |
+++ b/apps/shell/app/shell_main.cc |
@@ -3,6 +3,12 @@ |
// found in the LICENSE file. |
#include "apps/shell/app/shell_main_delegate.h" |
+#include "apps/shell/browser/shell_browser_main_parts.h" |
+#include "apps/shell/browser/shell_extension_system.h" |
+#include "apps/shell/common/shell_delegate.h" |
+#include "base/command_line.h" |
+#include "base/file_util.h" |
+#include "base/files/file_path.h" |
#include "content/public/app/content_main.h" |
#if defined(OS_WIN) |
@@ -10,12 +16,38 @@ |
#include "sandbox/win/src/sandbox_types.h" |
#endif |
+class AppShellDelegate : public apps::ShellDelegate { |
oshima
2014/05/07 22:08:03
I'm not sure where this code should live. Maybe in
James Cook
2014/05/07 23:42:45
The final code should live in apps/shell/browser,
oshima
2014/05/08 21:12:37
moved to apps/shell/browser/shell_app_starter.
|
+ public: |
+ AppShellDelegate() {} |
+ virtual ~AppShellDelegate() {} |
+ |
+ virtual void Start(content::BrowserContext* browser_context) OVERRIDE { |
+ const std::string kAppSwitch = "app"; |
+ CommandLine* command_line = CommandLine::ForCurrentProcess(); |
+ if (command_line->HasSwitch(kAppSwitch)) { |
+ base::FilePath app_dir(command_line->GetSwitchValueNative(kAppSwitch)); |
+ base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir); |
+ |
+ extensions::ShellExtensionSystem* extension_system = |
+ static_cast<extensions::ShellExtensionSystem*>( |
+ extensions::ExtensionSystem::Get(browser_context)); |
oshima
2014/05/07 22:08:03
Not sure if this is right thing to do either....
James Cook
2014/05/07 23:42:45
The cast is fine. It's just convenient to put Loa
|
+ extension_system->LoadAndLaunchApp(app_absolute_dir); |
+ } else { |
+ LOG(ERROR) << "--" << kAppSwitch << " unset; boredom is in your future"; |
+ } |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(AppShellDelegate); |
+}; |
+ |
#if defined(OS_WIN) |
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { |
#else |
int main(int argc, const char** argv) { |
#endif |
- apps::ShellMainDelegate delegate; |
+ AppShellDelegate app_shell_delegate; |
+ apps::ShellMainDelegate delegate(&app_shell_delegate); |
content::ContentMainParams params(&delegate); |
#if defined(OS_WIN) |