OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/feature_list.h" | 5 #include "base/feature_list.h" |
6 #include "components/safe_browsing_db/v4_feature_list.h" | 6 #include "components/safe_browsing_db/v4_feature_list.h" |
7 | 7 |
8 namespace safe_browsing { | 8 namespace safe_browsing { |
9 | 9 |
10 namespace V4FeatureList { | 10 namespace V4FeatureList { |
11 | 11 |
12 namespace { | 12 namespace { |
| 13 |
13 const base::Feature kLocalDatabaseManagerEnabled{ | 14 const base::Feature kLocalDatabaseManagerEnabled{ |
14 "SafeBrowsingV4LocalDatabaseManagerEnabled", | 15 "SafeBrowsingV4LocalDatabaseManagerEnabled", |
15 base::FEATURE_DISABLED_BY_DEFAULT}; | 16 base::FEATURE_DISABLED_BY_DEFAULT}; |
16 | 17 |
17 const base::Feature kV4HybridEnabled{"SafeBrowsingV4HybridEnabled", | |
18 base::FEATURE_DISABLED_BY_DEFAULT}; | |
19 | |
20 const base::Feature kV4OnlyEnabled{"SafeBrowsingV4OnlyEnabled", | 18 const base::Feature kV4OnlyEnabled{"SafeBrowsingV4OnlyEnabled", |
21 base::FEATURE_DISABLED_BY_DEFAULT}; | 19 base::FEATURE_DISABLED_BY_DEFAULT}; |
22 | 20 |
23 } // namespace | 21 bool IsV4OnlyEnabled() { |
| 22 return base::FeatureList::IsEnabled(kV4OnlyEnabled); |
| 23 } |
24 | 24 |
25 bool IsLocalDatabaseManagerEnabled() { | 25 bool IsLocalDatabaseManagerEnabled() { |
26 return base::FeatureList::IsEnabled(kLocalDatabaseManagerEnabled) || | 26 return base::FeatureList::IsEnabled(kLocalDatabaseManagerEnabled) || |
27 IsV4HybridEnabled() || IsV4OnlyEnabled(); | 27 IsV4OnlyEnabled(); |
28 } | 28 } |
29 | 29 |
30 bool IsV4HybridEnabled() { | 30 } // namespace |
31 return base::FeatureList::IsEnabled(kV4HybridEnabled); | |
32 } | |
33 | 31 |
34 bool IsV4OnlyEnabled() { | 32 V4UsageStatus GetV4UsageStatus() { |
35 // TODO(vakh): Enable this only when all the lists can be synced from the | 33 V4UsageStatus v4_usage_status; |
36 // server. See http://b/33182208 | 34 if (safe_browsing::V4FeatureList::IsV4OnlyEnabled()) { |
37 return base::FeatureList::IsEnabled(kV4OnlyEnabled); | 35 v4_usage_status = V4UsageStatus::V4_ONLY; |
| 36 } else if (safe_browsing::V4FeatureList::IsLocalDatabaseManagerEnabled()) { |
| 37 v4_usage_status = V4UsageStatus::V4_INSTANTIATED; |
| 38 } else { |
| 39 v4_usage_status = V4UsageStatus::V4_DISABLED; |
| 40 } |
| 41 return v4_usage_status; |
38 } | 42 } |
39 | 43 |
40 } // namespace V4FeatureList | 44 } // namespace V4FeatureList |
41 | 45 |
42 } // namespace safe_browsing | 46 } // namespace safe_browsing |
OLD | NEW |