blob: 74e38e6283900d9233c7dab1dec723870ac35e48 [file] [log] [blame]
[email protected]57624ab2013-08-01 16:01:511// 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.
4
[email protected]ddb4b202013-08-20 22:55:545#include "content/browser/android/browser_startup_controller.h"
[email protected]57624ab2013-08-01 16:01:516
7#include "base/android/jni_android.h"
[email protected]232e09d2013-08-27 15:29:568#include "base/android/jni_string.h"
9#include "content/browser/android/content_startup_flags.h"
10
[email protected]ddb4b202013-08-20 22:55:5411#include "jni/BrowserStartupController_jni.h"
[email protected]57624ab2013-08-01 16:01:5112
13namespace content {
14
15bool BrowserMayStartAsynchronously() {
16 JNIEnv* env = base::android::AttachCurrentThread();
[email protected]ddb4b202013-08-20 22:55:5417 return Java_BrowserStartupController_browserMayStartAsynchonously(env);
[email protected]57624ab2013-08-01 16:01:5118}
19
20void BrowserStartupComplete(int result) {
21 JNIEnv* env = base::android::AttachCurrentThread();
[email protected]ddb4b202013-08-20 22:55:5422 Java_BrowserStartupController_browserStartupComplete(env, result);
[email protected]57624ab2013-08-01 16:01:5123}
24
[email protected]ddb4b202013-08-20 22:55:5425bool RegisterBrowserStartupController(JNIEnv* env) {
[email protected]57624ab2013-08-01 16:01:5126 return RegisterNativesImpl(env);
27}
[email protected]232e09d2013-08-27 15:29:5628
29static void SetCommandLineFlags(JNIEnv* env,
30 jclass clazz,
[email protected]6f562222014-07-18 15:03:0131 jboolean single_process,
[email protected]232e09d2013-08-27 15:29:5632 jstring plugin_descriptor) {
33 std::string plugin_str =
34 (plugin_descriptor == NULL
35 ? std::string()
36 : base::android::ConvertJavaStringToUTF8(env, plugin_descriptor));
[email protected]6f562222014-07-18 15:03:0137 SetContentCommandLineFlags(static_cast<bool>(single_process), plugin_str);
[email protected]232e09d2013-08-27 15:29:5638}
39
40static jboolean IsOfficialBuild(JNIEnv* env, jclass clazz) {
41#if defined(OFFICIAL_BUILD)
42 return true;
43#else
44 return false;
45#endif
46}
47
48static jboolean IsPluginEnabled(JNIEnv* env, jclass clazz) {
49#if defined(ENABLE_PLUGINS)
50 return true;
51#else
52 return false;
53#endif
54}
55
[email protected]57624ab2013-08-01 16:01:5156} // namespace content