OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/app/android/chrome_main_delegate_android.h" | 5 #include "chrome/app/android/chrome_main_delegate_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_registrar.h" | 8 #include "base/android/jni_registrar.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 int ChromeMainDelegateAndroid::RunProcess( | 35 int ChromeMainDelegateAndroid::RunProcess( |
36 const std::string& process_type, | 36 const std::string& process_type, |
37 const content::MainFunctionParams& main_function_params) { | 37 const content::MainFunctionParams& main_function_params) { |
38 if (process_type.empty()) { | 38 if (process_type.empty()) { |
39 JNIEnv* env = base::android::AttachCurrentThread(); | 39 JNIEnv* env = base::android::AttachCurrentThread(); |
40 RegisterApplicationNativeMethods(env); | 40 RegisterApplicationNativeMethods(env); |
41 | 41 |
42 browser_runner_.reset(content::BrowserMainRunner::Create()); | 42 browser_runner_.reset(content::BrowserMainRunner::Create()); |
43 int exit_code = browser_runner_->Initialize(main_function_params); | 43 return browser_runner_->Initialize(main_function_params); |
44 DCHECK(exit_code < 0); | |
45 | |
46 // Return 0 so that we do NOT trigger the default behavior. On Android, the | |
47 // UI message loop is managed by the Java application. | |
48 return 0; | |
49 } | 44 } |
50 | 45 |
51 return ChromeMainDelegate::RunProcess(process_type, main_function_params); | 46 return ChromeMainDelegate::RunProcess(process_type, main_function_params); |
52 } | 47 } |
53 | 48 |
54 bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) { | 49 bool ChromeMainDelegateAndroid::BasicStartupComplete(int* exit_code) { |
55 SetChromeSpecificCommandLineFlags(); | 50 SetChromeSpecificCommandLineFlags(); |
56 return ChromeMainDelegate::BasicStartupComplete(exit_code); | 51 return ChromeMainDelegate::BasicStartupComplete(exit_code); |
57 } | 52 } |
58 | 53 |
59 bool ChromeMainDelegateAndroid::RegisterApplicationNativeMethods(JNIEnv* env) { | 54 bool ChromeMainDelegateAndroid::RegisterApplicationNativeMethods(JNIEnv* env) { |
60 if (!chrome::android::RegisterJni(env)) | 55 if (!chrome::android::RegisterJni(env)) |
61 return false; | 56 return false; |
62 | 57 |
63 return base::android::RegisterNativeMethods(env, | 58 return base::android::RegisterNativeMethods(env, |
64 kRegistrationMethods, | 59 kRegistrationMethods, |
65 arraysize(kRegistrationMethods)); | 60 arraysize(kRegistrationMethods)); |
66 } | 61 } |
OLD | NEW |