| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/installer/util/user_experiment.h" | 5 #include "chrome/installer/util/user_experiment.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <sddl.h> | 8 #include <sddl.h> |
| 9 #include <wtsapi32.h> | 9 #include <wtsapi32.h> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 348 |
| 349 base::string16 brand; | 349 base::string16 brand; |
| 350 if (!GoogleUpdateSettings::GetBrand(&brand)) | 350 if (!GoogleUpdateSettings::GetBrand(&brand)) |
| 351 brand.clear(); // Could still be viable for catch-all rules | 351 brand.clear(); // Could still be viable for catch-all rules |
| 352 | 352 |
| 353 for (int i = 0; i < arraysize(kExperiments); ++i) { | 353 for (int i = 0; i < arraysize(kExperiments); ++i) { |
| 354 base::string16 experiment_locale = kExperiments[i].locale; | 354 base::string16 experiment_locale = kExperiments[i].locale; |
| 355 if (experiment_locale != locale && experiment_locale != L"*") | 355 if (experiment_locale != locale && experiment_locale != L"*") |
| 356 continue; | 356 continue; |
| 357 | 357 |
| 358 std::vector<base::string16> brand_codes; | 358 for (const base::string16& cur : base::SplitString( |
| 359 base::SplitString(kExperiments[i].brands, L',', &brand_codes); | 359 kExperiments[i].brands, L",", |
| 360 if (brand_codes.empty()) | 360 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
| 361 return false; | 361 if (cur != brand && cur != L"*") |
| 362 for (std::vector<base::string16>::iterator it = brand_codes.begin(); | |
| 363 it != brand_codes.end(); ++it) { | |
| 364 if (*it != brand && *it != L"*") | |
| 365 continue; | 362 continue; |
| 366 // We have found our match. | 363 // We have found our match. |
| 367 const UserExperimentSpecs& match = kExperiments[i]; | 364 const UserExperimentSpecs& match = kExperiments[i]; |
| 368 // Find out how many flavors we have. Zero means no experiment. | 365 // Find out how many flavors we have. Zero means no experiment. |
| 369 int num_flavors = 0; | 366 int num_flavors = 0; |
| 370 while (match.flavors[num_flavors].heading_id) { ++num_flavors; } | 367 while (match.flavors[num_flavors].heading_id) { ++num_flavors; } |
| 371 if (!num_flavors) | 368 if (!num_flavors) |
| 372 return false; | 369 return false; |
| 373 | 370 |
| 374 if (flavor < 0) | 371 if (flavor < 0) |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 // running. | 528 // running. |
| 532 bool system_level_toast = base::CommandLine::ForCurrentProcess()->HasSwitch( | 529 bool system_level_toast = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 533 switches::kSystemLevelToast); | 530 switches::kSystemLevelToast); |
| 534 | 531 |
| 535 base::CommandLine cmd(InstallUtil::GetChromeUninstallCmd( | 532 base::CommandLine cmd(InstallUtil::GetChromeUninstallCmd( |
| 536 system_level_toast, product.distribution()->GetType())); | 533 system_level_toast, product.distribution()->GetType())); |
| 537 base::LaunchProcess(cmd, base::LaunchOptions()); | 534 base::LaunchProcess(cmd, base::LaunchOptions()); |
| 538 } | 535 } |
| 539 | 536 |
| 540 } // namespace installer | 537 } // namespace installer |
| OLD | NEW |