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

Side by Side Diff: mojo/shell/android/mojo_main.cc

Issue 305013015: Mojo: (Mostly) factor out command-line switches from the shell's load code path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/shell/context.h » ('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/shell/android/mojo_main.h" 5 #include "mojo/shell/android/mojo_main.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "base/at_exit.h" 8 #include "base/at_exit.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 g_java_message_loop.Get().reset(new base::MessageLoopForUI); 51 g_java_message_loop.Get().reset(new base::MessageLoopForUI);
52 base::MessageLoopForUI::current()->Start(); 52 base::MessageLoopForUI::current()->Start();
53 53
54 // TODO(abarth): At which point should we switch to cross-platform 54 // TODO(abarth): At which point should we switch to cross-platform
55 // initialization? 55 // initialization?
56 56
57 gfx::GLSurface::InitializeOneOff(); 57 gfx::GLSurface::InitializeOneOff();
58 } 58 }
59 59
60 static void Start(JNIEnv* env, jclass clazz, jobject context, jstring jurl) { 60 static void Start(JNIEnv* env, jclass clazz, jobject context, jstring jurl) {
61 std::string app_url; 61 std::vector<GURL> app_urls;
62 #if defined(MOJO_SHELL_DEBUG_URL) 62 #if defined(MOJO_SHELL_DEBUG_URL)
63 app_url = MOJO_SHELL_DEBUG_URL; 63 app_urls.push_back(GURL(MOJO_SHELL_DEBUG_URL));
64 // Sleep for 5 seconds to give the debugger a chance to attach. 64 // Sleep for 5 seconds to give the debugger a chance to attach.
65 sleep(5); 65 sleep(5);
66 #else 66 #else
67 if (jurl) 67 if (jurl)
68 app_url = base::android::ConvertJavaStringToUTF8(env, jurl); 68 app_urls.push_back(GURL(base::android::ConvertJavaStringToUTF8(env, jurl)));
69 #endif 69 #endif
70 if (!app_url.empty()) {
71 std::vector<std::string> argv;
72 argv.push_back("mojo_shell");
73 argv.push_back(app_url);
74 base::CommandLine::ForCurrentProcess()->InitFromArgv(argv);
75 }
76 70
77 g_env.Get().reset(new Environment); 71 g_env.Get().reset(new Environment);
78 72
79 base::android::ScopedJavaGlobalRef<jobject> activity; 73 base::android::ScopedJavaGlobalRef<jobject> activity;
80 activity.Reset(env, context); 74 activity.Reset(env, context);
81 75
82 shell::Context* shell_context = new shell::Context(); 76 shell::Context* shell_context = new shell::Context();
83 shell_context->set_activity(activity.obj()); 77 shell_context->set_activity(activity.obj());
84 78
85 g_context.Get().reset(shell_context); 79 g_context.Get().reset(shell_context);
86 shell::Run(shell_context); 80 shell::Run(shell_context, app_urls);
87 } 81 }
88 82
89 bool RegisterMojoMain(JNIEnv* env) { 83 bool RegisterMojoMain(JNIEnv* env) {
90 return RegisterNativesImpl(env); 84 return RegisterNativesImpl(env);
91 } 85 }
92 86
93 } // namespace mojo 87 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/shell/context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698