| 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_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 EntryInfoResult second; // Only filled if the first entry is found. | 106 EntryInfoResult second; // Only filled if the first entry is found. |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 // Used to receive the result from GetEntryInfoPairCallback(). | 109 // Used to receive the result from GetEntryInfoPairCallback(). |
| 110 typedef base::Callback<void(scoped_ptr<EntryInfoPairResult> pair_result)> | 110 typedef base::Callback<void(scoped_ptr<EntryInfoPairResult> pair_result)> |
| 111 GetEntryInfoPairCallback; | 111 GetEntryInfoPairCallback; |
| 112 | 112 |
| 113 // Interface class for resource metadata storage. | 113 // Interface class for resource metadata storage. |
| 114 class DriveResourceMetadataInterface { | 114 class DriveResourceMetadataInterface { |
| 115 public: | 115 public: |
| 116 virtual ~DriveResourceMetadataInterface() {} |
| 117 |
| 116 // Largest change timestamp that was the source of content for the current | 118 // Largest change timestamp that was the source of content for the current |
| 117 // state of the root directory. | 119 // state of the root directory. |
| 118 virtual void GetLargestChangestamp( | 120 virtual void GetLargestChangestamp( |
| 119 const GetChangestampCallback& callback) = 0; | 121 const GetChangestampCallback& callback) = 0; |
| 120 virtual void SetLargestChangestamp(int64 value, | 122 virtual void SetLargestChangestamp(int64 value, |
| 121 const FileOperationCallback& callback) = 0; | 123 const FileOperationCallback& callback) = 0; |
| 122 | 124 |
| 123 // Adds |entry| to directory with path |directory_path| and invoke the | 125 // Adds |entry| to directory with path |directory_path| and invoke the |
| 124 // callback asynchronously. |callback| must not be null. | 126 // callback asynchronously. |callback| must not be null. |
| 125 virtual void AddEntryToDirectory(const FilePath& directory_path, | 127 virtual void AddEntryToDirectory(const FilePath& directory_path, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // Recursively get child directories of entry pointed to by |resource_id|. | 193 // Recursively get child directories of entry pointed to by |resource_id|. |
| 192 virtual void GetChildDirectories( | 194 virtual void GetChildDirectories( |
| 193 const std::string& resource_id, | 195 const std::string& resource_id, |
| 194 const GetChildDirectoriesCallback& changed_dirs_callback) = 0; | 196 const GetChildDirectoriesCallback& changed_dirs_callback) = 0; |
| 195 | 197 |
| 196 // Removes all files/directories under root (not including root). | 198 // Removes all files/directories under root (not including root). |
| 197 virtual void RemoveAll(const base::Closure& callback) = 0; | 199 virtual void RemoveAll(const base::Closure& callback) = 0; |
| 198 | 200 |
| 199 protected: | 201 protected: |
| 200 DriveResourceMetadataInterface() {} | 202 DriveResourceMetadataInterface() {} |
| 201 virtual ~DriveResourceMetadataInterface() {} | |
| 202 }; | 203 }; |
| 203 | 204 |
| 204 // Storage for Drive Metadata. | 205 // Storage for Drive Metadata. |
| 205 class DriveResourceMetadata : public DriveResourceMetadataInterface { | 206 class DriveResourceMetadata : public DriveResourceMetadataInterface { |
| 206 public: | 207 public: |
| 207 // Map of resource id and serialized DriveEntry. | 208 // Map of resource id and serialized DriveEntry. |
| 208 typedef std::map<std::string, std::string> SerializedMap; | 209 typedef std::map<std::string, std::string> SerializedMap; |
| 209 // Map of resource id strings to DriveEntry*. | 210 // Map of resource id strings to DriveEntry*. |
| 210 typedef std::map<std::string, DriveEntry*> ResourceMap; | 211 typedef std::map<std::string, DriveEntry*> ResourceMap; |
| 211 | 212 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 // This should remain the last member so it'll be destroyed first and | 367 // This should remain the last member so it'll be destroyed first and |
| 367 // invalidate its weak pointers before other members are destroyed. | 368 // invalidate its weak pointers before other members are destroyed. |
| 368 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; | 369 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; |
| 369 | 370 |
| 370 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); | 371 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); |
| 371 }; | 372 }; |
| 372 | 373 |
| 373 } // namespace drive | 374 } // namespace drive |
| 374 | 375 |
| 375 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ | 376 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ |
| OLD | NEW |