Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/browser/android/chrome_feature_list.cc

Issue 1565883006: [Offline Pages on the NTP] Hide behind a base::Feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@offline_direct
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/android/chrome_feature_list.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/feature_list.h" 12 #include "base/feature_list.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "jni/ChromeFeatureList_jni.h" 14 #include "jni/ChromeFeatureList_jni.h"
15 15
16 using base::android::ConvertJavaStringToUTF8; 16 using base::android::ConvertJavaStringToUTF8;
17 17
18 namespace chrome { 18 namespace chrome {
19 namespace android { 19 namespace android {
20 20
21 namespace { 21 namespace {
22 22
23 // Array of features exposed through the Java ChromeFeatureList API. Entries in 23 // Array of features exposed through the Java ChromeFeatureList API. Entries in
24 // this array may either refer to features defined in this file (above) or in 24 // this array may either refer to features defined in this file (above) or in
25 // other locations in the code base (e.g. chrome/, components/, etc). 25 // other locations in the code base (e.g. chrome/, components/, etc).
26 const base::Feature* kFeaturesExposedToJava[] = { 26 const base::Feature* kFeaturesExposedToJava[] = {
27 &kNTPOfflinePagesFeature,
27 &kPhysicalWebFeature, 28 &kPhysicalWebFeature,
28 }; 29 };
29 30
30 } // namespace 31 } // namespace
31 32
33 const base::Feature kNTPOfflinePagesFeature {
34 "NTPOfflinePages", base::FEATURE_DISABLED_BY_DEFAULT
35 };
36
32 const base::Feature kPhysicalWebFeature { 37 const base::Feature kPhysicalWebFeature {
33 "PhysicalWeb", base::FEATURE_DISABLED_BY_DEFAULT 38 "PhysicalWeb", base::FEATURE_DISABLED_BY_DEFAULT
34 }; 39 };
35 40
36 static jboolean IsEnabled(JNIEnv* env, 41 static jboolean IsEnabled(JNIEnv* env,
37 const JavaParamRef<jclass>& clazz, 42 const JavaParamRef<jclass>& clazz,
38 const JavaParamRef<jstring>& jfeature_name) { 43 const JavaParamRef<jstring>& jfeature_name) {
39 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name); 44 const std::string feature_name = ConvertJavaStringToUTF8(env, jfeature_name);
40 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) { 45 for (size_t i = 0; i < arraysize(kFeaturesExposedToJava); ++i) {
41 if (kFeaturesExposedToJava[i]->name == feature_name) 46 if (kFeaturesExposedToJava[i]->name == feature_name)
42 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]); 47 return base::FeatureList::IsEnabled(*kFeaturesExposedToJava[i]);
43 } 48 }
44 // Features queried via this API must be present in |kFeaturesExposedToJava|. 49 // Features queried via this API must be present in |kFeaturesExposedToJava|.
45 NOTREACHED(); 50 NOTREACHED();
46 return false; 51 return false;
47 } 52 }
48 53
49 bool RegisterChromeFeatureListJni(JNIEnv* env) { 54 bool RegisterChromeFeatureListJni(JNIEnv* env) {
50 return RegisterNativesImpl(env); 55 return RegisterNativesImpl(env);
51 } 56 }
52 57
53 } // namespace android 58 } // namespace android
54 } // namespace chrome 59 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/android/chrome_feature_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698