| OLD | NEW |
| (Empty) |
| 1 // Copyright 2010 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 | |
| 16 #ifndef OMAHA_GOOPDATE_PACKAGE_CACHE_INTERNAL_H_ | |
| 17 #define OMAHA_GOOPDATE_PACKAGE_CACHE_INTERNAL_H_ | |
| 18 | |
| 19 #include <windows.h> | |
| 20 #include <atlstr.h> | |
| 21 #include <vector> | |
| 22 #include "base/basictypes.h" | |
| 23 #include "base/synchronized.h" | |
| 24 | |
| 25 namespace omaha { | |
| 26 | |
| 27 namespace internal { | |
| 28 | |
| 29 enum CacheDirectoryType { | |
| 30 CACHE_DIRECTORY_ROOT, | |
| 31 CACHE_DIRECTORY_APP, | |
| 32 CACHE_DIRECTORY_VERSION, | |
| 33 }; | |
| 34 | |
| 35 struct PackageInfo { | |
| 36 PackageInfo() { | |
| 37 file_time.dwLowDateTime = 0; | |
| 38 file_time.dwHighDateTime = 0; | |
| 39 file_size.QuadPart = 0; | |
| 40 } | |
| 41 | |
| 42 CString file_name; | |
| 43 FILETIME file_time; | |
| 44 ULARGE_INTEGER file_size; | |
| 45 }; | |
| 46 | |
| 47 // TODO(omaha): add tests for some of the functions below. | |
| 48 bool PackageSortByTimePredicate(const PackageInfo& package1, | |
| 49 const PackageInfo& package2); | |
| 50 | |
| 51 bool IsSpecialDirectoryFindData(const WIN32_FIND_DATA& find_data); | |
| 52 | |
| 53 bool IsSubDirectoryFindData(const WIN32_FIND_DATA& find_data); | |
| 54 | |
| 55 bool IsFileFindData(const WIN32_FIND_DATA& find_data); | |
| 56 | |
| 57 HRESULT FindDirectoryPackagesInfo(const CString& dir_path, | |
| 58 CacheDirectoryType dir_type, | |
| 59 std::vector<PackageInfo>* packages_info); | |
| 60 | |
| 61 HRESULT FindAllPackagesInfo(const CString& cache_root, | |
| 62 std::vector<PackageInfo>* packages_info); | |
| 63 | |
| 64 HRESULT FindAppPackagesInfo(const CString& app_dir, | |
| 65 std::vector<PackageInfo>* packages_info); | |
| 66 | |
| 67 HRESULT FindVersionPackagesInfo(const CString& version_dir, | |
| 68 std::vector<PackageInfo>* packages_info); | |
| 69 | |
| 70 HRESULT FindFilePackagesInfo(const CString& version_dir, | |
| 71 const WIN32_FIND_DATA& find_data, | |
| 72 std::vector<PackageInfo>* packages_info); | |
| 73 | |
| 74 HRESULT FindDirectoryPackagesInfo(const CString& dir_path, | |
| 75 CacheDirectoryType dir_type, | |
| 76 std::vector<PackageInfo>* packages_info); | |
| 77 | |
| 78 void SortPackageInfoByTime(std::vector<PackageInfo>* packages_info); | |
| 79 | |
| 80 } // namespace internal | |
| 81 | |
| 82 } // namespace omaha | |
| 83 | |
| 84 #endif // OMAHA_GOOPDATE_PACKAGE_CACHE_INTERNAL_H_ | |
| 85 | |
| OLD | NEW |