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

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

Issue 2814083002: Make the GGRV brand code non-organic. (Closed)
Patch Set: Address review comments Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/google/google_update_settings_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 bool IsOrganic(const std::string& brand) { 84 bool IsOrganic(const std::string& brand) {
85 #if defined(OS_MACOSX) 85 #if defined(OS_MACOSX)
86 if (brand.empty()) { 86 if (brand.empty()) {
87 // An empty brand string on Mac is used for channels other than stable, 87 // An empty brand string on Mac is used for channels other than stable,
88 // which are always organic. 88 // which are always organic.
89 return true; 89 return true;
90 } 90 }
91 #endif 91 #endif
92 92
93 const char* const kBrands[] = { 93 const char* const kOrganicBrands[] = {
94 "CHCA", "CHCB", "CHCG", "CHCH", "CHCI", "CHCJ", "CHCK", "CHCL", 94 "CHCA", "CHCB", "CHCG", "CHCH", "CHCI", "CHCJ", "CHCK", "CHCL", "CHFO",
95 "CHFO", "CHFT", "CHHS", "CHHM", "CHMA", "CHMB", "CHME", "CHMF", 95 "CHFT", "CHHS", "CHHM", "CHMA", "CHMB", "CHME", "CHMF", "CHMG", "CHMH",
96 "CHMG", "CHMH", "CHMI", "CHMQ", "CHMV", "CHNB", "CHNC", "CHNG", 96 "CHMI", "CHMQ", "CHMV", "CHNB", "CHNC", "CHNG", "CHNH", "CHNI", "CHOA",
97 "CHNH", "CHNI", "CHOA", "CHOB", "CHOC", "CHON", "CHOO", "CHOP", 97 "CHOB", "CHOC", "CHON", "CHOO", "CHOP", "CHOQ", "CHOR", "CHOS", "CHOT",
98 "CHOQ", "CHOR", "CHOS", "CHOT", "CHOU", "CHOX", "CHOY", "CHOZ", 98 "CHOU", "CHOX", "CHOY", "CHOZ", "CHPD", "CHPE", "CHPF", "CHPG", "ECBA",
99 "CHPD", "CHPE", "CHPF", "CHPG", "ECBA", "ECBB", "ECDA", "ECDB", 99 "ECBB", "ECDA", "ECDB", "ECSA", "ECSB", "ECVA", "ECVB", "ECWA", "ECWB",
100 "ECSA", "ECSB", "ECVA", "ECVB", "ECWA", "ECWB", "ECWC", "ECWD", 100 "ECWC", "ECWD", "ECWE", "ECWF", "EUBB", "EUBC", "GGLA", "GGLS"};
101 "ECWE", "ECWF", "EUBB", "EUBC", "GGLA", "GGLS" 101 const char* const* end = &kOrganicBrands[arraysize(kOrganicBrands)];
102 }; 102 if (std::binary_search(&kOrganicBrands[0], end, brand))
103 const char* const* end = &kBrands[arraysize(kBrands)];
104 const char* const* found = std::find(&kBrands[0], end, brand);
105 if (found != end)
106 return true; 103 return true;
107 104
105 // The Chrome enterprise brand code is the only GGR* brand to be non-organic.
106 if (brand == "GGRV")
107 return false;
108
108 return base::StartsWith(brand, "EUB", base::CompareCase::SENSITIVE) || 109 return base::StartsWith(brand, "EUB", base::CompareCase::SENSITIVE) ||
109 base::StartsWith(brand, "EUC", base::CompareCase::SENSITIVE) || 110 base::StartsWith(brand, "EUC", base::CompareCase::SENSITIVE) ||
110 base::StartsWith(brand, "GGR", base::CompareCase::SENSITIVE); 111 base::StartsWith(brand, "GGR", base::CompareCase::SENSITIVE);
111 } 112 }
112 113
113 bool IsOrganicFirstRun(const std::string& brand) { 114 bool IsOrganicFirstRun(const std::string& brand) {
114 #if defined(OS_MACOSX) 115 #if defined(OS_MACOSX)
115 if (brand.empty()) { 116 if (brand.empty()) {
116 // An empty brand string on Mac is used for channels other than stable, 117 // An empty brand string on Mac is used for channels other than stable,
117 // which are always organic. 118 // which are always organic.
(...skipping 21 matching lines...) Expand all
139 DCHECK(g_brand_for_testing == NULL); 140 DCHECK(g_brand_for_testing == NULL);
140 g_brand_for_testing = brand_.c_str(); 141 g_brand_for_testing = brand_.c_str();
141 } 142 }
142 143
143 BrandForTesting::~BrandForTesting() { 144 BrandForTesting::~BrandForTesting() {
144 g_brand_for_testing = NULL; 145 g_brand_for_testing = NULL;
145 } 146 }
146 147
147 148
148 } // namespace google_brand 149 } // namespace google_brand
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/google/google_update_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698