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> |
11 #include <wtsapi32.h> | 11 #include <wtsapi32.h> |
12 #include <msi.h> | 12 #include <msi.h> |
13 #include <sddl.h> | 13 #include <sddl.h> |
14 | 14 |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/file_path.h" | 16 #include "base/file_path.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
19 #include "base/registry.h" | |
20 #include "base/scoped_ptr.h" | 19 #include "base/scoped_ptr.h" |
21 #include "base/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
22 #include "base/string_util.h" | 21 #include "base/string_util.h" |
23 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
| 23 #include "base/win/registry.h" |
24 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/json_value_serializer.h" | 26 #include "chrome/common/json_value_serializer.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/result_codes.h" | 28 #include "chrome/common/result_codes.h" |
29 #include "chrome/installer/util/install_util.h" | 29 #include "chrome/installer/util/install_util.h" |
30 #include "chrome/installer/util/l10n_string_util.h" | 30 #include "chrome/installer/util/l10n_string_util.h" |
31 #include "chrome/installer/util/google_update_constants.h" | 31 #include "chrome/installer/util/google_update_constants.h" |
32 #include "chrome/installer/util/google_update_settings.h" | 32 #include "chrome/installer/util/google_update_settings.h" |
33 #include "chrome/installer/util/helper.h" | 33 #include "chrome/installer/util/helper.h" |
34 #include "chrome/installer/util/util_constants.h" | 34 #include "chrome/installer/util/util_constants.h" |
35 #include "chrome/installer/util/wmi.h" | 35 #include "chrome/installer/util/wmi.h" |
36 | 36 |
37 #include "installer_util_strings.h" | 37 #include "installer_util_strings.h" |
38 | 38 |
39 #pragma comment(lib, "wtsapi32.lib") | 39 #pragma comment(lib, "wtsapi32.lib") |
40 | 40 |
41 namespace { | 41 namespace { |
| 42 |
42 const wchar_t kChromeGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; | 43 const wchar_t kChromeGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; |
43 const wchar_t kBrowserAppId[] = L"Chrome"; | 44 const wchar_t kBrowserAppId[] = L"Chrome"; |
44 | 45 |
45 // The following strings are the possible outcomes of the toast experiment | 46 // The following strings are the possible outcomes of the toast experiment |
46 // as recorded in the |client| field. Previously the groups used "TSxx" but | 47 // as recorded in the |client| field. Previously the groups used "TSxx" but |
47 // the data captured is not valid. | 48 // the data captured is not valid. |
48 const wchar_t kToastExpControlGroup[] = L"T%lc01"; | 49 const wchar_t kToastExpControlGroup[] = L"T%lc01"; |
49 const wchar_t kToastExpCancelGroup[] = L"T%lc02"; | 50 const wchar_t kToastExpCancelGroup[] = L"T%lc02"; |
50 const wchar_t kToastExpUninstallGroup[] = L"T%lc04"; | 51 const wchar_t kToastExpUninstallGroup[] = L"T%lc04"; |
51 const wchar_t kToastExpTriesOkGroup[] = L"T%lc18"; | 52 const wchar_t kToastExpTriesOkGroup[] = L"T%lc18"; |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 std::wstring key(google_update::kRegPathClientStateMedium); | 431 std::wstring key(google_update::kRegPathClientStateMedium); |
431 key.append(L"\\"); | 432 key.append(L"\\"); |
432 key.append(product_guid()); | 433 key.append(product_guid()); |
433 return key; | 434 return key; |
434 } | 435 } |
435 | 436 |
436 std::wstring GoogleChromeDistribution::GetStatsServerURL() { | 437 std::wstring GoogleChromeDistribution::GetStatsServerURL() { |
437 return L"https://clients4.google.com/firefox/metrics/collect"; | 438 return L"https://clients4.google.com/firefox/metrics/collect"; |
438 } | 439 } |
439 | 440 |
440 std::wstring GoogleChromeDistribution::GetDistributionData(RegKey* key) { | 441 std::wstring GoogleChromeDistribution::GetDistributionData( |
| 442 base::win::RegKey* key) { |
441 DCHECK(NULL != key); | 443 DCHECK(NULL != key); |
442 std::wstring sub_key(google_update::kRegPathClientState); | 444 std::wstring sub_key(google_update::kRegPathClientState); |
443 sub_key.append(L"\\"); | 445 sub_key.append(L"\\"); |
444 sub_key.append(product_guid()); | 446 sub_key.append(product_guid()); |
445 | 447 |
446 RegKey client_state_key(key->Handle(), sub_key.c_str(), KEY_READ); | 448 base::win::RegKey client_state_key(key->Handle(), sub_key.c_str(), KEY_READ); |
447 std::wstring result; | 449 std::wstring result; |
448 std::wstring brand_value; | 450 std::wstring brand_value; |
449 if (client_state_key.ReadValue(google_update::kRegRLZBrandField, | 451 if (client_state_key.ReadValue(google_update::kRegRLZBrandField, |
450 &brand_value)) { | 452 &brand_value)) { |
451 result = google_update::kRegRLZBrandField; | 453 result = google_update::kRegRLZBrandField; |
452 result.append(L"="); | 454 result.append(L"="); |
453 result.append(brand_value); | 455 result.append(brand_value); |
454 result.append(L"&"); | 456 result.append(L"&"); |
455 } | 457 } |
456 | 458 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 | 660 |
659 if (outcome != kToastExpUninstallGroup) | 661 if (outcome != kToastExpUninstallGroup) |
660 return; | 662 return; |
661 // The user wants to uninstall. This is a best effort operation. Note that | 663 // The user wants to uninstall. This is a best effort operation. Note that |
662 // we waited for chrome to exit so the uninstall would not detect chrome | 664 // we waited for chrome to exit so the uninstall would not detect chrome |
663 // running. | 665 // running. |
664 base::LaunchApp(InstallUtil::GetChromeUninstallCmd(system_install), | 666 base::LaunchApp(InstallUtil::GetChromeUninstallCmd(system_install), |
665 false, false, NULL); | 667 false, false, NULL); |
666 } | 668 } |
667 #endif | 669 #endif |
OLD | NEW |