OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/installer/util/package_properties.h" | |
6 | |
7 #include "base/basictypes.h" | |
8 #include "base/string_util.h" | |
9 #include "chrome/installer/util/browser_distribution.h" | |
10 #include "chrome/installer/util/google_update_constants.h" | |
11 #include "chrome/installer/util/google_update_settings.h" | |
12 #include "chrome/installer/util/install_util.h" | |
13 #include "chrome/installer/util/util_constants.h" | |
14 | |
15 namespace { | |
16 | |
17 const wchar_t kChromePackageGuid[] = | |
18 L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}"; | |
19 | |
20 std::wstring GetKeyForGuid(const wchar_t* base_key, const wchar_t* guid) { | |
21 std::wstring key(base_key); | |
22 key.append(L"\\"); | |
23 key.append(guid); | |
24 return key; | |
25 } | |
26 | |
27 } // end namespace | |
28 | |
29 namespace installer { | |
30 | |
31 const char PackageProperties::kPackageProductName[] = "Chrome binaries"; | |
32 | |
33 PackagePropertiesImpl::PackagePropertiesImpl( | |
34 const wchar_t* guid, | |
35 const std::wstring& state_key, | |
36 const std::wstring& state_medium_key, | |
37 const std::wstring& version_key) | |
38 : guid_(guid), state_key_(state_key), state_medium_key_(state_medium_key), | |
39 version_key_(version_key) { | |
40 } | |
41 | |
42 PackagePropertiesImpl::~PackagePropertiesImpl() { | |
43 } | |
44 | |
45 const std::wstring& PackagePropertiesImpl::GetAppGuid() { | |
46 return guid_; | |
47 } | |
48 | |
49 const std::wstring& PackagePropertiesImpl::GetStateKey() { | |
50 return state_key_; | |
51 } | |
52 | |
53 const std::wstring& PackagePropertiesImpl::GetStateMediumKey() { | |
54 return state_medium_key_; | |
55 } | |
56 | |
57 const std::wstring& PackagePropertiesImpl::GetVersionKey() { | |
58 return version_key_; | |
59 } | |
60 | |
61 void PackagePropertiesImpl::UpdateInstallStatus(bool system_level, | |
62 bool incremental_install, | |
63 bool multi_install, | |
64 InstallStatus status) { | |
65 if (ReceivesUpdates()) { | |
66 GoogleUpdateSettings::UpdateInstallStatus(system_level, | |
67 incremental_install, multi_install, | |
68 InstallUtil::GetInstallReturnCode(status), guid_); | |
69 } | |
70 } | |
71 | |
72 ChromiumPackageProperties::ChromiumPackageProperties() | |
73 : PackagePropertiesImpl(L"", L"Software\\Chromium", L"Software\\Chromium", | |
74 L"Software\\Chromium") { | |
75 } | |
76 | |
77 ChromiumPackageProperties::~ChromiumPackageProperties() { | |
78 } | |
79 | |
80 ChromePackageProperties::ChromePackageProperties() | |
81 : PackagePropertiesImpl( | |
82 kChromePackageGuid, | |
83 GetKeyForGuid(google_update::kRegPathClientState, | |
84 kChromePackageGuid), | |
85 GetKeyForGuid(google_update::kRegPathClientStateMedium, | |
86 kChromePackageGuid), | |
87 GetKeyForGuid(google_update::kRegPathClients, | |
88 kChromePackageGuid)) { | |
89 } | |
90 | |
91 ChromePackageProperties::~ChromePackageProperties() { | |
92 } | |
93 | |
94 } // namespace installer | |
OLD | NEW |