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