Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 | 24 |
| 25 namespace chrome { | 25 namespace chrome { |
| 26 namespace android { | 26 namespace android { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 // Array of features exposed through the Java ChromeFeatureList API. Entries in | 30 // Array of features exposed through the Java ChromeFeatureList API. Entries in |
| 31 // this array may either refer to features defined in the header of this file or | 31 // this array may either refer to features defined in the header of this file or |
| 32 // in other locations in the code base (e.g. chrome/, components/, etc). | 32 // in other locations in the code base (e.g. chrome/, components/, etc). |
| 33 const base::Feature* kFeaturesExposedToJava[] = { | 33 const base::Feature* kFeaturesExposedToJava[] = { |
| 34 &autofill::kAutofillScanCardholderName, | |
| 35 &features::kAutoplayMutedVideos, | |
| 36 &features::kCredentialManagementAPI, | |
| 37 &features::kSimplifiedFullscreenUI, | |
| 38 &features::kWebPayments, | |
| 39 &kAndroidPayIntegrationV1, | 34 &kAndroidPayIntegrationV1, |
| 35 &kCCTExternalLinkHandling, | |
| 40 &kChromeHomeFeature, | 36 &kChromeHomeFeature, |
| 41 &kDownloadsUiFeature, | 37 &kDownloadsUiFeature, |
| 42 &kImportantSitesInCBD, | 38 &kImportantSitesInCBD, |
| 43 &ntp_snippets::kContentSuggestionsFeature, | 39 &kNoCreditCardAbort, |
| 44 &ntp_snippets::kSaveToOfflineFeature, | |
| 45 &ntp_snippets::kSectionDismissalFeature, | |
| 46 &kNTPFakeOmniboxTextFeature, | 40 &kNTPFakeOmniboxTextFeature, |
| 47 &kNTPOfflinePagesFeature, | 41 &kNTPOfflinePagesFeature, |
| 48 &kPhysicalWebFeature, | 42 &kPhysicalWebFeature, |
| 49 &kPhysicalWebIgnoreOtherClientsFeature, | 43 &kPhysicalWebIgnoreOtherClientsFeature, |
| 50 &kScanCardsInWebPayments, | 44 &kScanCardsInWebPayments, |
| 51 &kSpecialLocaleFeature, | 45 &kSpecialLocaleFeature, |
| 52 &kSpecialLocaleWrapper, | 46 &kSpecialLocaleWrapper, |
| 53 &kTabReparenting, | 47 &kTabReparenting, |
| 54 &kCCTExternalLinkHandling, | 48 &autofill::kAutofillScanCardholderName, |
|
please use gerrit instead
2016/10/21 19:00:20
What kind of sorting puts "a" below "k"? :-P
sebsg
2016/10/25 15:13:09
I saw it like the include files where you would in
| |
| 49 &features::kAutoplayMutedVideos, | |
| 50 &features::kCredentialManagementAPI, | |
| 51 &features::kSimplifiedFullscreenUI, | |
| 52 &features::kWebPayments, | |
| 53 &ntp_snippets::kContentSuggestionsFeature, | |
| 54 &ntp_snippets::kSaveToOfflineFeature, | |
| 55 &ntp_snippets::kSectionDismissalFeature, | |
| 56 &offline_pages::kBackgroundLoaderForDownloadsFeature, | |
| 55 &offline_pages::kOfflinePagesBackgroundLoadingFeature, | 57 &offline_pages::kOfflinePagesBackgroundLoadingFeature, |
| 56 &offline_pages::kBackgroundLoaderForDownloadsFeature, | |
| 57 &offline_pages::kOfflinePagesCTFeature, // See crbug.com/620421. | 58 &offline_pages::kOfflinePagesCTFeature, // See crbug.com/620421. |
| 58 &offline_pages::kOfflinePagesSharingFeature, | 59 &offline_pages::kOfflinePagesSharingFeature, |
| 59 &password_manager::features::kViewPasswords, | 60 &password_manager::features::kViewPasswords, |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 } // namespace | 63 } // namespace |
| 63 | 64 |
| 64 const base::Feature kAndroidPayIntegrationV1{"AndroidPayIntegrationV1", | 65 const base::Feature kAndroidPayIntegrationV1{"AndroidPayIntegrationV1", |
| 65 base::FEATURE_ENABLED_BY_DEFAULT}; | 66 base::FEATURE_ENABLED_BY_DEFAULT}; |
| 66 | 67 |
| 68 const base::Feature kCCTExternalLinkHandling{"CCTExternalLinkHandling", | |
| 69 base::FEATURE_ENABLED_BY_DEFAULT}; | |
| 70 | |
| 67 const base::Feature kChromeHomeFeature{"ChromeHome", | 71 const base::Feature kChromeHomeFeature{"ChromeHome", |
| 68 base::FEATURE_DISABLED_BY_DEFAULT}; | 72 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 69 | 73 |
| 70 const base::Feature kDownloadsUiFeature{"DownloadsUi", | 74 const base::Feature kDownloadsUiFeature{"DownloadsUi", |
| 71 base::FEATURE_DISABLED_BY_DEFAULT}; | 75 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 72 | 76 |
| 73 const base::Feature kImportantSitesInCBD{"ImportantSitesInCBD", | 77 const base::Feature kImportantSitesInCBD{"ImportantSitesInCBD", |
| 74 base::FEATURE_DISABLED_BY_DEFAULT}; | 78 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 75 | 79 |
| 80 const base::Feature kNoCreditCardAbort{"NoCreditCardAbort", | |
| 81 base::FEATURE_DISABLED_BY_DEFAULT}; | |
| 82 | |
| 76 const base::Feature kNTPOfflinePagesFeature{"NTPOfflinePages", | 83 const base::Feature kNTPOfflinePagesFeature{"NTPOfflinePages", |
| 77 base::FEATURE_DISABLED_BY_DEFAULT}; | 84 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 78 | 85 |
| 79 const base::Feature kNTPFakeOmniboxTextFeature{ | 86 const base::Feature kNTPFakeOmniboxTextFeature{ |
| 80 "NTPFakeOmniboxText", base::FEATURE_DISABLED_BY_DEFAULT}; | 87 "NTPFakeOmniboxText", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 81 | 88 |
| 82 const base::Feature kPhysicalWebFeature{"PhysicalWeb", | 89 const base::Feature kPhysicalWebFeature{"PhysicalWeb", |
| 83 base::FEATURE_ENABLED_BY_DEFAULT}; | 90 base::FEATURE_ENABLED_BY_DEFAULT}; |
| 84 | 91 |
| 85 const base::Feature kPhysicalWebIgnoreOtherClientsFeature{ | 92 const base::Feature kPhysicalWebIgnoreOtherClientsFeature{ |
| 86 "PhysicalWebIgnoreOtherClients", base::FEATURE_DISABLED_BY_DEFAULT}; | 93 "PhysicalWebIgnoreOtherClients", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 87 | 94 |
| 88 const base::Feature kScanCardsInWebPayments{"ScanCardsInWebPayments", | 95 const base::Feature kScanCardsInWebPayments{"ScanCardsInWebPayments", |
| 89 base::FEATURE_DISABLED_BY_DEFAULT}; | 96 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 90 | 97 |
| 91 const base::Feature kSpecialLocaleFeature{"SpecialLocale", | 98 const base::Feature kSpecialLocaleFeature{"SpecialLocale", |
| 92 base::FEATURE_DISABLED_BY_DEFAULT}; | 99 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 93 | 100 |
| 94 const base::Feature kSpecialLocaleWrapper{"SpecialLocaleWrapper", | 101 const base::Feature kSpecialLocaleWrapper{"SpecialLocaleWrapper", |
| 95 base::FEATURE_ENABLED_BY_DEFAULT}; | 102 base::FEATURE_ENABLED_BY_DEFAULT}; |
| 96 | 103 |
| 97 const base::Feature kTabReparenting{"TabReparenting", | 104 const base::Feature kTabReparenting{"TabReparenting", |
| 98 base::FEATURE_ENABLED_BY_DEFAULT}; | 105 base::FEATURE_ENABLED_BY_DEFAULT}; |
| 99 | 106 |
| 100 const base::Feature kCCTExternalLinkHandling{"CCTExternalLinkHandling", | |
| 101 base::FEATURE_ENABLED_BY_DEFAULT}; | |
| 102 | |
| 103 const base::Feature kUserMediaScreenCapturing{ | 107 const base::Feature kUserMediaScreenCapturing{ |
| 104 "UserMediaScreenCapturing", base::FEATURE_DISABLED_BY_DEFAULT}; | 108 "UserMediaScreenCapturing", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 105 | 109 |
| 106 static jboolean IsEnabled(JNIEnv* env, | 110 static jboolean IsEnabled(JNIEnv* env, |
| 107 const JavaParamRef<jclass>& clazz, | 111 const JavaParamRef<jclass>& clazz, |
| 108 const JavaParamRef<jstring>& jfeature_name) { | 112 const JavaParamRef<jstring>& jfeature_name) { |
| 109 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); | 113 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); |
| 110 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { | 114 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { |
| 111 if (kFeaturesExposedToJava[i]->name == feature_name) | 115 if (kFeaturesExposedToJava[i]->name == feature_name) |
| 112 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); | 116 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); |
| 113 } | 117 } |
| 114 // Features queried via this API must be present in |kFeaturesExposedToJava|. | 118 // Features queried via this API must be present in |kFeaturesExposedToJava|. |
| 115 NOTREACHED(); | 119 NOTREACHED(); |
| 116 return false; | 120 return false; |
| 117 } | 121 } |
| 118 | 122 |
| 119 bool RegisterChromeFeatureListJni(JNIEnv* env) { | 123 bool RegisterChromeFeatureListJni(JNIEnv* env) { |
| 120 return RegisterNativesImpl(env); | 124 return RegisterNativesImpl(env); |
| 121 } | 125 } |
| 122 | 126 |
| 123 } // namespace android | 127 } // namespace android |
| 124 } // namespace chrome | 128 } // namespace chrome |
| OLD | NEW |