Chromium Code Reviews| 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 "components/safe_browsing_db/v4_feature_list.h" | |
|
Jialiu Lin
2017/07/06 23:58:27
nit: empty line after #5
hkamila
2017/07/07 01:29:50
Acknowledged.
| |
| 5 #include "base/feature_list.h" | 6 #include "base/feature_list.h" |
| 6 #include "components/safe_browsing_db/v4_feature_list.h" | 7 #include "components/safe_browsing/features.h" |
| 7 | 8 |
| 8 namespace safe_browsing { | 9 namespace safe_browsing { |
| 9 | 10 |
| 10 namespace V4FeatureList { | 11 namespace V4FeatureList { |
| 11 | 12 |
| 12 namespace { | |
| 13 | |
| 14 const base::Feature kLocalDatabaseManagerEnabled{ | |
| 15 "SafeBrowsingV4LocalDatabaseManagerEnabled", | |
| 16 base::FEATURE_DISABLED_BY_DEFAULT}; | |
| 17 | |
| 18 const base::Feature kV4OnlyEnabled{"SafeBrowsingV4OnlyEnabled", | |
| 19 base::FEATURE_DISABLED_BY_DEFAULT}; | |
| 20 | |
| 21 bool IsV4OnlyEnabled() { | 13 bool IsV4OnlyEnabled() { |
| 22 return base::FeatureList::IsEnabled(kV4OnlyEnabled); | 14 return base::FeatureList::IsEnabled(kV4OnlyEnabled); |
| 23 } | 15 } |
| 24 | 16 |
| 25 bool IsLocalDatabaseManagerEnabled() { | 17 bool IsLocalDatabaseManagerEnabled() { |
| 26 return base::FeatureList::IsEnabled(kLocalDatabaseManagerEnabled) || | 18 return base::FeatureList::IsEnabled(kLocalDatabaseManagerEnabled) || |
| 27 IsV4OnlyEnabled(); | 19 IsV4OnlyEnabled(); |
| 28 } | 20 } |
| 29 | 21 |
| 30 } // namespace | |
| 31 | |
| 32 V4UsageStatus GetV4UsageStatus() { | 22 V4UsageStatus GetV4UsageStatus() { |
| 33 V4UsageStatus v4_usage_status; | 23 V4UsageStatus v4_usage_status; |
| 34 if (safe_browsing::V4FeatureList::IsV4OnlyEnabled()) { | 24 if (safe_browsing::V4FeatureList::IsV4OnlyEnabled()) { |
| 35 v4_usage_status = V4UsageStatus::V4_ONLY; | 25 v4_usage_status = V4UsageStatus::V4_ONLY; |
| 36 } else if (safe_browsing::V4FeatureList::IsLocalDatabaseManagerEnabled()) { | 26 } else if (safe_browsing::V4FeatureList::IsLocalDatabaseManagerEnabled()) { |
| 37 v4_usage_status = V4UsageStatus::V4_INSTANTIATED; | 27 v4_usage_status = V4UsageStatus::V4_INSTANTIATED; |
| 38 } else { | 28 } else { |
| 39 v4_usage_status = V4UsageStatus::V4_DISABLED; | 29 v4_usage_status = V4UsageStatus::V4_DISABLED; |
| 40 } | 30 } |
| 41 return v4_usage_status; | 31 return v4_usage_status; |
| 42 } | 32 } |
| 43 | 33 |
| 44 } // namespace V4FeatureList | 34 } // namespace V4FeatureList |
| 45 | 35 |
| 46 } // namespace safe_browsing | 36 } // namespace safe_browsing |
| OLD | NEW |