Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / android / browser_startup_controller.cc
blob74e38e6283900d9233c7dab1dec723870ac35e48
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
3 // found in the LICENSE file.
5 #include "content/browser/android/browser_startup_controller.h"
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h"
9 #include "content/browser/android/content_startup_flags.h"
11 #include "jni/BrowserStartupController_jni.h"
13 namespace content {
15 bool BrowserMayStartAsynchronously() {
16 JNIEnv* env = base::android::AttachCurrentThread();
17 return Java_BrowserStartupController_browserMayStartAsynchonously(env);
20 void BrowserStartupComplete(int result) {
21 JNIEnv* env = base::android::AttachCurrentThread();
22 Java_BrowserStartupController_browserStartupComplete(env, result);
25 bool RegisterBrowserStartupController(JNIEnv* env) {
26 return RegisterNativesImpl(env);
29 static void SetCommandLineFlags(JNIEnv* env,
30 jclass clazz,
31 jboolean single_process,
32 jstring plugin_descriptor) {
33 std::string plugin_str =
34 (plugin_descriptor == NULL
35 ? std::string()
36 : base::android::ConvertJavaStringToUTF8(env, plugin_descriptor));
37 SetContentCommandLineFlags(static_cast<bool>(single_process), plugin_str);
40 static jboolean IsOfficialBuild(JNIEnv* env, jclass clazz) {
41 #if defined(OFFICIAL_BUILD)
42 return true;
43 #else
44 return false;
45 #endif
48 static jboolean IsPluginEnabled(JNIEnv* env, jclass clazz) {
49 #if defined(ENABLE_PLUGINS)
50 return true;
51 #else
52 return false;
53 #endif
56 } // namespace content