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

Unified 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, 2 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
Index: extensions/shell/browser/default_shell_browser_main_delegate.cc
diff --git a/extensions/shell/browser/default_shell_browser_main_delegate.cc b/extensions/shell/browser/default_shell_browser_main_delegate.cc
index 491fe4370324a1e5d70243477782fd304cf63a61..7e49f52e41184bbcac078f9b3e1dbd31dcc29688 100644
--- a/extensions/shell/browser/default_shell_browser_main_delegate.cc
+++ b/extensions/shell/browser/default_shell_browser_main_delegate.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
+#include "base/strings/string_tokenizer.h"
#include "extensions/shell/browser/shell_desktop_controller.h"
#include "extensions/shell/browser/shell_extension_system.h"
#include "extensions/shell/common/switches.h"
@@ -23,15 +24,25 @@ void DefaultShellBrowserMainDelegate::Start(
content::BrowserContext* browser_context) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kAppShellAppPath)) {
- base::FilePath app_dir(
- command_line->GetSwitchValueNative(switches::kAppShellAppPath));
- base::FilePath app_absolute_dir = base::MakeAbsoluteFilePath(app_dir);
-
ShellExtensionSystem* extension_system = static_cast<ShellExtensionSystem*>(
ExtensionSystem::Get(browser_context));
- if (!extension_system->LoadApp(app_absolute_dir))
- return;
- extension_system->LaunchApp();
+ extension_system->Init();
+
+ CommandLine::StringType path_list =
+ command_line->GetSwitchValueNative(switches::kAppShellAppPath);
+
+ base::StringTokenizerT<CommandLine::StringType,
+ CommandLine::StringType::const_iterator>
+ tokenizer(path_list, FILE_PATH_LITERAL(","));
+ while (tokenizer.GetNext()) {
+ base::FilePath app_absolute_dir =
+ base::MakeAbsoluteFilePath(base::FilePath(tokenizer.token()));
+
+ const Extension* extension = extension_system->LoadApp(app_absolute_dir);
+ if (!extension)
+ continue;
+ extension_system->LaunchApp(extension->id());
+ }
} else {
LOG(ERROR) << "--" << switches::kAppShellAppPath
<< " unset; boredom is in your future";
« 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