summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsw <msw@chromium.org>2015-05-14 16:17:24 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-14 23:17:40 +0000
commit1a4bbd1c973adbeeb9c9b4db061186a89fabbf0d (patch)
tree00262f6317878029cd44eb24c8aff267e4459728
parent56de5c361e59b039c7347441da6fb5f5b8ee32ee (diff)
downloadchromium_src-1a4bbd1c973adbeeb9c9b4db061186a89fabbf0d.zip
chromium_src-1a4bbd1c973adbeeb9c9b4db061186a89fabbf0d.tar.gz
chromium_src-1a4bbd1c973adbeeb9c9b4db061186a89fabbf0d.tar.bz2
Make Android Mojo Runner respect command line apps.
Make Mandoline always run the mojo:window_manager. (afaik we don't want to specify other command line apps) Make Mojo Runner run the command line app (fallback on WM). (The Android impl wasn't respecting the command line app) Consolidate on Context::RunCommandLineApplication helper. BUG=486220 TEST=Android mojo shell and apptest runner can run non-WM apps (eg. apptests). R=sky@chromium.org Review URL: https://codereview.chromium.org/1134713003 Cr-Commit-Position: refs/heads/master@{#329970}
-rw-r--r--mandoline/app/desktop/launcher_process.cc22
-rw-r--r--mojo/runner/android/main.cc3
-rw-r--r--mojo/runner/context.cc15
-rw-r--r--mojo/runner/context.h3
-rw-r--r--mojo/runner/desktop/launcher_process.cc21
5 files changed, 26 insertions, 38 deletions
diff --git a/mandoline/app/desktop/launcher_process.cc b/mandoline/app/desktop/launcher_process.cc
index a2b0cc4..e4a2373 100644
--- a/mandoline/app/desktop/launcher_process.cc
+++ b/mandoline/app/desktop/launcher_process.cc
@@ -76,23 +76,6 @@ void StopTracingAndFlushToDisk() {
flush_complete_event.Wait();
}
-void StartApp(mojo::runner::Context* context) {
- // If a mojo app isn't specified (i.e. for an apptest), run the mojo shell's
- // window manager.
- GURL app_url(GURL("mojo:window_manager"));
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- base::CommandLine::StringVector args = command_line->GetArgs();
- for (size_t i = 0; i < args.size(); ++i) {
- GURL possible_app(args[i]);
- if (possible_app.SchemeIs("mojo")) {
- app_url = possible_app;
- break;
- }
- }
-
- context->Run(app_url);
-}
-
} // namespace
int LauncherProcessMain(int argc, char** argv) {
@@ -122,7 +105,10 @@ int LauncherProcessMain(int argc, char** argv) {
base::TimeDelta::FromSeconds(5));
}
- message_loop.PostTask(FROM_HERE, base::Bind(&StartApp, &shell_context));
+ message_loop.PostTask(FROM_HERE,
+ base::Bind(&mojo::runner::Context::Run,
+ base::Unretained(&shell_context),
+ GURL("mojo:window_manager")));
message_loop.Run();
// Must be called before |message_loop| is destroyed.
diff --git a/mojo/runner/android/main.cc b/mojo/runner/android/main.cc
index dbe65e1..7236763 100644
--- a/mojo/runner/android/main.cc
+++ b/mojo/runner/android/main.cc
@@ -99,8 +99,7 @@ void MojoShellRunner::Run() {
Context* context = g_context.Pointer()->get();
ConfigureAndroidServices(context);
context->Init();
-
- context->Run(GURL("mojo:window_manager"));
+ context->RunCommandLineApplication();
loop.Run();
g_java_message_loop.Pointer()->get()->PostTask(FROM_HERE,
diff --git a/mojo/runner/context.cc b/mojo/runner/context.cc
index adccbfa..d9aee2e 100644
--- a/mojo/runner/context.cc
+++ b/mojo/runner/context.cc
@@ -318,6 +318,21 @@ void Context::Run(const GURL& url) {
base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url));
}
+void Context::RunCommandLineApplication() {
+ // If an app isn't specified (i.e. for an apptest), run the window manager.
+ GURL app_url("mojo:window_manager");
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ base::CommandLine::StringVector args = command_line->GetArgs();
+ for (size_t i = 0; i < args.size(); ++i) {
+ GURL possible_app(args[i]);
+ if (possible_app.SchemeIs("mojo")) {
+ app_url = possible_app;
+ break;
+ }
+ }
+ Run(app_url);
+}
+
void Context::OnApplicationEnd(const GURL& url) {
if (app_urls_.find(url) != app_urls_.end()) {
app_urls_.erase(url);
diff --git a/mojo/runner/context.h b/mojo/runner/context.h
index 1dd54cb..78cd163 100644
--- a/mojo/runner/context.h
+++ b/mojo/runner/context.h
@@ -55,6 +55,9 @@ class Context : public shell::ApplicationManager::Delegate,
void Run(const GURL& url);
+ // Run the application specified on the commandline.
+ void RunCommandLineApplication();
+
TaskRunners* task_runners() { return task_runners_.get(); }
shell::ApplicationManager* application_manager() {
return &application_manager_;
diff --git a/mojo/runner/desktop/launcher_process.cc b/mojo/runner/desktop/launcher_process.cc
index d8d9f9a..204b3f7 100644
--- a/mojo/runner/desktop/launcher_process.cc
+++ b/mojo/runner/desktop/launcher_process.cc
@@ -75,23 +75,6 @@ void StopTracingAndFlushToDisk() {
flush_complete_event.Wait();
}
-void StartApp(mojo::runner::Context* context) {
- // If a mojo app isn't specified (i.e. for an apptest), run the mojo shell's
- // window manager.
- GURL app_url(GURL("mojo:window_manager"));
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- base::CommandLine::StringVector args = command_line->GetArgs();
- for (size_t i = 0; i < args.size(); ++i) {
- GURL possible_app(args[i]);
- if (possible_app.SchemeIs("mojo")) {
- app_url = possible_app;
- break;
- }
- }
-
- context->Run(app_url);
-}
-
} // namespace
int LauncherProcessMain(int argc, char** argv) {
@@ -120,7 +103,9 @@ int LauncherProcessMain(int argc, char** argv) {
base::TimeDelta::FromSeconds(5));
}
- message_loop.PostTask(FROM_HERE, base::Bind(&StartApp, &shell_context));
+ message_loop.PostTask(FROM_HERE,
+ base::Bind(&Context::RunCommandLineApplication,
+ base::Unretained(&shell_context)));
message_loop.Run();
// Must be called before |message_loop| is destroyed.