summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 01:36:02 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 01:36:02 +0000
commit46b78da34109059413e43febbe1b48385f1f92f1 (patch)
tree4ac506b95e91cae7d2726cd12d273ccc756afd81 /chrome
parentab358b4a63f4f3e9deb079be9718b12012cbbbb6 (diff)
downloadchromium_src-46b78da34109059413e43febbe1b48385f1f92f1.zip
chromium_src-46b78da34109059413e43febbe1b48385f1f92f1.tar.gz
chromium_src-46b78da34109059413e43febbe1b48385f1f92f1.tar.bz2
An empty brand string on Mac is used for channels other than stable, which are
always organic. Refactoring in r104479 (codereview 8136006) erroneously stoped treating empty brand strings as organic, which had the effect of disabling the first run UI on the Mac. This means that there was no search engine selection dialog and no opportunity to choose to enable crash reporting and set Chrome as the default browser. BUG=100659 TEST=Remove the profile (~/Library/Application Support/Google/Chrome or ~/Library/Application Support/Google/Chrome Canary). Launch Chrome or Chrome Canary. Expect to see the search engine selection dialog followed by the "Google Chrome is ready to complete your installation" dialog. Review URL: http://codereview.chromium.org/8329007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105994 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/google/google_update_settings_unittest.cc18
-rw-r--r--chrome/browser/google/google_util.cc52
2 files changed, 38 insertions, 32 deletions
diff --git a/chrome/browser/google/google_update_settings_unittest.cc b/chrome/browser/google/google_update_settings_unittest.cc
index 060ae77..4301a35 100644
--- a/chrome/browser/google/google_update_settings_unittest.cc
+++ b/chrome/browser/google/google_update_settings_unittest.cc
@@ -38,12 +38,14 @@ TEST_F(GoogleUpdateTest, LastRunTime) {
TEST_F(GoogleUpdateTest, ShouldShowSearchEngineDialog) {
// Test some brand codes to ensure that future changes to this method won't
// go unnoticed.
- const char* false_brand1 = "CHFO";
- EXPECT_FALSE(google_util::IsOrganicFirstRun(false_brand1));
- const char* false_brand2 = "CHMA";
- EXPECT_FALSE(google_util::IsOrganicFirstRun(false_brand2));
- const char* good_brand1 = "EUBA";
- EXPECT_TRUE(google_util::IsOrganicFirstRun(good_brand1));
- const char* good_brand2 = "GGRA";
- EXPECT_TRUE(google_util::IsOrganicFirstRun(good_brand2));
+ EXPECT_FALSE(google_util::IsOrganicFirstRun("CHFO"));
+ EXPECT_FALSE(google_util::IsOrganicFirstRun("CHMA"));
+ EXPECT_TRUE(google_util::IsOrganicFirstRun("EUBA"));
+ EXPECT_TRUE(google_util::IsOrganicFirstRun("GGRA"));
+
+#if defined(OS_MACOSX)
+ // An empty brand string on Mac is used for channels other than stable,
+ // which are always organic.
+ EXPECT_TRUE(google_util::IsOrganicFirstRun(""));
+#endif
}
diff --git a/chrome/browser/google/google_util.cc b/chrome/browser/google/google_util.cc
index dd2bb65..9452c78 100644
--- a/chrome/browser/google/google_util.cc
+++ b/chrome/browser/google/google_util.cc
@@ -105,7 +105,7 @@ bool GetReactivationBrand(std::string* brand) {
return ret;
}
-#elif defined(OS_MACOSX)
+#else
bool GetBrand(std::string* brand) {
if (brand_for_testing) {
@@ -113,24 +113,11 @@ bool GetBrand(std::string* brand) {
return true;
}
+#if defined(OS_MACOSX)
brand->assign(keystone_glue::BrandCode());
- return true;
-}
-
-bool GetReactivationBrand(std::string* brand) {
- brand->clear();
- return true;
-}
-
#else
-
-bool GetBrand(std::string* brand) {
- if (brand_for_testing) {
- brand->assign(brand_for_testing);
- return true;
- }
-
brand->clear();
+#endif
return true;
}
@@ -146,20 +133,29 @@ bool IsOrganic(const std::string& brand) {
if (command_line.HasSwitch(switches::kOrganicInstall))
return true;
- static const char* kBrands[] = {
+#if defined(OS_MACOSX)
+ if (brand.empty()) {
+ // An empty brand string on Mac is used for channels other than stable,
+ // which are always organic.
+ return true;
+ }
+#endif
+
+ const char* const kBrands[] = {
"CHFO", "CHFT", "CHHS", "CHHM", "CHMA", "CHMB", "CHME", "CHMF",
"CHMG", "CHMH", "CHMI", "CHMQ", "CHMV", "CHNB", "CHNC", "CHNG",
"CHNH", "CHNI", "CHOA", "CHOB", "CHOC", "CHON", "CHOO", "CHOP",
"CHOQ", "CHOR", "CHOS", "CHOT", "CHOU", "CHOX", "CHOY", "CHOZ",
"CHPD", "CHPE", "CHPF", "CHPG", "EUBB", "EUBC", "GGLA", "GGLS"
};
- const char** end = &kBrands[arraysize(kBrands)];
- const char** found = std::find(&kBrands[0], end, brand);
+ const char* const* end = &kBrands[arraysize(kBrands)];
+ const char* const* found = std::find(&kBrands[0], end, brand);
if (found != end)
return true;
- return (StartsWithASCII(brand, "EUB", true) ||
- StartsWithASCII(brand, "EUC", true) ||
- StartsWithASCII(brand, "GGR", true));
+
+ return StartsWithASCII(brand, "EUB", true) ||
+ StartsWithASCII(brand, "EUC", true) ||
+ StartsWithASCII(brand, "GGR", true);
}
bool IsOrganicFirstRun(const std::string& brand) {
@@ -168,8 +164,16 @@ bool IsOrganicFirstRun(const std::string& brand) {
if (command_line.HasSwitch(switches::kOrganicInstall))
return true;
- return (StartsWithASCII(brand, "GG", true) ||
- StartsWithASCII(brand, "EU", true));
+#if defined(OS_MACOSX)
+ if (brand.empty()) {
+ // An empty brand string on Mac is used for channels other than stable,
+ // which are always organic.
+ return true;
+ }
+#endif
+
+ return StartsWithASCII(brand, "GG", true) ||
+ StartsWithASCII(brand, "EU", true);
}
} // namespace google_util