| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/android/feature_utilities.h" | 5 #include "chrome/browser/android/feature_utilities.h" |
| 6 | 6 |
| 7 #include "jni/FeatureUtilities_jni.h" | 7 #include "jni/FeatureUtilities_jni.h" |
| 8 | 8 |
| 9 using base::android::JavaParamRef; | 9 using base::android::JavaParamRef; |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 bool document_mode_enabled = false; | |
| 13 bool custom_tab_visible = false; | 12 bool custom_tab_visible = false; |
| 14 bool is_in_multi_window_mode = false; | 13 bool is_in_multi_window_mode = false; |
| 15 } // namespace | 14 } // namespace |
| 16 | 15 |
| 17 namespace chrome { | 16 namespace chrome { |
| 18 namespace android { | 17 namespace android { |
| 19 | 18 |
| 20 RunningModeHistogram GetDocumentModeValue() { | |
| 21 return document_mode_enabled ? RUNNING_MODE_DOCUMENT_MODE : | |
| 22 RUNNING_MODE_TABBED_MODE; | |
| 23 } | |
| 24 | |
| 25 CustomTabsVisibilityHistogram GetCustomTabsVisibleValue() { | 19 CustomTabsVisibilityHistogram GetCustomTabsVisibleValue() { |
| 26 return custom_tab_visible ? VISIBLE_CUSTOM_TAB : | 20 return custom_tab_visible ? VISIBLE_CUSTOM_TAB : |
| 27 VISIBLE_CHROME_TAB; | 21 VISIBLE_CHROME_TAB; |
| 28 } | 22 } |
| 29 | 23 |
| 30 bool GetIsInMultiWindowModeValue() { | 24 bool GetIsInMultiWindowModeValue() { |
| 31 return is_in_multi_window_mode; | 25 return is_in_multi_window_mode; |
| 32 } | 26 } |
| 33 | 27 |
| 34 } // namespace android | 28 } // namespace android |
| 35 } // namespace chrome | 29 } // namespace chrome |
| 36 | 30 |
| 37 static void SetDocumentModeEnabled(JNIEnv* env, | |
| 38 const JavaParamRef<jclass>& clazz, | |
| 39 jboolean enabled) { | |
| 40 document_mode_enabled = enabled; | |
| 41 } | |
| 42 | |
| 43 static void SetCustomTabVisible(JNIEnv* env, | 31 static void SetCustomTabVisible(JNIEnv* env, |
| 44 const JavaParamRef<jclass>& clazz, | 32 const JavaParamRef<jclass>& clazz, |
| 45 jboolean visible) { | 33 jboolean visible) { |
| 46 custom_tab_visible = visible; | 34 custom_tab_visible = visible; |
| 47 } | 35 } |
| 48 | 36 |
| 49 static void SetIsInMultiWindowMode(JNIEnv* env, | 37 static void SetIsInMultiWindowMode(JNIEnv* env, |
| 50 const JavaParamRef<jclass>& clazz, | 38 const JavaParamRef<jclass>& clazz, |
| 51 jboolean j_is_in_multi_window_mode) { | 39 jboolean j_is_in_multi_window_mode) { |
| 52 is_in_multi_window_mode = j_is_in_multi_window_mode; | 40 is_in_multi_window_mode = j_is_in_multi_window_mode; |
| 53 } | 41 } |
| 54 | 42 |
| 55 bool RegisterFeatureUtilities(JNIEnv* env) { | 43 bool RegisterFeatureUtilities(JNIEnv* env) { |
| 56 return RegisterNativesImpl(env); | 44 return RegisterNativesImpl(env); |
| 57 } | 45 } |
| OLD | NEW |