| OLD | NEW |
| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 return launched; | 283 return launched; |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace | 286 } // namespace |
| 287 | 287 |
| 288 GoogleChromeDistribution::GoogleChromeDistribution() | 288 GoogleChromeDistribution::GoogleChromeDistribution() |
| 289 : BrowserDistribution(CHROME_BROWSER), | 289 : BrowserDistribution(CHROME_BROWSER), |
| 290 product_guid_(kChromeGuid) { | 290 product_guid_(kChromeGuid) { |
| 291 } | 291 } |
| 292 | 292 |
| 293 // The functions below are not used by the 64-bit Windows binary - | |
| 294 // see the comment in google_chrome_distribution_dummy.cc | |
| 295 #ifndef _WIN64 | |
| 296 bool GoogleChromeDistribution::BuildUninstallMetricsString( | 293 bool GoogleChromeDistribution::BuildUninstallMetricsString( |
| 297 const DictionaryValue* uninstall_metrics_dict, string16* metrics) { | 294 const DictionaryValue* uninstall_metrics_dict, string16* metrics) { |
| 298 DCHECK(NULL != metrics); | 295 DCHECK(NULL != metrics); |
| 299 bool has_values = false; | 296 bool has_values = false; |
| 300 | 297 |
| 301 for (DictionaryValue::Iterator iter(*uninstall_metrics_dict); !iter.IsAtEnd(); | 298 for (DictionaryValue::Iterator iter(*uninstall_metrics_dict); !iter.IsAtEnd(); |
| 302 iter.Advance()) { | 299 iter.Advance()) { |
| 303 has_values = true; | 300 has_values = true; |
| 304 metrics->append(L"&"); | 301 metrics->append(L"&"); |
| 305 metrics->append(UTF8ToWide(iter.key())); | 302 metrics->append(UTF8ToWide(iter.key())); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 return false; | 347 return false; |
| 351 } | 348 } |
| 352 | 349 |
| 353 if (!BuildUninstallMetricsString(uninstall_metrics_dict, | 350 if (!BuildUninstallMetricsString(uninstall_metrics_dict, |
| 354 uninstall_metrics_string)) { | 351 uninstall_metrics_string)) { |
| 355 return false; | 352 return false; |
| 356 } | 353 } |
| 357 | 354 |
| 358 return true; | 355 return true; |
| 359 } | 356 } |
| 360 #endif | |
| 361 | 357 |
| 362 void GoogleChromeDistribution::DoPostUninstallOperations( | 358 void GoogleChromeDistribution::DoPostUninstallOperations( |
| 363 const Version& version, | 359 const Version& version, |
| 364 const FilePath& local_data_path, | 360 const FilePath& local_data_path, |
| 365 const string16& distribution_data) { | 361 const string16& distribution_data) { |
| 366 // Send the Chrome version and OS version as params to the form. | 362 // Send the Chrome version and OS version as params to the form. |
| 367 // It would be nice to send the locale, too, but I don't see an | 363 // It would be nice to send the locale, too, but I don't see an |
| 368 // easy way to get that in the existing code. It's something we | 364 // easy way to get that in the existing code. It's something we |
| 369 // can add later, if needed. | 365 // can add later, if needed. |
| 370 // We depend on installed_version.GetString() not having spaces or other | 366 // We depend on installed_version.GetString() not having spaces or other |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 // string (if it is present) regardless of whether installer failed or not. | 561 // string (if it is present) regardless of whether installer failed or not. |
| 566 // There is no fall-back for full installer :) | 562 // There is no fall-back for full installer :) |
| 567 void GoogleChromeDistribution::UpdateInstallStatus(bool system_install, | 563 void GoogleChromeDistribution::UpdateInstallStatus(bool system_install, |
| 568 installer::ArchiveType archive_type, | 564 installer::ArchiveType archive_type, |
| 569 installer::InstallStatus install_status) { | 565 installer::InstallStatus install_status) { |
| 570 GoogleUpdateSettings::UpdateInstallStatus(system_install, | 566 GoogleUpdateSettings::UpdateInstallStatus(system_install, |
| 571 archive_type, InstallUtil::GetInstallReturnCode(install_status), | 567 archive_type, InstallUtil::GetInstallReturnCode(install_status), |
| 572 product_guid()); | 568 product_guid()); |
| 573 } | 569 } |
| 574 | 570 |
| 575 // The functions below are not used by the 64-bit Windows binary - | |
| 576 // see the comment in google_chrome_distribution_dummy.cc | |
| 577 #ifndef _WIN64 | |
| 578 // A helper function that writes to HKLM if the handle was passed through the | 571 // A helper function that writes to HKLM if the handle was passed through the |
| 579 // command line, but HKCU otherwise. |experiment_group| is the value to write | 572 // command line, but HKCU otherwise. |experiment_group| is the value to write |
| 580 // and |last_write| is used when writing to HKLM to determine whether to close | 573 // and |last_write| is used when writing to HKLM to determine whether to close |
| 581 // the handle when done. | 574 // the handle when done. |
| 582 void SetClient(const string16& experiment_group, bool last_write) { | 575 void SetClient(const string16& experiment_group, bool last_write) { |
| 583 static int reg_key_handle = -1; | 576 static int reg_key_handle = -1; |
| 584 if (reg_key_handle == -1) { | 577 if (reg_key_handle == -1) { |
| 585 // If a specific Toast Results key handle (presumably to our HKLM key) was | 578 // If a specific Toast Results key handle (presumably to our HKLM key) was |
| 586 // passed in to the command line (such as for system level installs), we use | 579 // passed in to the command line (such as for system level installs), we use |
| 587 // it. Otherwise, we write to the key under HKCU. | 580 // it. Otherwise, we write to the key under HKCU. |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 // The user wants to uninstall. This is a best effort operation. Note that | 858 // The user wants to uninstall. This is a best effort operation. Note that |
| 866 // we waited for chrome to exit so the uninstall would not detect chrome | 859 // we waited for chrome to exit so the uninstall would not detect chrome |
| 867 // running. | 860 // running. |
| 868 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( | 861 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( |
| 869 installer::switches::kSystemLevelToast); | 862 installer::switches::kSystemLevelToast); |
| 870 | 863 |
| 871 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast, | 864 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast, |
| 872 GetType())); | 865 GetType())); |
| 873 base::LaunchProcess(cmd, base::LaunchOptions(), NULL); | 866 base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |
| 874 } | 867 } |
| 875 #endif // ifndef _WIN64 | |
| 876 | 868 |
| 877 bool GoogleChromeDistribution::ShouldSetExperimentLabels() { | 869 bool GoogleChromeDistribution::ShouldSetExperimentLabels() { |
| 878 return true; | 870 return true; |
| 879 } | 871 } |
| OLD | NEW |