| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "apps/shell/browser/default_shell_browser_main_delegate.h" | |
| 6 | |
| 7 #include "apps/shell/browser/default_shell_app_window_controller.h" | |
| 8 #include "apps/shell/browser/shell_desktop_controller.h" | |
| 9 #include "apps/shell/browser/shell_extension_system.h" | |
| 10 #include "apps/shell/common/switches.h" | |
| 11 #include "base/command_line.h" | |
| 12 #include "base/file_util.h" | |
| 13 #include "base/files/file_path.h" | |
| 14 | |
| 15 namespace apps { | |
| 16 | |
| 17 DefaultShellBrowserMainDelegate::DefaultShellBrowserMainDelegate() { | |
| 18 } | |
| 19 | |
| 20 DefaultShellBrowserMainDelegate::~DefaultShellBrowserMainDelegate() { | |
| 21 } | |
| 22 | |
| 23 void DefaultShellBrowserMainDelegate::Start( | |
| 24 content::BrowserContext* browser_context) { | |
| 25 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 26 if (command_line->HasSwitch(switches::kAppShellAppPath)) { | |
| 27 base::FilePath app_dir( | |
| 28 command_line->GetSwitchValueNative(switches::kAppShellAppPath)); | |
| 29 base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir); | |
| 30 | |
| 31 extensions::ShellExtensionSystem* extension_system = | |
| 32 static_cast<extensions::ShellExtensionSystem*>( | |
| 33 extensions::ExtensionSystem::Get(browser_context)); | |
| 34 if (!extension_system->LoadApp(app_absolute_dir)) | |
| 35 return; | |
| 36 extension_system->LaunchApp(); | |
| 37 } else { | |
| 38 LOG(ERROR) << "--" << switches::kAppShellAppPath | |
| 39 << " unset; boredom is in your future"; | |
| 40 } | |
| 41 } | |
| 42 | |
| 43 void DefaultShellBrowserMainDelegate::Shutdown() { | |
| 44 } | |
| 45 | |
| 46 ShellDesktopController* | |
| 47 DefaultShellBrowserMainDelegate::CreateDesktopController() { | |
| 48 ShellDesktopController* desktop = new ShellDesktopController(); | |
| 49 desktop->SetAppWindowController(new DefaultShellAppWindowController(desktop)); | |
| 50 return desktop; | |
| 51 } | |
| 52 | |
| 53 } // namespace apps | |
| OLD | NEW |