| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chrome_feature_list.h" | 5 #include "chrome/browser/android/chrome_feature_list.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace android { | 21 namespace android { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // Array of features exposed through the Java ChromeFeatureList API. Entries in | 25 // Array of features exposed through the Java ChromeFeatureList API. Entries in |
| 26 // this array may either refer to features defined in this file (above) or in | 26 // this array may either refer to features defined in this file (above) or in |
| 27 // other locations in the code base (e.g. chrome/, components/, etc). | 27 // other locations in the code base (e.g. chrome/, components/, etc). |
| 28 const base::Feature* kFeaturesExposedToJava[] = { | 28 const base::Feature* kFeaturesExposedToJava[] = { |
| 29 &kNTPOfflinePagesFeature, | 29 &kNTPOfflinePagesFeature, |
| 30 &kNTPSnippetsFeature, | 30 &kNTPSnippetsFeature, |
| 31 &kNTPToolbarFeature, |
| 31 &kPhysicalWebFeature, | 32 &kPhysicalWebFeature, |
| 32 &features::kSimplifiedFullscreenUI, | 33 &features::kSimplifiedFullscreenUI, |
| 33 &offline_pages::kOfflinePagesBackgroundLoadingFeature, | 34 &offline_pages::kOfflinePagesBackgroundLoadingFeature, |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 } // namespace | 37 } // namespace |
| 37 | 38 |
| 38 const base::Feature kNTPOfflinePagesFeature { | 39 const base::Feature kNTPOfflinePagesFeature { |
| 39 "NTPOfflinePages", base::FEATURE_DISABLED_BY_DEFAULT | 40 "NTPOfflinePages", base::FEATURE_DISABLED_BY_DEFAULT |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 const base::Feature kNTPSnippetsFeature { | 43 const base::Feature kNTPSnippetsFeature { |
| 43 "NTPSnippets", base::FEATURE_DISABLED_BY_DEFAULT | 44 "NTPSnippets", base::FEATURE_DISABLED_BY_DEFAULT |
| 44 }; | 45 }; |
| 45 | 46 |
| 47 const base::Feature kNTPToolbarFeature { |
| 48 "NTPToolbar", base::FEATURE_ENABLED_BY_DEFAULT |
| 49 }; |
| 50 |
| 46 const base::Feature kPhysicalWebFeature { | 51 const base::Feature kPhysicalWebFeature { |
| 47 "PhysicalWeb", base::FEATURE_DISABLED_BY_DEFAULT | 52 "PhysicalWeb", base::FEATURE_DISABLED_BY_DEFAULT |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 const base::Feature kSystemDownloadManager { | 55 const base::Feature kSystemDownloadManager { |
| 51 "SystemDownloadManager", base::FEATURE_ENABLED_BY_DEFAULT | 56 "SystemDownloadManager", base::FEATURE_ENABLED_BY_DEFAULT |
| 52 }; | 57 }; |
| 53 | 58 |
| 54 static jboolean IsEnabled(JNIEnv* env, | 59 static jboolean IsEnabled(JNIEnv* env, |
| 55 const JavaParamRef<jclass>& clazz, | 60 const JavaParamRef<jclass>& clazz, |
| 56 const JavaParamRef<jstring>& jfeature_name) { | 61 const JavaParamRef<jstring>& jfeature_name) { |
| 57 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); | 62 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); |
| 58 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { | 63 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { |
| 59 if (kFeaturesExposedToJava[i]->name == feature_name) | 64 if (kFeaturesExposedToJava[i]->name == feature_name) |
| 60 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); | 65 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); |
| 61 } | 66 } |
| 62 // Features queried via this API must be present in |kFeaturesExposedToJava|. | 67 // Features queried via this API must be present in |kFeaturesExposedToJava|. |
| 63 NOTREACHED(); | 68 NOTREACHED(); |
| 64 return false; | 69 return false; |
| 65 } | 70 } |
| 66 | 71 |
| 67 bool RegisterChromeFeatureListJni(JNIEnv* env) { | 72 bool RegisterChromeFeatureListJni(JNIEnv* env) { |
| 68 return RegisterNativesImpl(env); | 73 return RegisterNativesImpl(env); |
| 69 } | 74 } |
| 70 | 75 |
| 71 } // namespace android | 76 } // namespace android |
| 72 } // namespace chrome | 77 } // namespace chrome |
| OLD | NEW |