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

Side by Side Diff: extensions/shell/browser/default_shell_browser_main_delegate.cc

Issue 642383003: Add the ability to load multiple apps into app_shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
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 "extensions/shell/browser/default_shell_browser_main_delegate.h" 5 #include "extensions/shell/browser/default_shell_browser_main_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/string_tokenizer.h"
10 #include "extensions/shell/browser/shell_desktop_controller.h" 11 #include "extensions/shell/browser/shell_desktop_controller.h"
11 #include "extensions/shell/browser/shell_extension_system.h" 12 #include "extensions/shell/browser/shell_extension_system.h"
12 #include "extensions/shell/common/switches.h" 13 #include "extensions/shell/common/switches.h"
13 14
14 namespace extensions { 15 namespace extensions {
15 16
16 DefaultShellBrowserMainDelegate::DefaultShellBrowserMainDelegate() { 17 DefaultShellBrowserMainDelegate::DefaultShellBrowserMainDelegate() {
17 } 18 }
18 19
19 DefaultShellBrowserMainDelegate::~DefaultShellBrowserMainDelegate() { 20 DefaultShellBrowserMainDelegate::~DefaultShellBrowserMainDelegate() {
20 } 21 }
21 22
22 void DefaultShellBrowserMainDelegate::Start( 23 void DefaultShellBrowserMainDelegate::Start(
23 content::BrowserContext* browser_context) { 24 content::BrowserContext* browser_context) {
24 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 25 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
25 if (command_line->HasSwitch(switches::kAppShellAppPath)) { 26 if (command_line->HasSwitch(switches::kAppShellAppPath)) {
26 base::FilePath app_dir(
27 command_line->GetSwitchValueNative(switches::kAppShellAppPath));
28 base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir);
29
30 ShellExtensionSystem* extension_system = static_cast<ShellExtensionSystem*>( 27 ShellExtensionSystem* extension_system = static_cast<ShellExtensionSystem*>(
31 ExtensionSystem::Get(browser_context)); 28 ExtensionSystem::Get(browser_context));
32 if (!extension_system->LoadApp(app_absolute_dir)) 29 extension_system->Init();
33 return; 30
34 extension_system->LaunchApp(); 31 CommandLine::StringType path_list =
32 command_line->GetSwitchValueNative(switches::kAppShellAppPath);
33
34 base::StringTokenizerT<CommandLine::StringType,
35 CommandLine::StringType::const_iterator>
36 tokenizer(path_list, FILE_PATH_LITERAL(","));
37 while (tokenizer.GetNext()) {
38 base::FilePath app_absolute_dir =
39 base::MakeAbsoluteFilePath(base::FilePath(tokenizer.token()));
40
41 const Extension* extension = extension_system->LoadApp(app_absolute_dir);
42 if (!extension)
43 continue;
44 extension_system->LaunchApp(extension->id());
45 }
35 } else { 46 } else {
36 LOG(ERROR) << "--" << switches::kAppShellAppPath 47 LOG(ERROR) << "--" << switches::kAppShellAppPath
37 << " unset; boredom is in your future"; 48 << " unset; boredom is in your future";
38 } 49 }
39 } 50 }
40 51
41 void DefaultShellBrowserMainDelegate::Shutdown() { 52 void DefaultShellBrowserMainDelegate::Shutdown() {
42 } 53 }
43 54
44 DesktopController* DefaultShellBrowserMainDelegate::CreateDesktopController() { 55 DesktopController* DefaultShellBrowserMainDelegate::CreateDesktopController() {
45 return new ShellDesktopController(); 56 return new ShellDesktopController();
46 } 57 }
47 58
48 } // namespace extensions 59 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_apitest.cc ('k') | extensions/shell/browser/desktop_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698