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

Side by Side Diff: chrome/installer/util/google_chrome_distribution.cc

Issue 10802063: Fix two bugs in the toast (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file defines specific implementation of BrowserDistribution class for 5 // This file defines specific implementation of BrowserDistribution class for
6 // Google Chrome. 6 // Google Chrome.
7 7
8 #include "chrome/installer/util/google_chrome_distribution.h" 8 #include "chrome/installer/util/google_chrome_distribution.h"
9 9
10 #include <vector> 10 #include <vector>
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 // The experiment with the more compact bubble. This one is a bit special 642 // The experiment with the more compact bubble. This one is a bit special
643 // because it is split into two: CAxx is regular style bubble and CBxx is 643 // because it is split into two: CAxx is regular style bubble and CBxx is
644 // compact style bubble. See |compact_bubble| below. 644 // compact style bubble. See |compact_bubble| below.
645 {L"en-US", kBrief, 1, L'C', L'A', 2, { kEnUs3, kEnUs3, 0, 0 } }, 645 {L"en-US", kBrief, 1, L'C', L'A', 2, { kEnUs3, kEnUs3, 0, 0 } },
646 646
647 // Catch-all rules. 647 // Catch-all rules.
648 {kAll, kAll, 1, L'B', L'A', 1, {kEnUs3, 0, 0, 0} }, 648 {kAll, kAll, 1, L'B', L'A', 1, {kEnUs3, 0, 0, 0} },
649 }; 649 };
650 650
651 string16 locale; 651 string16 locale;
652 GoogleUpdateSettings::GetLanguage(&locale);
653 if (locale.empty() || (locale == ASCIIToWide("en")))
654 locale = ASCIIToWide("en-US");
655
652 string16 brand; 656 string16 brand;
653
654 if (!GoogleUpdateSettings::GetLanguage(&locale))
655 locale = ASCIIToWide("en-US");
656 if (!GoogleUpdateSettings::GetBrand(&brand)) 657 if (!GoogleUpdateSettings::GetBrand(&brand))
657 brand = ASCIIToWide(""); // Could still be viable for catch-all rules. 658 brand = ASCIIToWide(""); // Could still be viable for catch-all rules.
658 if (brand == kEnterprise) 659 if (brand == kEnterprise)
659 return false; 660 return false;
660 661
661 for (int i = 0; i < arraysize(kExperimentFlavors); ++i) { 662 for (int i = 0; i < arraysize(kExperimentFlavors); ++i) {
662 // A maximum of four flavors are supported at the moment. 663 // A maximum of four flavors are supported at the moment.
663 DCHECK_LE(kExperimentFlavors[i].flavors, kMax); 664 CHECK_LE(kExperimentFlavors[i].flavors, kMax);
664 DCHECK_GT(kExperimentFlavors[i].flavors, 0); 665 CHECK_GT(kExperimentFlavors[i].flavors, 0);
665 // Make sure each experiment has valid headings. 666 // Make sure each experiment has valid headings.
666 for (int f = 0; f < kMax; ++f) { 667 for (int f = 0; f < kMax; ++f) {
667 if (f < kExperimentFlavors[i].flavors) { 668 if (f < kExperimentFlavors[i].flavors) {
668 DCHECK_GT(kExperimentFlavors[i].headings[f], 0); 669 CHECK_GT(kExperimentFlavors[i].headings[f], 0);
669 } else { 670 } else {
670 DCHECK_EQ(kExperimentFlavors[i].headings[f], 0); 671 CHECK_EQ(kExperimentFlavors[i].headings[f], 0);
671 } 672 }
672 } 673 }
673 // Make sure we don't overflow on the second letter of the experiment code. 674 // The prefix has to be a valid two letter combo.
674 DCHECK(kExperimentFlavors[i].prefix2 + 675 CHECK(kExperimentFlavors[i].prefix1 >= 'A');
675 kExperimentFlavors[i].flavors - 1 <= 'Z'); 676 CHECK(kExperimentFlavors[i].prefix2 >= 'A');
677 CHECK(kExperimentFlavors[i].prefix2 +
678 kExperimentFlavors[i].flavors - 1 <= 'Z');
676 679
677 if (kExperimentFlavors[i].locale != locale && 680 if (kExperimentFlavors[i].locale != locale &&
678 kExperimentFlavors[i].locale != ASCIIToWide("*")) 681 kExperimentFlavors[i].locale != ASCIIToWide("*"))
679 continue; 682 continue;
680 683
681 std::vector<string16> brand_codes; 684 std::vector<string16> brand_codes;
682 base::SplitString(kExperimentFlavors[i].brands, L',', &brand_codes); 685 base::SplitString(kExperimentFlavors[i].brands, L',', &brand_codes);
683 if (brand_codes.empty()) 686 if (brand_codes.empty())
684 return false; 687 return false;
685 for (std::vector<string16>::iterator it = brand_codes.begin(); 688 for (std::vector<string16>::iterator it = brand_codes.begin();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 return; 747 return;
745 } 748 }
746 int flavor = experiment.flavor; 749 int flavor = experiment.flavor;
747 string16 base_group = experiment.prefix; 750 string16 base_group = experiment.prefix;
748 751
749 string16 brand; 752 string16 brand;
750 if (GoogleUpdateSettings::GetBrand(&brand) && (brand == L"CHXX")) { 753 if (GoogleUpdateSettings::GetBrand(&brand) && (brand == L"CHXX")) {
751 // Testing only: the user automatically qualifies for the experiment. 754 // Testing only: the user automatically qualifies for the experiment.
752 VLOG(1) << "Experiment qualification bypass"; 755 VLOG(1) << "Experiment qualification bypass";
753 } else { 756 } else {
757 // Check that the user was not already drafted in this experiment.
758 string16 client;
759 GoogleUpdateSettings::GetClient(&client);
760 if (client.size() > 2) {
761 if (base_group == client.substr(0, 2)) {
Finnur 2012/07/25 10:51:10 nit: Probably more readable to combine these into
762 VLOG(1) << "User already participated in this experiment";
763 return;
Finnur 2012/07/25 10:51:10 Are you intentionally setting no results for Omaha
764 }
765 }
754 // Check browser usage inactivity by the age of the last-write time of the 766 // Check browser usage inactivity by the age of the last-write time of the
755 // chrome user data directory. 767 // chrome user data directory.
756 FilePath user_data_dir(product.GetUserDataPath()); 768 FilePath user_data_dir(product.GetUserDataPath());
757 769
758 const bool experiment_enabled = false; 770 const bool experiment_enabled = false;
759 const int kThirtyDays = 30 * 24; 771 const int kThirtyDays = 30 * 24;
760 772
761 int dir_age_hours = GetDirectoryWriteAgeInHours( 773 int dir_age_hours = GetDirectoryWriteAgeInHours(
762 user_data_dir.value().c_str()); 774 user_data_dir.value().c_str());
763 if (!experiment_enabled) { 775 if (!experiment_enabled) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 // we waited for chrome to exit so the uninstall would not detect chrome 862 // we waited for chrome to exit so the uninstall would not detect chrome
851 // running. 863 // running.
852 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( 864 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch(
853 installer::switches::kSystemLevelToast); 865 installer::switches::kSystemLevelToast);
854 866
855 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast, 867 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast,
856 GetType())); 868 GetType()));
857 base::LaunchProcess(cmd, base::LaunchOptions(), NULL); 869 base::LaunchProcess(cmd, base::LaunchOptions(), NULL);
858 } 870 }
859 #endif 871 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698