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 utility functions for the installer. The original reason | 5 // This file declares utility functions for the installer. The original reason |
6 // for putting these functions in installer\util library is so that we can | 6 // for putting these functions in installer\util library is so that we can |
7 // separate out the critical logic and write unit tests for it. | 7 // separate out the critical logic and write unit tests for it. |
8 | 8 |
9 #ifndef CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ | 9 #ifndef CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ |
10 #define CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ | 10 #define CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 // A predicate that compares the program portion of a command line with a | 178 // A predicate that compares the program portion of a command line with a |
179 // given file path. First, the file paths are compared directly. If they do | 179 // given file path. First, the file paths are compared directly. If they do |
180 // not match, the filesystem is consulted to determine if the paths reference | 180 // not match, the filesystem is consulted to determine if the paths reference |
181 // the same file. | 181 // the same file. |
182 class ProgramCompare : public RegistryValuePredicate { | 182 class ProgramCompare : public RegistryValuePredicate { |
183 public: | 183 public: |
184 explicit ProgramCompare(const FilePath& path_to_match); | 184 explicit ProgramCompare(const FilePath& path_to_match); |
185 virtual ~ProgramCompare(); | 185 virtual ~ProgramCompare(); |
186 virtual bool Evaluate(const string16& value) const OVERRIDE; | 186 virtual bool Evaluate(const string16& value) const OVERRIDE; |
| 187 bool EvaluatePath(const FilePath& path) const; |
187 | 188 |
188 protected: | 189 protected: |
189 static bool OpenForInfo(const FilePath& path, | 190 static bool OpenForInfo(const FilePath& path, |
190 base::win::ScopedHandle* handle); | 191 base::win::ScopedHandle* handle); |
191 static bool GetInfo(const base::win::ScopedHandle& handle, | 192 static bool GetInfo(const base::win::ScopedHandle& handle, |
192 BY_HANDLE_FILE_INFORMATION* info); | 193 BY_HANDLE_FILE_INFORMATION* info); |
193 | 194 |
194 FilePath path_to_match_; | 195 FilePath path_to_match_; |
195 base::win::ScopedHandle file_handle_; | 196 base::win::ScopedHandle file_handle_; |
196 BY_HANDLE_FILE_INFORMATION file_info_; | 197 BY_HANDLE_FILE_INFORMATION file_info_; |
197 | 198 |
198 private: | 199 private: |
199 DISALLOW_COPY_AND_ASSIGN(ProgramCompare); | 200 DISALLOW_COPY_AND_ASSIGN(ProgramCompare); |
200 }; // class ProgramCompare | 201 }; // class ProgramCompare |
201 | 202 |
202 private: | 203 private: |
203 DISALLOW_COPY_AND_ASSIGN(InstallUtil); | 204 DISALLOW_COPY_AND_ASSIGN(InstallUtil); |
204 }; | 205 }; |
205 | 206 |
206 | 207 |
207 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ | 208 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ |
OLD | NEW |