Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: chrome/installer/util/installation_state.h

Issue 2618583005: Remove support for non-browser products from InstallationState and ProductState. (Closed)
Patch Set: fix Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CHROME_INSTALLER_UTIL_INSTALLATION_STATE_H_ 5 #ifndef CHROME_INSTALLER_UTIL_INSTALLATION_STATE_H_
6 #define CHROME_INSTALLER_UTIL_INSTALLATION_STATE_H_ 6 #define CHROME_INSTALLER_UTIL_INSTALLATION_STATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chrome/installer/util/app_commands.h" 14 #include "chrome/installer/util/app_commands.h"
15 #include "chrome/installer/util/browser_distribution.h"
16 #include "chrome/installer/util/channel_info.h" 15 #include "chrome/installer/util/channel_info.h"
17 16
18 namespace base { 17 namespace base {
19 class Version; 18 class Version;
20 namespace win { 19 namespace win {
21 class RegKey; 20 class RegKey;
22 } 21 }
23 } 22 }
24 23
25 namespace installer { 24 namespace installer {
26 25
27 class InstallationState; 26 class InstallationState;
28 27
29 // A representation of a product's state on the machine based on the contents 28 // A representation of Chrome's state on the machine based on the contents of
30 // of the Windows registry. 29 // the Windows registry.
31 // TODO(grt): Pull this out into its own file. 30 // TODO(grt): Pull this out into its own file.
31 // TODO(grt): Evaluate whether this is still needed. If yes, rename to
32 // ChromeState or somesuch.
32 class ProductState { 33 class ProductState {
33 public: 34 public:
34 ProductState(); 35 ProductState();
35 ~ProductState(); 36 ~ProductState();
36 37
37 // Returns true if the product is installed (i.e., the product's Clients key 38 // Returns true if the product is installed (i.e., the product's Clients key
38 // exists and has a "pv" value); false otherwise. 39 // exists and has a "pv" value); false otherwise.
39 bool Initialize(bool system_install, 40 bool Initialize(bool system_install);
40 BrowserDistribution::Type type);
41 bool Initialize(bool system_install,
42 BrowserDistribution* distribution);
43 41
44 // Returns the product's channel info (i.e., the Google Update "ap" value). 42 // Returns the product's channel info (i.e., the Google Update "ap" value).
45 const ChannelInfo& channel() const { return channel_; } 43 const ChannelInfo& channel() const { return channel_; }
46 44
47 // Returns the path to the product's "setup.exe"; may be empty. 45 // Returns the path to the product's "setup.exe"; may be empty.
48 base::FilePath GetSetupPath() const; 46 base::FilePath GetSetupPath() const;
49 47
50 // Returns the product's version. This method may only be called on an 48 // Returns the product's version. This method may only be called on an
51 // instance that has been initialized for an installed product. 49 // instance that has been initialized for an installed product.
52 const base::Version& version() const; 50 const base::Version& version() const;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // TODO(grt): Rename this to MachineState and put it in its own file. 128 // TODO(grt): Rename this to MachineState and put it in its own file.
131 class InstallationState { 129 class InstallationState {
132 public: 130 public:
133 InstallationState(); 131 InstallationState();
134 132
135 // Initializes this object with the machine's current state. 133 // Initializes this object with the machine's current state.
136 void Initialize(); 134 void Initialize();
137 135
138 // Returns the state of a product or NULL if not installed. 136 // Returns the state of a product or NULL if not installed.
139 // Caller does NOT assume ownership of returned pointer. 137 // Caller does NOT assume ownership of returned pointer.
140 const ProductState* GetProductState(bool system_install, 138 const ProductState* GetProductState(bool system_install) const;
141 BrowserDistribution::Type type) const;
142 139
143 // Returns the state of a product, even one that has not yet been installed. 140 // Returns the state of a product, even one that has not yet been installed.
144 // This is useful during first install, when some but not all ProductState 141 // This is useful during first install, when some but not all ProductState
145 // information has been written by Omaha. Notably absent from the 142 // information has been written by Omaha. Notably absent from the
146 // ProductState returned here are the version numbers. Do NOT try to access 143 // ProductState returned here are the version numbers. Do NOT try to access
147 // the version numbers from a ProductState returned by this method. 144 // the version numbers from a ProductState returned by this method.
148 // Caller does NOT assume ownership of returned pointer. This method will 145 // Caller does NOT assume ownership of returned pointer. This method will
149 // never return NULL. 146 // never return NULL.
150 const ProductState* GetNonVersionedProductState( 147 const ProductState* GetNonVersionedProductState(bool system_install) const;
151 bool system_install, BrowserDistribution::Type type) const;
152 148
153 protected: 149 protected:
154 enum { 150 ProductState user_chrome_;
155 CHROME_BROWSER_INDEX, 151 ProductState system_chrome_;
156 CHROME_FRAME_INDEX,
157 CHROME_BINARIES_INDEX,
158 NUM_PRODUCTS
159 };
160
161 static int IndexFromDistType(BrowserDistribution::Type type);
162
163 ProductState user_products_[NUM_PRODUCTS];
164 ProductState system_products_[NUM_PRODUCTS];
165 152
166 private: 153 private:
167 DISALLOW_COPY_AND_ASSIGN(InstallationState); 154 DISALLOW_COPY_AND_ASSIGN(InstallationState);
168 }; // class InstallationState 155 }; // class InstallationState
169 156
170 } // namespace installer 157 } // namespace installer
171 158
172 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_STATE_H_ 159 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698