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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "chrome/installer/util/browser_distribution.h" | |
17 #include "chrome/installer/util/shell_util.h" | 16 #include "chrome/installer/util/shell_util.h" |
18 #include "chrome/installer/util/util_constants.h" | 17 #include "chrome/installer/util/util_constants.h" |
19 | 18 |
| 19 class BrowserDistribution; |
| 20 |
20 namespace base { | 21 namespace base { |
21 class CommandLine; | 22 class CommandLine; |
22 } | 23 } |
23 | 24 |
24 namespace installer { | 25 namespace installer { |
25 | 26 |
26 class ChannelInfo; | 27 class ChannelInfo; |
27 class MasterPreferences; | 28 class MasterPreferences; |
28 class Product; | 29 class Product; |
29 class ProductOperations; | 30 class ProductOperations; |
(...skipping 15 matching lines...) Expand all Loading... |
45 | 46 |
46 void InitializeFromPreferences(const MasterPreferences& prefs); | 47 void InitializeFromPreferences(const MasterPreferences& prefs); |
47 | 48 |
48 void InitializeFromUninstallCommand( | 49 void InitializeFromUninstallCommand( |
49 const base::CommandLine& uninstall_command); | 50 const base::CommandLine& uninstall_command); |
50 | 51 |
51 BrowserDistribution* distribution() const { | 52 BrowserDistribution* distribution() const { |
52 return distribution_; | 53 return distribution_; |
53 } | 54 } |
54 | 55 |
55 bool is_type(BrowserDistribution::Type type) const { | |
56 return distribution_->GetType() == type; | |
57 } | |
58 | |
59 bool is_chrome() const { | |
60 return distribution_->GetType() == BrowserDistribution::CHROME_BROWSER; | |
61 } | |
62 | |
63 bool HasOption(const std::wstring& option) const { | 56 bool HasOption(const std::wstring& option) const { |
64 return options_.find(option) != options_.end(); | 57 return options_.find(option) != options_.end(); |
65 } | 58 } |
66 | 59 |
67 // Returns true if the set of options is mutated by this operation. | 60 // Returns true if the set of options is mutated by this operation. |
68 bool SetOption(const std::wstring& option, bool set) { | 61 bool SetOption(const std::wstring& option, bool set) { |
69 if (set) | 62 if (set) |
70 return options_.insert(option).second; | 63 return options_.insert(option).second; |
71 else | 64 else |
72 return options_.erase(option) != 0; | 65 return options_.erase(option) != 0; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 102 |
110 void LaunchUserExperiment(const base::FilePath& setup_path, | 103 void LaunchUserExperiment(const base::FilePath& setup_path, |
111 InstallStatus status, | 104 InstallStatus status, |
112 bool system_level) const; | 105 bool system_level) const; |
113 | 106 |
114 protected: | 107 protected: |
115 enum CacheStateFlags { | 108 enum CacheStateFlags { |
116 MSI_STATE = 0x01 | 109 MSI_STATE = 0x01 |
117 }; | 110 }; |
118 | 111 |
119 BrowserDistribution* distribution_; | 112 BrowserDistribution* const distribution_; |
120 std::unique_ptr<ProductOperations> operations_; | 113 const std::unique_ptr<ProductOperations> operations_; |
121 std::set<std::wstring> options_; | 114 std::set<std::wstring> options_; |
122 | 115 |
123 private: | 116 private: |
124 DISALLOW_COPY_AND_ASSIGN(Product); | 117 DISALLOW_COPY_AND_ASSIGN(Product); |
125 }; | 118 }; |
126 | 119 |
127 } // namespace installer | 120 } // namespace installer |
128 | 121 |
129 #endif // CHROME_INSTALLER_UTIL_PRODUCT_H_ | 122 #endif // CHROME_INSTALLER_UTIL_PRODUCT_H_ |
OLD | NEW |