| 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 11 matching lines...) Expand all Loading... |
| 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 &kNTPToolbarFeature, |
| 32 &kNTPFakeOmniboxTextFeature, |
| 32 &kPhysicalWebFeature, | 33 &kPhysicalWebFeature, |
| 33 &features::kSimplifiedFullscreenUI, | 34 &features::kSimplifiedFullscreenUI, |
| 34 &offline_pages::kOfflinePagesBackgroundLoadingFeature, | 35 &offline_pages::kOfflinePagesBackgroundLoadingFeature, |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 } // namespace | 38 } // namespace |
| 38 | 39 |
| 39 const base::Feature kNTPOfflinePagesFeature { | 40 const base::Feature kNTPOfflinePagesFeature { |
| 40 "NTPOfflinePages", base::FEATURE_DISABLED_BY_DEFAULT | 41 "NTPOfflinePages", base::FEATURE_DISABLED_BY_DEFAULT |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 const base::Feature kNTPSnippetsFeature { | 44 const base::Feature kNTPSnippetsFeature { |
| 44 "NTPSnippets", base::FEATURE_DISABLED_BY_DEFAULT | 45 "NTPSnippets", base::FEATURE_DISABLED_BY_DEFAULT |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 const base::Feature kNTPToolbarFeature { | 48 const base::Feature kNTPToolbarFeature { |
| 48 "NTPToolbar", base::FEATURE_ENABLED_BY_DEFAULT | 49 "NTPToolbar", base::FEATURE_ENABLED_BY_DEFAULT |
| 49 }; | 50 }; |
| 50 | 51 |
| 52 const base::Feature kNTPFakeOmniboxTextFeature { |
| 53 "NTPFakeOmniboxText", base::FEATURE_DISABLED_BY_DEFAULT |
| 54 }; |
| 55 |
| 51 const base::Feature kPhysicalWebFeature { | 56 const base::Feature kPhysicalWebFeature { |
| 52 "PhysicalWeb", base::FEATURE_DISABLED_BY_DEFAULT | 57 "PhysicalWeb", base::FEATURE_DISABLED_BY_DEFAULT |
| 53 }; | 58 }; |
| 54 | 59 |
| 55 const base::Feature kSystemDownloadManager { | 60 const base::Feature kSystemDownloadManager { |
| 56 "SystemDownloadManager", base::FEATURE_ENABLED_BY_DEFAULT | 61 "SystemDownloadManager", base::FEATURE_ENABLED_BY_DEFAULT |
| 57 }; | 62 }; |
| 58 | 63 |
| 59 static jboolean IsEnabled(JNIEnv* env, | 64 static jboolean IsEnabled(JNIEnv* env, |
| 60 const JavaParamRef<jclass>& clazz, | 65 const JavaParamRef<jclass>& clazz, |
| 61 const JavaParamRef<jstring>& jfeature_name) { | 66 const JavaParamRef<jstring>& jfeature_name) { |
| 62 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); | 67 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); |
| 63 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { | 68 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { |
| 64 if (kFeaturesExposedToJava[i]->name == feature_name) | 69 if (kFeaturesExposedToJava[i]->name == feature_name) |
| 65 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); | 70 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); |
| 66 } | 71 } |
| 67 // Features queried via this API must be present in |kFeaturesExposedToJava|. | 72 // Features queried via this API must be present in |kFeaturesExposedToJava|. |
| 68 NOTREACHED(); | 73 NOTREACHED(); |
| 69 return false; | 74 return false; |
| 70 } | 75 } |
| 71 | 76 |
| 72 bool RegisterChromeFeatureListJni(JNIEnv* env) { | 77 bool RegisterChromeFeatureListJni(JNIEnv* env) { |
| 73 return RegisterNativesImpl(env); | 78 return RegisterNativesImpl(env); |
| 74 } | 79 } |
| 75 | 80 |
| 76 } // namespace android | 81 } // namespace android |
| 77 } // namespace chrome | 82 } // namespace chrome |
| OLD | NEW |