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

Side by Side Diff: chrome/browser/google/google_brand.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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
OLDNEW
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
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 StartsWithASCII(brand, "EUB", true) || 106 return base::StartsWithASCII(brand, "EUB", true) ||
107 StartsWithASCII(brand, "EUC", true) || 107 base::StartsWithASCII(brand, "EUC", true) ||
108 StartsWithASCII(brand, "GGR", true); 108 base::StartsWithASCII(brand, "GGR", true);
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 StartsWithASCII(brand, "GG", true) || 120 return base::StartsWithASCII(brand, "GG", true) ||
121 StartsWithASCII(brand, "EU", true); 121 base::StartsWithASCII(brand, "EU", true);
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/isolated_app_browsertest.cc ('k') | chrome/browser/local_discovery/device_description.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698