OLD | NEW |
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 "shell/android/main.h" | 5 #include "shell/android/main.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "base/android/fifo_utils.h" | 9 #include "base/android/fifo_utils.h" |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // Setting the TMPDIR and HOME environment variables so that applications can | 254 // Setting the TMPDIR and HOME environment variables so that applications can |
255 // use it. | 255 // use it. |
256 // TODO(qsr) We will need our subprocesses to inherit this. | 256 // TODO(qsr) We will need our subprocesses to inherit this. |
257 int return_value = setenv("TMPDIR", tmp_dir.c_str(), 1); | 257 int return_value = setenv("TMPDIR", tmp_dir.c_str(), 1); |
258 DCHECK_EQ(return_value, 0); | 258 DCHECK_EQ(return_value, 0); |
259 return_value = setenv( | 259 return_value = setenv( |
260 "HOME", base::android::ConvertJavaStringToUTF8(env, j_home_dir).c_str(), | 260 "HOME", base::android::ConvertJavaStringToUTF8(env, j_home_dir).c_str(), |
261 1); | 261 1); |
262 DCHECK_EQ(return_value, 0); | 262 DCHECK_EQ(return_value, 0); |
263 | 263 |
264 base::android::ScopedJavaLocalRef<jobject> scoped_application_context( | 264 base::android::InitApplicationContext(env, application_context); |
265 env, application_context); | |
266 base::android::InitApplicationContext(env, scoped_application_context); | |
267 | 265 |
268 std::vector<std::string> parameters; | 266 std::vector<std::string> parameters; |
269 parameters.push_back("mojo_shell"); | 267 parameters.push_back("mojo_shell"); |
270 base::android::AppendJavaStringArrayToStringVector(env, jparameters, | 268 base::android::AppendJavaStringArrayToStringVector(env, jparameters, |
271 ¶meters); | 269 ¶meters); |
272 base::CommandLine::Init(0, nullptr); | 270 base::CommandLine::Init(0, nullptr); |
273 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 271 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
274 command_line->InitFromArgv(parameters); | 272 command_line->InitFromArgv(parameters); |
275 | 273 |
276 base::FilePath dumps_path = base::FilePath(tmp_dir).Append("breakpad_dumps"); | 274 base::FilePath dumps_path = base::FilePath(tmp_dir).Append("breakpad_dumps"); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 static void QuitShell(JNIEnv* env, const JavaParamRef<jclass>& clazz) { | 357 static void QuitShell(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
360 g_internal_data.Get().shell_task_runner->PostTask( | 358 g_internal_data.Get().shell_task_runner->PostTask( |
361 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 359 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
362 } | 360 } |
363 | 361 |
364 bool RegisterShellService(JNIEnv* env) { | 362 bool RegisterShellService(JNIEnv* env) { |
365 return RegisterNativesImpl(env); | 363 return RegisterNativesImpl(env); |
366 } | 364 } |
367 | 365 |
368 } // namespace shell | 366 } // namespace shell |
OLD | NEW |