| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 // Used to receive the result from GetEntryInfoPairCallback(). | 128 // Used to receive the result from GetEntryInfoPairCallback(). |
| 129 typedef base::Callback<void(scoped_ptr<EntryInfoPairResult> pair_result)> | 129 typedef base::Callback<void(scoped_ptr<EntryInfoPairResult> pair_result)> |
| 130 GetEntryInfoPairCallback; | 130 GetEntryInfoPairCallback; |
| 131 | 131 |
| 132 // Storage for Drive Metadata. | 132 // Storage for Drive Metadata. |
| 133 class DriveResourceMetadata { | 133 class DriveResourceMetadata { |
| 134 public: | 134 public: |
| 135 // |root_resource_id| is the resource id for the root directory. | 135 // |root_resource_id| is the resource id for the root directory. |
| 136 DriveResourceMetadata( | 136 DriveResourceMetadata( |
| 137 const std::string& root_resource_id, | |
| 138 const base::FilePath& data_directory_path, | 137 const base::FilePath& data_directory_path, |
| 139 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); | 138 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); |
| 140 | 139 |
| 141 // Initializes this object. | 140 // Initializes this object. |
| 142 // This method should be called before any other methods. | 141 // This method should be called before any other methods. |
| 143 void Initialize(const FileOperationCallback& callback); | 142 void Initialize(const FileOperationCallback& callback); |
| 144 | 143 |
| 145 // Destroys this object. This method posts a task to |blocking_task_runner_| | 144 // Destroys this object. This method posts a task to |blocking_task_runner_| |
| 146 // to safely delete this object. | 145 // to safely delete this object. |
| 147 void Destroy(); | 146 void Destroy(); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 385 |
| 387 // Parses metadata from string and set up directory structure. | 386 // Parses metadata from string and set up directory structure. |
| 388 bool ParseFromString(const std::string& serialized_proto); | 387 bool ParseFromString(const std::string& serialized_proto); |
| 389 | 388 |
| 390 const base::FilePath data_directory_path_; | 389 const base::FilePath data_directory_path_; |
| 391 | 390 |
| 392 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 391 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 393 | 392 |
| 394 scoped_ptr<DriveResourceMetadataStorage> storage_; | 393 scoped_ptr<DriveResourceMetadataStorage> storage_; |
| 395 | 394 |
| 396 std::string root_resource_id_; | |
| 397 | |
| 398 base::Time last_serialized_; | 395 base::Time last_serialized_; |
| 399 size_t serialized_size_; | 396 size_t serialized_size_; |
| 400 | 397 |
| 401 // This should remain the last member so it'll be destroyed first and | 398 // This should remain the last member so it'll be destroyed first and |
| 402 // invalidate its weak pointers before other members are destroyed. | 399 // invalidate its weak pointers before other members are destroyed. |
| 403 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; | 400 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; |
| 404 | 401 |
| 405 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); | 402 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); |
| 406 }; | 403 }; |
| 407 | 404 |
| 408 } // namespace drive | 405 } // namespace drive |
| 409 | 406 |
| 410 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ | 407 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ |
| OLD | NEW |