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 #ifndef CHROME_INSTALLER_UTIL_PACKAGE_PROPERTIES_H_ | |
6 #define CHROME_INSTALLER_UTIL_PACKAGE_PROPERTIES_H_ | |
7 #pragma once | |
8 | |
9 #include <windows.h> | |
10 | |
11 #include <string> | |
12 | |
13 #include "base/basictypes.h" | |
14 | |
15 namespace installer { | |
16 enum InstallStatus; | |
17 }; | |
18 | |
19 namespace installer { | |
20 | |
21 // Pure virtual interface that exposes properties of a package installation. | |
22 // A package represents a set of binaries on disk that can be shared by two or | |
23 // more products. Also see the Package class for further details. | |
24 // PackageProperties is comparable to the BrowserDistribution class but the | |
25 // difference is that the BrowserDistribution class represents a product | |
26 // installation whereas PackageProperties represents a package | |
27 // (horizontal vs vertical). | |
28 class PackageProperties { | |
29 public: | |
30 PackageProperties() {} | |
31 virtual ~PackageProperties() {} | |
32 | |
33 static const char kPackageProductName[]; | |
34 | |
35 // Returns true iff this package will be updated by Google Update. | |
36 virtual bool ReceivesUpdates() const = 0; | |
37 | |
38 // Equivalent to BrowserDistribution::GetAppGuid() | |
39 virtual const std::wstring& GetAppGuid() = 0; | |
40 virtual const std::wstring& GetStateKey() = 0; | |
41 virtual const std::wstring& GetStateMediumKey() = 0; | |
42 virtual const std::wstring& GetVersionKey() = 0; | |
43 virtual void UpdateInstallStatus(bool system_level, bool incremental_install, | |
44 bool multi_install, installer::InstallStatus status) = 0; | |
45 | |
46 private: | |
47 DISALLOW_COPY_AND_ASSIGN(PackageProperties); | |
48 }; // class PackageProperties | |
49 | |
50 class PackagePropertiesImpl : public PackageProperties { | |
51 public: | |
52 explicit PackagePropertiesImpl(const wchar_t* guid, | |
53 const std::wstring& state_key, | |
54 const std::wstring& state_medium_key, | |
55 const std::wstring& version_key); | |
56 virtual ~PackagePropertiesImpl(); | |
57 | |
58 virtual const std::wstring& GetAppGuid(); | |
59 virtual const std::wstring& GetStateKey(); | |
60 virtual const std::wstring& GetStateMediumKey(); | |
61 virtual const std::wstring& GetVersionKey(); | |
62 virtual void UpdateInstallStatus(bool system_level, bool incremental_install, | |
63 bool multi_install, installer::InstallStatus status); | |
64 | |
65 protected: | |
66 std::wstring guid_; | |
67 std::wstring state_key_; | |
68 std::wstring state_medium_key_; | |
69 std::wstring version_key_; | |
70 | |
71 private: | |
72 DISALLOW_COPY_AND_ASSIGN(PackagePropertiesImpl); | |
73 }; // class PackagePropertiesImpl | |
74 | |
75 class ChromiumPackageProperties : public PackagePropertiesImpl { | |
76 public: | |
77 ChromiumPackageProperties(); | |
78 virtual ~ChromiumPackageProperties(); | |
79 | |
80 virtual bool ReceivesUpdates() const { | |
81 return false; | |
82 } | |
83 | |
84 private: | |
85 DISALLOW_COPY_AND_ASSIGN(ChromiumPackageProperties); | |
86 }; // class ChromiumPackageProperties | |
87 | |
88 class ChromePackageProperties : public PackagePropertiesImpl { | |
89 public: | |
90 ChromePackageProperties(); | |
91 virtual ~ChromePackageProperties(); | |
92 | |
93 virtual bool ReceivesUpdates() const { | |
94 return true; | |
95 } | |
96 | |
97 private: | |
98 DISALLOW_COPY_AND_ASSIGN(ChromePackageProperties); | |
99 }; // class ChromePackageProperties | |
100 | |
101 #if defined(GOOGLE_CHROME_BUILD) | |
102 typedef ChromePackageProperties ActivePackageProperties; | |
103 #else | |
104 typedef ChromiumPackageProperties ActivePackageProperties; | |
105 #endif | |
106 | |
107 } // namespace installer | |
108 | |
109 #endif // CHROME_INSTALLER_UTIL_PACKAGE_PROPERTIES_H_ | |
OLD | NEW |