| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <windows.h> | 10 #include <windows.h> |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // If system_level_toast is true, appends --system-level-toast. | 133 // If system_level_toast is true, appends --system-level-toast. |
| 134 // If handle to experiment result key was given at startup, re-add it. | 134 // If handle to experiment result key was given at startup, re-add it. |
| 135 // Does not wait for the process to terminate. | 135 // Does not wait for the process to terminate. |
| 136 bool RelaunchSetup(const std::string& flag, int value, | 136 bool RelaunchSetup(const std::string& flag, int value, |
| 137 bool system_level_toast) { | 137 bool system_level_toast) { |
| 138 CommandLine new_cmd_line(CommandLine::ForCurrentProcess()->GetProgram()); | 138 CommandLine new_cmd_line(CommandLine::ForCurrentProcess()->GetProgram()); |
| 139 new_cmd_line.AppendSwitchASCII(flag, base::IntToString(value)); | 139 new_cmd_line.AppendSwitchASCII(flag, base::IntToString(value)); |
| 140 | 140 |
| 141 // Re-add the system level toast flag. | 141 // Re-add the system level toast flag. |
| 142 if (system_level_toast) { | 142 if (system_level_toast) { |
| 143 new_cmd_line.AppendSwitch(installer::switches::kSystemLevelToast); | 143 new_cmd_line.AppendSwitch(installer_util::switches::kSystemLevelToast); |
| 144 | 144 |
| 145 // Re-add the toast result key. We need to do this because Setup running as | 145 // Re-add the toast result key. We need to do this because Setup running as |
| 146 // system passes the key to Setup running as user, but that child process | 146 // system passes the key to Setup running as user, but that child process |
| 147 // does not perform the actual toasting, it launches another Setup (as user) | 147 // does not perform the actual toasting, it launches another Setup (as user) |
| 148 // to do so. That is the process that needs the key. | 148 // to do so. That is the process that needs the key. |
| 149 const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess(); | 149 const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess(); |
| 150 std::string key(installer::switches::kToastResultsKey); | 150 std::string key(installer_util::switches::kToastResultsKey); |
| 151 std::string toast_key = current_cmd_line.GetSwitchValueASCII(key); | 151 std::string toast_key = current_cmd_line.GetSwitchValueASCII(key); |
| 152 if (!toast_key.empty()) { | 152 if (!toast_key.empty()) { |
| 153 new_cmd_line.AppendSwitchASCII(key, toast_key); | 153 new_cmd_line.AppendSwitchASCII(key, toast_key); |
| 154 | 154 |
| 155 // Use handle inheritance to make sure the duplicated toast results key | 155 // Use handle inheritance to make sure the duplicated toast results key |
| 156 // gets inherited by the child process. | 156 // gets inherited by the child process. |
| 157 return base::LaunchAppWithHandleInheritance( | 157 return base::LaunchAppWithHandleInheritance( |
| 158 new_cmd_line.command_line_string(), false, false, NULL); | 158 new_cmd_line.command_line_string(), false, false, NULL); |
| 159 } | 159 } |
| 160 } | 160 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 // Remote Desktop sessions do not count as interactive sessions; running this | 218 // Remote Desktop sessions do not count as interactive sessions; running this |
| 219 // method as a user logged in via remote desktop will do nothing. | 219 // method as a user logged in via remote desktop will do nothing. |
| 220 bool RelaunchSetupAsConsoleUser(const std::string& flag) { | 220 bool RelaunchSetupAsConsoleUser(const std::string& flag) { |
| 221 FilePath setup_exe = CommandLine::ForCurrentProcess()->GetProgram(); | 221 FilePath setup_exe = CommandLine::ForCurrentProcess()->GetProgram(); |
| 222 CommandLine cmd_line(setup_exe); | 222 CommandLine cmd_line(setup_exe); |
| 223 cmd_line.AppendSwitch(flag); | 223 cmd_line.AppendSwitch(flag); |
| 224 | 224 |
| 225 // Get the Google Update results key, and pass it on the command line to | 225 // Get the Google Update results key, and pass it on the command line to |
| 226 // the child process. | 226 // the child process. |
| 227 int key = GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey(); | 227 int key = GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey(); |
| 228 cmd_line.AppendSwitchASCII(installer::switches::kToastResultsKey, | 228 cmd_line.AppendSwitchASCII(installer_util::switches::kToastResultsKey, |
| 229 base::IntToString(key)); | 229 base::IntToString(key)); |
| 230 | 230 |
| 231 if (base::win::GetVersion() > base::win::VERSION_XP) { | 231 if (base::win::GetVersion() > base::win::VERSION_XP) { |
| 232 // Make sure that in Vista and Above we have the proper DACLs so | 232 // Make sure that in Vista and Above we have the proper DACLs so |
| 233 // the interactive user can launch it. | 233 // the interactive user can launch it. |
| 234 if (!FixDACLsForExecute(setup_exe.ToWStringHack().c_str())) | 234 if (!FixDACLsForExecute(setup_exe.ToWStringHack().c_str())) |
| 235 NOTREACHED(); | 235 NOTREACHED(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 DWORD console_id = ::WTSGetActiveConsoleSessionId(); | 238 DWORD console_id = ::WTSGetActiveConsoleSessionId(); |
| 239 if (console_id == 0xFFFFFFFF) | 239 if (console_id == 0xFFFFFFFF) |
| 240 return false; | 240 return false; |
| 241 HANDLE user_token; | 241 HANDLE user_token; |
| 242 if (!::WTSQueryUserToken(console_id, &user_token)) | 242 if (!::WTSQueryUserToken(console_id, &user_token)) |
| 243 return false; | 243 return false; |
| 244 // Note: Handle inheritance must be true in order for the child process to be | 244 // Note: Handle inheritance must be true in order for the child process to be |
| 245 // able to use the duplicated handle above (Google Update results). | 245 // able to use the duplicated handle above (Google Update results). |
| 246 bool launched = base::LaunchAppAsUser(user_token, | 246 bool launched = base::LaunchAppAsUser(user_token, |
| 247 cmd_line.command_line_string(), | 247 cmd_line.command_line_string(), |
| 248 false, NULL, true, true); | 248 false, NULL, true, true); |
| 249 ::CloseHandle(user_token); | 249 ::CloseHandle(user_token); |
| 250 return launched; | 250 return launched; |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace | 253 } // namespace |
| 254 | 254 |
| 255 GoogleChromeDistribution::GoogleChromeDistribution( | 255 GoogleChromeDistribution::GoogleChromeDistribution( |
| 256 const installer::MasterPreferences& prefs) | 256 const installer_util::MasterPreferences& prefs) |
| 257 : BrowserDistribution(prefs), product_guid_(kChromeGuid) { | 257 : BrowserDistribution(prefs), product_guid_(kChromeGuid) { |
| 258 } | 258 } |
| 259 | 259 |
| 260 // The functions below are not used by the 64-bit Windows binary - | 260 // The functions below are not used by the 64-bit Windows binary - |
| 261 // see the comment in google_chrome_distribution_dummy.cc | 261 // see the comment in google_chrome_distribution_dummy.cc |
| 262 #ifndef _WIN64 | 262 #ifndef _WIN64 |
| 263 bool GoogleChromeDistribution::BuildUninstallMetricsString( | 263 bool GoogleChromeDistribution::BuildUninstallMetricsString( |
| 264 DictionaryValue* uninstall_metrics_dict, std::wstring* metrics) { | 264 DictionaryValue* uninstall_metrics_dict, std::wstring* metrics) { |
| 265 DCHECK(NULL != metrics); | 265 DCHECK(NULL != metrics); |
| 266 bool has_values = false; | 266 bool has_values = false; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // Make sure that the user wants us reporting metrics. If not, don't | 303 // Make sure that the user wants us reporting metrics. If not, don't |
| 304 // add our uninstall metrics. | 304 // add our uninstall metrics. |
| 305 bool metrics_reporting_enabled = false; | 305 bool metrics_reporting_enabled = false; |
| 306 if (!root.GetBoolean(prefs::kMetricsReportingEnabled, | 306 if (!root.GetBoolean(prefs::kMetricsReportingEnabled, |
| 307 &metrics_reporting_enabled) || | 307 &metrics_reporting_enabled) || |
| 308 !metrics_reporting_enabled) { | 308 !metrics_reporting_enabled) { |
| 309 return false; | 309 return false; |
| 310 } | 310 } |
| 311 | 311 |
| 312 DictionaryValue* uninstall_metrics_dict; | 312 DictionaryValue* uninstall_metrics_dict; |
| 313 if (!root.HasKey(installer::kUninstallMetricsName) || | 313 if (!root.HasKey(installer_util::kUninstallMetricsName) || |
| 314 !root.GetDictionary(installer::kUninstallMetricsName, | 314 !root.GetDictionary(installer_util::kUninstallMetricsName, |
| 315 &uninstall_metrics_dict)) { | 315 &uninstall_metrics_dict)) { |
| 316 return false; | 316 return false; |
| 317 } | 317 } |
| 318 | 318 |
| 319 if (!BuildUninstallMetricsString(uninstall_metrics_dict, | 319 if (!BuildUninstallMetricsString(uninstall_metrics_dict, |
| 320 uninstall_metrics_string)) { | 320 uninstall_metrics_string)) { |
| 321 return false; | 321 return false; |
| 322 } | 322 } |
| 323 | 323 |
| 324 return true; | 324 return true; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 // allows us to escape from the Job object so the applet will close. | 377 // allows us to escape from the Job object so the applet will close. |
| 378 installer::WMIProcess::Launch(command, &pid); | 378 installer::WMIProcess::Launch(command, &pid); |
| 379 } | 379 } |
| 380 | 380 |
| 381 std::wstring GoogleChromeDistribution::GetAppGuid() { | 381 std::wstring GoogleChromeDistribution::GetAppGuid() { |
| 382 return product_guid(); | 382 return product_guid(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 std::wstring GoogleChromeDistribution::GetApplicationName() { | 385 std::wstring GoogleChromeDistribution::GetApplicationName() { |
| 386 const std::wstring& product_name = | 386 const std::wstring& product_name = |
| 387 installer::GetLocalizedString(IDS_PRODUCT_NAME_BASE); | 387 installer_util::GetLocalizedString(IDS_PRODUCT_NAME_BASE); |
| 388 return product_name; | 388 return product_name; |
| 389 } | 389 } |
| 390 | 390 |
| 391 std::wstring GoogleChromeDistribution::GetAlternateApplicationName() { | 391 std::wstring GoogleChromeDistribution::GetAlternateApplicationName() { |
| 392 const std::wstring& alt_product_name = | 392 const std::wstring& alt_product_name = |
| 393 installer::GetLocalizedString(IDS_OEM_MAIN_SHORTCUT_NAME_BASE); | 393 installer_util::GetLocalizedString(IDS_OEM_MAIN_SHORTCUT_NAME_BASE); |
| 394 return alt_product_name; | 394 return alt_product_name; |
| 395 } | 395 } |
| 396 | 396 |
| 397 std::wstring GoogleChromeDistribution::GetBrowserAppId() { | 397 std::wstring GoogleChromeDistribution::GetBrowserAppId() { |
| 398 return kBrowserAppId; | 398 return kBrowserAppId; |
| 399 } | 399 } |
| 400 | 400 |
| 401 std::wstring GoogleChromeDistribution::GetInstallSubDir() { | 401 std::wstring GoogleChromeDistribution::GetInstallSubDir() { |
| 402 std::wstring sub_dir(installer::kGoogleChromeInstallSubDir1); | 402 std::wstring sub_dir(installer_util::kGoogleChromeInstallSubDir1); |
| 403 sub_dir.append(L"\\"); | 403 sub_dir.append(L"\\"); |
| 404 sub_dir.append(installer::kGoogleChromeInstallSubDir2); | 404 sub_dir.append(installer_util::kGoogleChromeInstallSubDir2); |
| 405 return sub_dir; | 405 return sub_dir; |
| 406 } | 406 } |
| 407 | 407 |
| 408 std::wstring GoogleChromeDistribution::GetPublisherName() { | 408 std::wstring GoogleChromeDistribution::GetPublisherName() { |
| 409 const std::wstring& publisher_name = | 409 const std::wstring& publisher_name = |
| 410 installer::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE); | 410 installer_util::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE); |
| 411 return publisher_name; | 411 return publisher_name; |
| 412 } | 412 } |
| 413 | 413 |
| 414 std::wstring GoogleChromeDistribution::GetAppDescription() { | 414 std::wstring GoogleChromeDistribution::GetAppDescription() { |
| 415 const std::wstring& app_description = | 415 const std::wstring& app_description = |
| 416 installer::GetLocalizedString(IDS_SHORTCUT_TOOLTIP_BASE); | 416 installer_util::GetLocalizedString(IDS_SHORTCUT_TOOLTIP_BASE); |
| 417 return app_description; | 417 return app_description; |
| 418 } | 418 } |
| 419 | 419 |
| 420 std::string GoogleChromeDistribution::GetSafeBrowsingName() { | 420 std::string GoogleChromeDistribution::GetSafeBrowsingName() { |
| 421 return "googlechrome"; | 421 return "googlechrome"; |
| 422 } | 422 } |
| 423 | 423 |
| 424 std::wstring GoogleChromeDistribution::GetStateKey() { | 424 std::wstring GoogleChromeDistribution::GetStateKey() { |
| 425 std::wstring key(google_update::kRegPathClientState); | 425 std::wstring key(google_update::kRegPathClientState); |
| 426 key.append(L"\\"); | 426 key.append(L"\\"); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 client_state_key.ReadValue(google_update::kRegApField, &ap_value); | 470 client_state_key.ReadValue(google_update::kRegApField, &ap_value); |
| 471 result.append(google_update::kRegApField); | 471 result.append(google_update::kRegApField); |
| 472 result.append(L"="); | 472 result.append(L"="); |
| 473 result.append(ap_value); | 473 result.append(ap_value); |
| 474 | 474 |
| 475 return result; | 475 return result; |
| 476 } | 476 } |
| 477 | 477 |
| 478 std::wstring GoogleChromeDistribution::GetUninstallLinkName() { | 478 std::wstring GoogleChromeDistribution::GetUninstallLinkName() { |
| 479 const std::wstring& link_name = | 479 const std::wstring& link_name = |
| 480 installer::GetLocalizedString(IDS_UNINSTALL_CHROME_BASE); | 480 installer_util::GetLocalizedString(IDS_UNINSTALL_CHROME_BASE); |
| 481 return link_name; | 481 return link_name; |
| 482 } | 482 } |
| 483 | 483 |
| 484 std::wstring GoogleChromeDistribution::GetUninstallRegPath() { | 484 std::wstring GoogleChromeDistribution::GetUninstallRegPath() { |
| 485 return L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" | 485 return L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" |
| 486 L"Google Chrome"; | 486 L"Google Chrome"; |
| 487 } | 487 } |
| 488 | 488 |
| 489 std::wstring GoogleChromeDistribution::GetVersionKey() { | 489 std::wstring GoogleChromeDistribution::GetVersionKey() { |
| 490 std::wstring key(google_update::kRegPathClients); | 490 std::wstring key(google_update::kRegPathClients); |
| 491 key.append(L"\\"); | 491 key.append(L"\\"); |
| 492 key.append(product_guid()); | 492 key.append(product_guid()); |
| 493 return key; | 493 return key; |
| 494 } | 494 } |
| 495 | 495 |
| 496 // This method checks if we need to change "ap" key in Google Update to try | 496 // This method checks if we need to change "ap" key in Google Update to try |
| 497 // full installer as fall back method in case incremental installer fails. | 497 // full installer as fall back method in case incremental installer fails. |
| 498 // - If incremental installer fails we append a magic string ("-full"), if | 498 // - If incremental installer fails we append a magic string ("-full"), if |
| 499 // it is not present already, so that Google Update server next time will send | 499 // it is not present already, so that Google Update server next time will send |
| 500 // full installer to update Chrome on the local machine | 500 // full installer to update Chrome on the local machine |
| 501 // - If we are currently running full installer, we remove this magic | 501 // - If we are currently running full installer, we remove this magic |
| 502 // string (if it is present) regardless of whether installer failed or not. | 502 // string (if it is present) regardless of whether installer failed or not. |
| 503 // There is no fall-back for full installer :) | 503 // There is no fall-back for full installer :) |
| 504 void GoogleChromeDistribution::UpdateDiffInstallStatus(bool system_install, | 504 void GoogleChromeDistribution::UpdateDiffInstallStatus(bool system_install, |
| 505 bool incremental_install, installer::InstallStatus install_status) { | 505 bool incremental_install, installer_util::InstallStatus install_status) { |
| 506 GoogleUpdateSettings::UpdateDiffInstallStatus(system_install, | 506 GoogleUpdateSettings::UpdateDiffInstallStatus(system_install, |
| 507 incremental_install, GetInstallReturnCode(install_status), | 507 incremental_install, GetInstallReturnCode(install_status), |
| 508 product_guid().c_str()); | 508 product_guid().c_str()); |
| 509 } | 509 } |
| 510 | 510 |
| 511 // The functions below are not used by the 64-bit Windows binary - | 511 // The functions below are not used by the 64-bit Windows binary - |
| 512 // see the comment in google_chrome_distribution_dummy.cc | 512 // see the comment in google_chrome_distribution_dummy.cc |
| 513 #ifndef _WIN64 | 513 #ifndef _WIN64 |
| 514 // A helper function that writes to HKLM if the handle was passed through the | 514 // A helper function that writes to HKLM if the handle was passed through the |
| 515 // command line, but HKCU otherwise. |experiment_group| is the value to write | 515 // command line, but HKCU otherwise. |experiment_group| is the value to write |
| 516 // and |last_write| is used when writing to HKLM to determine whether to close | 516 // and |last_write| is used when writing to HKLM to determine whether to close |
| 517 // the handle when done. | 517 // the handle when done. |
| 518 void SetClient(std::wstring experiment_group, bool last_write) { | 518 void SetClient(std::wstring experiment_group, bool last_write) { |
| 519 static int reg_key_handle = -1; | 519 static int reg_key_handle = -1; |
| 520 if (reg_key_handle == -1) { | 520 if (reg_key_handle == -1) { |
| 521 // If a specific Toast Results key handle (presumably to our HKLM key) was | 521 // If a specific Toast Results key handle (presumably to our HKLM key) was |
| 522 // passed in to the command line (such as for system level installs), we use | 522 // passed in to the command line (such as for system level installs), we use |
| 523 // it. Otherwise, we write to the key under HKCU. | 523 // it. Otherwise, we write to the key under HKCU. |
| 524 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); | 524 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); |
| 525 if (cmd_line.HasSwitch(installer::switches::kToastResultsKey)) { | 525 if (cmd_line.HasSwitch(installer_util::switches::kToastResultsKey)) { |
| 526 // Get the handle to the key under HKLM. | 526 // Get the handle to the key under HKLM. |
| 527 base::StringToInt(cmd_line.GetSwitchValueASCII( | 527 base::StringToInt(cmd_line.GetSwitchValueASCII( |
| 528 installer::switches::kToastResultsKey).c_str(), | 528 installer_util::switches::kToastResultsKey).c_str(), |
| 529 ®_key_handle); | 529 ®_key_handle); |
| 530 } else { | 530 } else { |
| 531 reg_key_handle = 0; | 531 reg_key_handle = 0; |
| 532 } | 532 } |
| 533 } | 533 } |
| 534 | 534 |
| 535 if (reg_key_handle) { | 535 if (reg_key_handle) { |
| 536 // Use it to write the experiment results. | 536 // Use it to write the experiment results. |
| 537 GoogleUpdateSettings::WriteGoogleUpdateSystemClientKey( | 537 GoogleUpdateSettings::WriteGoogleUpdateSystemClientKey( |
| 538 reg_key_handle, google_update::kRegClientField, experiment_group); | 538 reg_key_handle, google_update::kRegClientField, experiment_group); |
| 539 if (last_write) | 539 if (last_write) |
| 540 CloseHandle((HANDLE) reg_key_handle); | 540 CloseHandle((HANDLE) reg_key_handle); |
| 541 } else { | 541 } else { |
| 542 // Write to HKCU. | 542 // Write to HKCU. |
| 543 GoogleUpdateSettings::SetClient(experiment_group); | 543 GoogleUpdateSettings::SetClient(experiment_group); |
| 544 } | 544 } |
| 545 } | 545 } |
| 546 | 546 |
| 547 // Currently we only have one experiment: the inactive user toast. Which only | 547 // Currently we only have one experiment: the inactive user toast. Which only |
| 548 // applies for users doing upgrades. | 548 // applies for users doing upgrades. |
| 549 // | 549 // |
| 550 // There are three scenarios when this function is called: | 550 // There are three scenarios when this function is called: |
| 551 // 1- Is a per-user-install and it updated: perform the experiment | 551 // 1- Is a per-user-install and it updated: perform the experiment |
| 552 // 2- Is a system-install and it updated : relaunch as the interactive user | 552 // 2- Is a system-install and it updated : relaunch as the interactive user |
| 553 // 3- It has been re-launched from the #2 case. In this case we enter | 553 // 3- It has been re-launched from the #2 case. In this case we enter |
| 554 // this function with |system_install| true and a REENTRY_SYS_UPDATE status. | 554 // this function with |system_install| true and a REENTRY_SYS_UPDATE status. |
| 555 void GoogleChromeDistribution::LaunchUserExperiment( | 555 void GoogleChromeDistribution::LaunchUserExperiment( |
| 556 installer::InstallStatus status, const installer::Version& version, | 556 installer_util::InstallStatus status, const installer::Version& version, |
| 557 const installer::Product& installation, bool system_level) { | 557 const installer::Product& installation, bool system_level) { |
| 558 if (system_level) { | 558 if (system_level) { |
| 559 if (installer::NEW_VERSION_UPDATED == status) { | 559 if (installer_util::NEW_VERSION_UPDATED == status) { |
| 560 // We need to relaunch as the interactive user. | 560 // We need to relaunch as the interactive user. |
| 561 RelaunchSetupAsConsoleUser(installer::switches::kSystemLevelToast); | 561 RelaunchSetupAsConsoleUser(installer_util::switches::kSystemLevelToast); |
| 562 return; | 562 return; |
| 563 } | 563 } |
| 564 } else { | 564 } else { |
| 565 if ((installer::NEW_VERSION_UPDATED != status) && | 565 if ((installer_util::NEW_VERSION_UPDATED != status) && |
| 566 (installer::REENTRY_SYS_UPDATE != status)) { | 566 (installer_util::REENTRY_SYS_UPDATE != status)) { |
| 567 // We are not updating or in re-launch. Exit. | 567 // We are not updating or in re-launch. Exit. |
| 568 return; | 568 return; |
| 569 } | 569 } |
| 570 } | 570 } |
| 571 | 571 |
| 572 // This ends up being processed by ShowTryChromeDialog to show different | 572 // This ends up being processed by ShowTryChromeDialog to show different |
| 573 // experiments. Only run the experiment in en-US. | 573 // experiments. Only run the experiment in en-US. |
| 574 int flavor = 0; | 574 int flavor = 0; |
| 575 std::wstring language; | 575 std::wstring language; |
| 576 if (GoogleUpdateSettings::GetLanguage(&language) && (language == L"en-US")) | 576 if (GoogleUpdateSettings::GetLanguage(&language) && (language == L"en-US")) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 return; | 608 return; |
| 609 } | 609 } |
| 610 } | 610 } |
| 611 | 611 |
| 612 VLOG(1) << "User drafted for toast experiment " << flavor; | 612 VLOG(1) << "User drafted for toast experiment " << flavor; |
| 613 SetClient(GetExperimentGroup(kToastExpBaseGroup, flavor), false); | 613 SetClient(GetExperimentGroup(kToastExpBaseGroup, flavor), false); |
| 614 // User level: The experiment needs to be performed in a different process | 614 // User level: The experiment needs to be performed in a different process |
| 615 // because google_update expects the upgrade process to be quick and nimble. | 615 // because google_update expects the upgrade process to be quick and nimble. |
| 616 // System level: We have already been relaunched, so we don't need to be | 616 // System level: We have already been relaunched, so we don't need to be |
| 617 // quick, but we relaunch to follow the exact same codepath. | 617 // quick, but we relaunch to follow the exact same codepath. |
| 618 RelaunchSetup(installer::switches::kInactiveUserToast, flavor, | 618 RelaunchSetup(installer_util::switches::kInactiveUserToast, flavor, |
| 619 system_level); | 619 system_level); |
| 620 } | 620 } |
| 621 | 621 |
| 622 // User qualifies for the experiment. Launch chrome with --try-chrome=flavor. | 622 // User qualifies for the experiment. Launch chrome with --try-chrome=flavor. |
| 623 void GoogleChromeDistribution::InactiveUserToastExperiment(int flavor, | 623 void GoogleChromeDistribution::InactiveUserToastExperiment(int flavor, |
| 624 const installer::Product& installation) { | 624 const installer::Product& installation) { |
| 625 bool has_welcome_url = (flavor == 0); | 625 bool has_welcome_url = (flavor == 0); |
| 626 // Possibly add a url to launch depending on the experiment flavor. | 626 // Possibly add a url to launch depending on the experiment flavor. |
| 627 CommandLine options(CommandLine::NO_PROGRAM); | 627 CommandLine options(CommandLine::NO_PROGRAM); |
| 628 options.AppendSwitchNative(switches::kTryChromeAgain, | 628 options.AppendSwitchNative(switches::kTryChromeAgain, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 // Write to the |client| key for the last time. | 661 // Write to the |client| key for the last time. |
| 662 SetClient(GetExperimentGroup(outcome, flavor), true); | 662 SetClient(GetExperimentGroup(outcome, flavor), true); |
| 663 | 663 |
| 664 if (outcome != kToastExpUninstallGroup) | 664 if (outcome != kToastExpUninstallGroup) |
| 665 return; | 665 return; |
| 666 | 666 |
| 667 // The user wants to uninstall. This is a best effort operation. Note that | 667 // The user wants to uninstall. This is a best effort operation. Note that |
| 668 // we waited for chrome to exit so the uninstall would not detect chrome | 668 // we waited for chrome to exit so the uninstall would not detect chrome |
| 669 // running. | 669 // running. |
| 670 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( | 670 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( |
| 671 installer::switches::kSystemLevelToast); | 671 installer_util::switches::kSystemLevelToast); |
| 672 | 672 |
| 673 std::wstring cmd(InstallUtil::GetChromeUninstallCmd( | 673 std::wstring cmd(InstallUtil::GetChromeUninstallCmd( |
| 674 system_level_toast, this)); | 674 system_level_toast, this)); |
| 675 | 675 |
| 676 base::LaunchApp(cmd, false, false, NULL); | 676 base::LaunchApp(cmd, false, false, NULL); |
| 677 } | 677 } |
| 678 #endif | 678 #endif |
| OLD | NEW |