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

Side by Side Diff: mojo/runner/context.cc

Issue 1134713003: Make Android Mojo Runner respect command line apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « mojo/runner/context.h ('k') | mojo/runner/desktop/launcher_process.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/runner/context.h" 5 #include "mojo/runner/context.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 void Context::Run(const GURL& url) { 311 void Context::Run(const GURL& url) {
312 ServiceProviderPtr services; 312 ServiceProviderPtr services;
313 ServiceProviderPtr exposed_services; 313 ServiceProviderPtr exposed_services;
314 314
315 app_urls_.insert(url); 315 app_urls_.insert(url);
316 application_manager_.ConnectToApplication( 316 application_manager_.ConnectToApplication(
317 url, GURL(), GetProxy(&services), exposed_services.Pass(), 317 url, GURL(), GetProxy(&services), exposed_services.Pass(),
318 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url)); 318 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url));
319 } 319 }
320 320
321 void Context::RunCommandLineApplication() {
322 // If an app isn't specified (i.e. for an apptest), run the window manager.
323 GURL app_url("mojo:window_manager");
324 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
325 base::CommandLine::StringVector args = command_line->GetArgs();
326 for (size_t i = 0; i < args.size(); ++i) {
327 GURL possible_app(args[i]);
328 if (possible_app.SchemeIs("mojo")) {
329 app_url = possible_app;
330 break;
331 }
332 }
333 Run(app_url);
334 }
335
321 void Context::OnApplicationEnd(const GURL& url) { 336 void Context::OnApplicationEnd(const GURL& url) {
322 if (app_urls_.find(url) != app_urls_.end()) { 337 if (app_urls_.find(url) != app_urls_.end()) {
323 app_urls_.erase(url); 338 app_urls_.erase(url);
324 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { 339 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) {
325 DCHECK_EQ(base::MessageLoop::current()->task_runner(), 340 DCHECK_EQ(base::MessageLoop::current()->task_runner(),
326 task_runners_->shell_runner()); 341 task_runners_->shell_runner());
327 base::MessageLoop::current()->Quit(); 342 base::MessageLoop::current()->Quit();
328 } 343 }
329 } 344 }
330 } 345 }
331 346
332 } // namespace runner 347 } // namespace runner
333 } // namespace mojo 348 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/runner/context.h ('k') | mojo/runner/desktop/launcher_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698