| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/net/async_dns_field_trial.h" | 5 #include "chrome/browser/net/async_dns_field_trial.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #else | 72 #else |
| 73 const bool kDefault = false; | 73 const bool kDefault = false; |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 // Configure the AsyncDns field trial as follows: | 76 // Configure the AsyncDns field trial as follows: |
| 77 // groups AsyncDnsA and AsyncDnsB: return true, | 77 // groups AsyncDnsA and AsyncDnsB: return true, |
| 78 // groups SystemDnsA and SystemDnsB: return false, | 78 // groups SystemDnsA and SystemDnsB: return false, |
| 79 // otherwise (trial absent): return default. | 79 // otherwise (trial absent): return default. |
| 80 std::string group_name = base::FieldTrialList::FindFullName("AsyncDns"); | 80 std::string group_name = base::FieldTrialList::FindFullName("AsyncDns"); |
| 81 if (!group_name.empty()) { | 81 if (!group_name.empty()) { |
| 82 const bool enabled = base::StartsWithASCII(group_name, "AsyncDns", | 82 const bool enabled = base::StartsWith(group_name, "AsyncDns", |
| 83 false /* case_sensitive */); | 83 base::CompareCase::INSENSITIVE_ASCII); |
| 84 HistogramPrefDefaultSource(FIELD_TRIAL, enabled); | 84 HistogramPrefDefaultSource(FIELD_TRIAL, enabled); |
| 85 return enabled; | 85 return enabled; |
| 86 } | 86 } |
| 87 HistogramPrefDefaultSource(HARD_CODED_DEFAULT, kDefault); | 87 HistogramPrefDefaultSource(HARD_CODED_DEFAULT, kDefault); |
| 88 return kDefault; | 88 return kDefault; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void LogAsyncDnsPrefSource(const PrefService::Preference* pref) { | 91 void LogAsyncDnsPrefSource(const PrefService::Preference* pref) { |
| 92 CHECK(pref); | 92 CHECK(pref); |
| 93 | 93 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 104 HistogramPrefSource(EXTENSION_PREF, enabled); | 104 HistogramPrefSource(EXTENSION_PREF, enabled); |
| 105 else if (pref->IsUserControlled()) | 105 else if (pref->IsUserControlled()) |
| 106 HistogramPrefSource(USER_PREF, enabled); | 106 HistogramPrefSource(USER_PREF, enabled); |
| 107 else if (pref->IsDefaultValue()) | 107 else if (pref->IsDefaultValue()) |
| 108 HistogramPrefSource(DEFAULT_PREF, enabled); | 108 HistogramPrefSource(DEFAULT_PREF, enabled); |
| 109 else | 109 else |
| 110 HistogramPrefSource(UNKNOWN_PREF, enabled); | 110 HistogramPrefSource(UNKNOWN_PREF, enabled); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace chrome_browser_net | 113 } // namespace chrome_browser_net |
| OLD | NEW |