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

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

Issue 2621923002: Product cleanups in the wake of multi-install removal. (Closed)
Patch Set: sync to position 442831 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
« no previous file with comments | « chrome/installer/util/google_update_util.cc ('k') | chrome/installer/util/product.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PRODUCT_H_ 5 #ifndef CHROME_INSTALLER_UTIL_PRODUCT_H_
6 #define CHROME_INSTALLER_UTIL_PRODUCT_H_ 6 #define CHROME_INSTALLER_UTIL_PRODUCT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <set>
12 #include <string>
13 #include <vector> 11 #include <vector>
14 12
15 #include "base/macros.h" 13 #include "base/macros.h"
16 #include "chrome/installer/util/shell_util.h" 14 #include "chrome/installer/util/shell_util.h"
17 #include "chrome/installer/util/util_constants.h" 15 #include "chrome/installer/util/util_constants.h"
18 16
19 class BrowserDistribution; 17 class BrowserDistribution;
20 18
21 namespace base { 19 namespace base {
22 class CommandLine; 20 class CommandLine;
23 } 21 }
24 22
25 namespace installer { 23 namespace installer {
26 24
27 class ChannelInfo;
28 class MasterPreferences;
29 class Product; 25 class Product;
30 class ProductOperations; 26 class ProductOperations;
31 27
32 // Represents an installation of a specific product which has a one-to-one 28 // Represents an installation of a specific product which has a one-to-one
33 // relation to a BrowserDistribution. A product has registry settings, related 29 // relation to a BrowserDistribution. A product has registry settings, related
34 // installation/uninstallation actions and exactly one Package that represents 30 // installation/uninstallation actions and exactly one Package that represents
35 // the files on disk. The Package may be shared with other Product instances, 31 // the files on disk. The Package may be shared with other Product instances,
36 // so only the last Product to be uninstalled should remove the package. 32 // so only the last Product to be uninstalled should remove the package.
37 // Right now there are no classes that derive from Product, but in 33 // Right now there are no classes that derive from Product, but in
38 // the future, as we move away from global functions and towards a data driven 34 // the future, as we move away from global functions and towards a data driven
39 // installation, each distribution could derive from this class and provide 35 // installation, each distribution could derive from this class and provide
40 // distribution specific functionality. 36 // distribution specific functionality.
41 class Product { 37 class Product {
42 public: 38 public:
43 explicit Product(BrowserDistribution* distribution); 39 explicit Product(BrowserDistribution* distribution);
44 40
45 ~Product(); 41 ~Product();
46 42
47 void InitializeFromPreferences(const MasterPreferences& prefs);
48
49 void InitializeFromUninstallCommand(
50 const base::CommandLine& uninstall_command);
51
52 BrowserDistribution* distribution() const { 43 BrowserDistribution* distribution() const {
53 return distribution_; 44 return distribution_;
54 } 45 }
55 46
56 bool HasOption(const std::wstring& option) const {
57 return options_.find(option) != options_.end();
58 }
59
60 // Returns true if the set of options is mutated by this operation.
61 bool SetOption(const std::wstring& option, bool set) {
62 if (set)
63 return options_.insert(option).second;
64 else
65 return options_.erase(option) != 0;
66 }
67
68 // Launches Chrome without waiting for it to exit. 47 // Launches Chrome without waiting for it to exit.
69 bool LaunchChrome(const base::FilePath& application_path) const; 48 bool LaunchChrome(const base::FilePath& application_path) const;
70 49
71 // Launches Chrome with given command line, waits for Chrome indefinitely 50 // Launches Chrome with given command line, waits for Chrome indefinitely
72 // (until it terminates), and gets the process exit code if available. 51 // (until it terminates), and gets the process exit code if available.
73 // The function returns true as long as Chrome is successfully launched. 52 // The function returns true as long as Chrome is successfully launched.
74 // The status of Chrome at the return of the function is given by exit_code. 53 // The status of Chrome at the return of the function is given by exit_code.
75 // NOTE: The 'options' CommandLine object should only contain parameters. 54 // NOTE: The 'options' CommandLine object should only contain parameters.
76 // The program part will be ignored. 55 // The program part will be ignored.
77 bool LaunchChromeAndWait(const base::FilePath& application_path, 56 bool LaunchChromeAndWait(const base::FilePath& application_path,
78 const base::CommandLine& options, 57 const base::CommandLine& options,
79 int32_t* exit_code) const; 58 int32_t* exit_code) const;
80 59
81 // Sets the boolean MSI marker for this installation if set is true or clears 60 // Sets the boolean MSI marker for this installation if set is true or clears
82 // it otherwise. The MSI marker is stored in the registry under the 61 // it otherwise. The MSI marker is stored in the registry under the
83 // ClientState key. 62 // ClientState key.
84 bool SetMsiMarker(bool system_install, bool set) const; 63 bool SetMsiMarker(bool system_install, bool set) const;
85 64
86 // See ProductOperations::AddKeyFiles. 65 // See ProductOperations::AddKeyFiles.
87 void AddKeyFiles(std::vector<base::FilePath>* key_files) const; 66 void AddKeyFiles(std::vector<base::FilePath>* key_files) const;
88 67
89 // See ProductOperations::AppendProductFlags. 68 // See ProductOperations::AppendProductFlags.
90 void AppendProductFlags(base::CommandLine* command_line) const; 69 void AppendProductFlags(base::CommandLine* command_line) const;
91 70
92 // See ProductOperations::AppendRenameFlags. 71 // See ProductOperations::AppendRenameFlags.
93 void AppendRenameFlags(base::CommandLine* command_line) const; 72 void AppendRenameFlags(base::CommandLine* command_line) const;
94 73
95 // See Productoperations::SetChannelFlags.
96 bool SetChannelFlags(bool set, ChannelInfo* channel_info) const;
97
98 // See ProductOperations::AddDefaultShortcutProperties. 74 // See ProductOperations::AddDefaultShortcutProperties.
99 void AddDefaultShortcutProperties( 75 void AddDefaultShortcutProperties(
100 const base::FilePath& target_exe, 76 const base::FilePath& target_exe,
101 ShellUtil::ShortcutProperties* properties) const; 77 ShellUtil::ShortcutProperties* properties) const;
102 78
103 void LaunchUserExperiment(const base::FilePath& setup_path, 79 void LaunchUserExperiment(const base::FilePath& setup_path,
104 InstallStatus status, 80 InstallStatus status,
105 bool system_level) const; 81 bool system_level) const;
106 82
107 protected: 83 protected:
108 enum CacheStateFlags { 84 enum CacheStateFlags {
109 MSI_STATE = 0x01 85 MSI_STATE = 0x01
110 }; 86 };
111 87
112 BrowserDistribution* const distribution_; 88 BrowserDistribution* const distribution_;
113 const std::unique_ptr<ProductOperations> operations_; 89 const std::unique_ptr<ProductOperations> operations_;
114 std::set<std::wstring> options_;
115 90
116 private: 91 private:
117 DISALLOW_COPY_AND_ASSIGN(Product); 92 DISALLOW_COPY_AND_ASSIGN(Product);
118 }; 93 };
119 94
120 } // namespace installer 95 } // namespace installer
121 96
122 #endif // CHROME_INSTALLER_UTIL_PRODUCT_H_ 97 #endif // CHROME_INSTALLER_UTIL_PRODUCT_H_
OLDNEW
« no previous file with comments | « chrome/installer/util/google_update_util.cc ('k') | chrome/installer/util/product.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698