OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/google/google_brand.h" | 5 #include "chrome/browser/google/google_brand.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 | 9 |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 "CHOQ", "CHOR", "CHOS", "CHOT", "CHOU", "CHOX", "CHOY", "CHOZ", | 96 "CHOQ", "CHOR", "CHOS", "CHOT", "CHOU", "CHOX", "CHOY", "CHOZ", |
97 "CHPD", "CHPE", "CHPF", "CHPG", "ECBA", "ECBB", "ECDA", "ECDB", | 97 "CHPD", "CHPE", "CHPF", "CHPG", "ECBA", "ECBB", "ECDA", "ECDB", |
98 "ECSA", "ECSB", "ECVA", "ECVB", "ECWA", "ECWB", "ECWC", "ECWD", | 98 "ECSA", "ECSB", "ECVA", "ECVB", "ECWA", "ECWB", "ECWC", "ECWD", |
99 "ECWE", "ECWF", "EUBB", "EUBC", "GGLA", "GGLS" | 99 "ECWE", "ECWF", "EUBB", "EUBC", "GGLA", "GGLS" |
100 }; | 100 }; |
101 const char* const* end = &kBrands[arraysize(kBrands)]; | 101 const char* const* end = &kBrands[arraysize(kBrands)]; |
102 const char* const* found = std::find(&kBrands[0], end, brand); | 102 const char* const* found = std::find(&kBrands[0], end, brand); |
103 if (found != end) | 103 if (found != end) |
104 return true; | 104 return true; |
105 | 105 |
106 return base::StartsWithASCII(brand, "EUB", true) || | 106 return base::StartsWith(brand, "EUB", base::CompareCase::SENSITIVE) || |
107 base::StartsWithASCII(brand, "EUC", true) || | 107 base::StartsWith(brand, "EUC", base::CompareCase::SENSITIVE) || |
108 base::StartsWithASCII(brand, "GGR", true); | 108 base::StartsWith(brand, "GGR", base::CompareCase::SENSITIVE); |
109 } | 109 } |
110 | 110 |
111 bool IsOrganicFirstRun(const std::string& brand) { | 111 bool IsOrganicFirstRun(const std::string& brand) { |
112 #if defined(OS_MACOSX) | 112 #if defined(OS_MACOSX) |
113 if (brand.empty()) { | 113 if (brand.empty()) { |
114 // An empty brand string on Mac is used for channels other than stable, | 114 // An empty brand string on Mac is used for channels other than stable, |
115 // which are always organic. | 115 // which are always organic. |
116 return true; | 116 return true; |
117 } | 117 } |
118 #endif | 118 #endif |
119 | 119 |
120 return base::StartsWithASCII(brand, "GG", true) || | 120 return base::StartsWith(brand, "GG", base::CompareCase::SENSITIVE) || |
121 base::StartsWithASCII(brand, "EU", true); | 121 base::StartsWith(brand, "EU", base::CompareCase::SENSITIVE); |
122 } | 122 } |
123 | 123 |
124 bool IsInternetCafeBrandCode(const std::string& brand) { | 124 bool IsInternetCafeBrandCode(const std::string& brand) { |
125 const char* const kBrands[] = { | 125 const char* const kBrands[] = { |
126 "CHIQ", "CHSG", "HLJY", "NTMO", "OOBA", "OOBB", "OOBC", "OOBD", "OOBE", | 126 "CHIQ", "CHSG", "HLJY", "NTMO", "OOBA", "OOBB", "OOBC", "OOBD", "OOBE", |
127 "OOBF", "OOBG", "OOBH", "OOBI", "OOBJ", "IDCM", | 127 "OOBF", "OOBG", "OOBH", "OOBI", "OOBJ", "IDCM", |
128 }; | 128 }; |
129 const char* const* end = &kBrands[arraysize(kBrands)]; | 129 const char* const* end = &kBrands[arraysize(kBrands)]; |
130 const char* const* found = std::find(&kBrands[0], end, brand); | 130 const char* const* found = std::find(&kBrands[0], end, brand); |
131 return found != end; | 131 return found != end; |
132 } | 132 } |
133 | 133 |
134 // BrandForTesting ------------------------------------------------------------ | 134 // BrandForTesting ------------------------------------------------------------ |
135 | 135 |
136 BrandForTesting::BrandForTesting(const std::string& brand) : brand_(brand) { | 136 BrandForTesting::BrandForTesting(const std::string& brand) : brand_(brand) { |
137 DCHECK(g_brand_for_testing == NULL); | 137 DCHECK(g_brand_for_testing == NULL); |
138 g_brand_for_testing = brand_.c_str(); | 138 g_brand_for_testing = brand_.c_str(); |
139 } | 139 } |
140 | 140 |
141 BrandForTesting::~BrandForTesting() { | 141 BrandForTesting::~BrandForTesting() { |
142 g_brand_for_testing = NULL; | 142 g_brand_for_testing = NULL; |
143 } | 143 } |
144 | 144 |
145 | 145 |
146 } // namespace google_brand | 146 } // namespace google_brand |
OLD | NEW |