| OLD | NEW |
| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/installer/util/browser_distribution.h" | 13 #include "chrome/installer/util/browser_distribution.h" |
| 14 #include "chrome/installer/util/shell_util.h" | 14 #include "chrome/installer/util/shell_util.h" |
| 15 #include "chrome/installer/util/util_constants.h" | 15 #include "chrome/installer/util/util_constants.h" |
| 16 | 16 |
| 17 namespace base { |
| 17 class CommandLine; | 18 class CommandLine; |
| 19 } |
| 18 | 20 |
| 19 namespace installer { | 21 namespace installer { |
| 20 | 22 |
| 21 class ChannelInfo; | 23 class ChannelInfo; |
| 22 class MasterPreferences; | 24 class MasterPreferences; |
| 23 class Product; | 25 class Product; |
| 24 class ProductOperations; | 26 class ProductOperations; |
| 25 | 27 |
| 26 // 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 |
| 27 // relation to a BrowserDistribution. A product has registry settings, related | 29 // relation to a BrowserDistribution. A product has registry settings, related |
| 28 // installation/uninstallation actions and exactly one Package that represents | 30 // installation/uninstallation actions and exactly one Package that represents |
| 29 // 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, |
| 30 // 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. |
| 31 // 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 |
| 32 // 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 |
| 33 // installation, each distribution could derive from this class and provide | 35 // installation, each distribution could derive from this class and provide |
| 34 // distribution specific functionality. | 36 // distribution specific functionality. |
| 35 class Product { | 37 class Product { |
| 36 public: | 38 public: |
| 37 explicit Product(BrowserDistribution* distribution); | 39 explicit Product(BrowserDistribution* distribution); |
| 38 | 40 |
| 39 ~Product(); | 41 ~Product(); |
| 40 | 42 |
| 41 void InitializeFromPreferences(const MasterPreferences& prefs); | 43 void InitializeFromPreferences(const MasterPreferences& prefs); |
| 42 | 44 |
| 43 void InitializeFromUninstallCommand(const CommandLine& uninstall_command); | 45 void InitializeFromUninstallCommand( |
| 46 const base::CommandLine& uninstall_command); |
| 44 | 47 |
| 45 BrowserDistribution* distribution() const { | 48 BrowserDistribution* distribution() const { |
| 46 return distribution_; | 49 return distribution_; |
| 47 } | 50 } |
| 48 | 51 |
| 49 bool is_type(BrowserDistribution::Type type) const { | 52 bool is_type(BrowserDistribution::Type type) const { |
| 50 return distribution_->GetType() == type; | 53 return distribution_->GetType() == type; |
| 51 } | 54 } |
| 52 | 55 |
| 53 bool is_chrome() const { | 56 bool is_chrome() const { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // Launches Chrome without waiting for it to exit. | 94 // Launches Chrome without waiting for it to exit. |
| 92 bool LaunchChrome(const base::FilePath& application_path) const; | 95 bool LaunchChrome(const base::FilePath& application_path) const; |
| 93 | 96 |
| 94 // Launches Chrome with given command line, waits for Chrome indefinitely | 97 // Launches Chrome with given command line, waits for Chrome indefinitely |
| 95 // (until it terminates), and gets the process exit code if available. | 98 // (until it terminates), and gets the process exit code if available. |
| 96 // The function returns true as long as Chrome is successfully launched. | 99 // The function returns true as long as Chrome is successfully launched. |
| 97 // The status of Chrome at the return of the function is given by exit_code. | 100 // The status of Chrome at the return of the function is given by exit_code. |
| 98 // NOTE: The 'options' CommandLine object should only contain parameters. | 101 // NOTE: The 'options' CommandLine object should only contain parameters. |
| 99 // The program part will be ignored. | 102 // The program part will be ignored. |
| 100 bool LaunchChromeAndWait(const base::FilePath& application_path, | 103 bool LaunchChromeAndWait(const base::FilePath& application_path, |
| 101 const CommandLine& options, | 104 const base::CommandLine& options, |
| 102 int32* exit_code) const; | 105 int32* exit_code) const; |
| 103 | 106 |
| 104 // Sets the boolean MSI marker for this installation if set is true or clears | 107 // Sets the boolean MSI marker for this installation if set is true or clears |
| 105 // it otherwise. The MSI marker is stored in the registry under the | 108 // it otherwise. The MSI marker is stored in the registry under the |
| 106 // ClientState key. | 109 // ClientState key. |
| 107 bool SetMsiMarker(bool system_install, bool set) const; | 110 bool SetMsiMarker(bool system_install, bool set) const; |
| 108 | 111 |
| 109 // Returns true if setup should create an entry in the Add/Remove list | 112 // Returns true if setup should create an entry in the Add/Remove list |
| 110 // of installed applications. | 113 // of installed applications. |
| 111 bool ShouldCreateUninstallEntry() const; | 114 bool ShouldCreateUninstallEntry() const; |
| 112 | 115 |
| 113 // See ProductOperations::AddKeyFiles. | 116 // See ProductOperations::AddKeyFiles. |
| 114 void AddKeyFiles(std::vector<base::FilePath>* key_files) const; | 117 void AddKeyFiles(std::vector<base::FilePath>* key_files) const; |
| 115 | 118 |
| 116 // See ProductOperations::AddComDllList. | 119 // See ProductOperations::AddComDllList. |
| 117 void AddComDllList(std::vector<base::FilePath>* com_dll_list) const; | 120 void AddComDllList(std::vector<base::FilePath>* com_dll_list) const; |
| 118 | 121 |
| 119 // See ProductOperations::AppendProductFlags. | 122 // See ProductOperations::AppendProductFlags. |
| 120 void AppendProductFlags(CommandLine* command_line) const; | 123 void AppendProductFlags(base::CommandLine* command_line) const; |
| 121 | 124 |
| 122 // See ProductOperations::AppendRenameFlags. | 125 // See ProductOperations::AppendRenameFlags. |
| 123 void AppendRenameFlags(CommandLine* command_line) const; | 126 void AppendRenameFlags(base::CommandLine* command_line) const; |
| 124 | 127 |
| 125 // See Productoperations::SetChannelFlags. | 128 // See Productoperations::SetChannelFlags. |
| 126 bool SetChannelFlags(bool set, ChannelInfo* channel_info) const; | 129 bool SetChannelFlags(bool set, ChannelInfo* channel_info) const; |
| 127 | 130 |
| 128 // See ProductOperations::AddDefaultShortcutProperties. | 131 // See ProductOperations::AddDefaultShortcutProperties. |
| 129 void AddDefaultShortcutProperties( | 132 void AddDefaultShortcutProperties( |
| 130 const base::FilePath& target_exe, | 133 const base::FilePath& target_exe, |
| 131 ShellUtil::ShortcutProperties* properties) const; | 134 ShellUtil::ShortcutProperties* properties) const; |
| 132 | 135 |
| 133 void LaunchUserExperiment(const base::FilePath& setup_path, | 136 void LaunchUserExperiment(const base::FilePath& setup_path, |
| 134 InstallStatus status, | 137 InstallStatus status, |
| 135 bool system_level) const; | 138 bool system_level) const; |
| 136 | 139 |
| 137 protected: | 140 protected: |
| 138 enum CacheStateFlags { | 141 enum CacheStateFlags { |
| 139 MSI_STATE = 0x01 | 142 MSI_STATE = 0x01 |
| 140 }; | 143 }; |
| 141 | 144 |
| 142 BrowserDistribution* distribution_; | 145 BrowserDistribution* distribution_; |
| 143 scoped_ptr<ProductOperations> operations_; | 146 scoped_ptr<ProductOperations> operations_; |
| 144 std::set<std::wstring> options_; | 147 std::set<std::wstring> options_; |
| 145 | 148 |
| 146 private: | 149 private: |
| 147 DISALLOW_COPY_AND_ASSIGN(Product); | 150 DISALLOW_COPY_AND_ASSIGN(Product); |
| 148 }; | 151 }; |
| 149 | 152 |
| 150 } // namespace installer | 153 } // namespace installer |
| 151 | 154 |
| 152 #endif // CHROME_INSTALLER_UTIL_PRODUCT_H_ | 155 #endif // CHROME_INSTALLER_UTIL_PRODUCT_H_ |
| OLD | NEW |