| 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 // This file declares util functions for setup project. It also declares a | 5 // This file declares util functions for setup project. It also declares a |
| 6 // few functions that the Chrome component updater uses for patching binary | 6 // few functions that the Chrome component updater uses for patching binary |
| 7 // deltas. | 7 // deltas. |
| 8 | 8 |
| 9 #ifndef CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ | 9 #ifndef CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ |
| 10 #define CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ | 10 #define CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ |
| 11 | 11 |
| 12 #include <windows.h> | 12 #include <windows.h> |
| 13 | 13 |
| 14 #include <vector> |
| 15 |
| 14 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 15 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 16 #include "base/win/scoped_handle.h" | 18 #include "base/win/scoped_handle.h" |
| 17 #include "chrome/installer/util/browser_distribution.h" | 19 #include "chrome/installer/util/browser_distribution.h" |
| 18 #include "chrome/installer/util/util_constants.h" | 20 #include "chrome/installer/util/util_constants.h" |
| 19 | 21 |
| 20 class AppRegistrationData; | 22 class AppRegistrationData; |
| 21 | 23 |
| 22 namespace base { | 24 namespace base { |
| 23 class CommandLine; | 25 class CommandLine; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 bool ContainsUnsupportedSwitch(const base::CommandLine& cmd_line); | 119 bool ContainsUnsupportedSwitch(const base::CommandLine& cmd_line); |
| 118 | 120 |
| 119 // Returns true if the processor is supported by chrome. | 121 // Returns true if the processor is supported by chrome. |
| 120 bool IsProcessorSupported(); | 122 bool IsProcessorSupported(); |
| 121 | 123 |
| 122 // Returns the "...\\Commands\\|name|" registry key for a product's |reg_data|. | 124 // Returns the "...\\Commands\\|name|" registry key for a product's |reg_data|. |
| 123 base::string16 GetRegistrationDataCommandKey( | 125 base::string16 GetRegistrationDataCommandKey( |
| 124 const AppRegistrationData& reg_data, | 126 const AppRegistrationData& reg_data, |
| 125 const wchar_t* name); | 127 const wchar_t* name); |
| 126 | 128 |
| 129 // Deletes all values and subkeys of the key |path| under |root|, preserving |
| 130 // the keys named in |keys_to_preserve| (each of which must be an ASCII string). |
| 131 // The key itself is deleted if no subkeys are preserved. |
| 132 void DeleteRegistryKeyPartial( |
| 133 HKEY root, |
| 134 const base::string16& path, |
| 135 const std::vector<base::string16>& keys_to_preserve); |
| 136 |
| 127 // This class will enable the privilege defined by |privilege_name| on the | 137 // This class will enable the privilege defined by |privilege_name| on the |
| 128 // current process' token. The privilege will be disabled upon the | 138 // current process' token. The privilege will be disabled upon the |
| 129 // ScopedTokenPrivilege's destruction (unless it was already enabled when the | 139 // ScopedTokenPrivilege's destruction (unless it was already enabled when the |
| 130 // ScopedTokenPrivilege object was constructed). | 140 // ScopedTokenPrivilege object was constructed). |
| 131 // Some privileges might require admin rights to be enabled (check is_enabled() | 141 // Some privileges might require admin rights to be enabled (check is_enabled() |
| 132 // to know whether |privilege_name| was successfully enabled). | 142 // to know whether |privilege_name| was successfully enabled). |
| 133 class ScopedTokenPrivilege { | 143 class ScopedTokenPrivilege { |
| 134 public: | 144 public: |
| 135 explicit ScopedTokenPrivilege(const wchar_t* privilege_name); | 145 explicit ScopedTokenPrivilege(const wchar_t* privilege_name); |
| 136 ~ScopedTokenPrivilege(); | 146 ~ScopedTokenPrivilege(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 149 // The previous state of the privilege this object is responsible for. As set | 159 // The previous state of the privilege this object is responsible for. As set |
| 150 // by AdjustTokenPrivileges() upon construction. | 160 // by AdjustTokenPrivileges() upon construction. |
| 151 TOKEN_PRIVILEGES previous_privileges_; | 161 TOKEN_PRIVILEGES previous_privileges_; |
| 152 | 162 |
| 153 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedTokenPrivilege); | 163 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedTokenPrivilege); |
| 154 }; | 164 }; |
| 155 | 165 |
| 156 } // namespace installer | 166 } // namespace installer |
| 157 | 167 |
| 158 #endif // CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ | 168 #endif // CHROME_INSTALLER_SETUP_SETUP_UTIL_H_ |
| OLD | NEW |