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_RESOURCE_METADATA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // Destroys this object. This method posts a task to |blocking_task_runner_| | 42 // Destroys this object. This method posts a task to |blocking_task_runner_| |
43 // to safely delete this object. | 43 // to safely delete this object. |
44 // Must be called on the UI thread. | 44 // Must be called on the UI thread. |
45 void Destroy(); | 45 void Destroy(); |
46 | 46 |
47 // Resets this object. | 47 // Resets this object. |
48 FileError Reset(); | 48 FileError Reset(); |
49 | 49 |
50 // Returns the largest changestamp. | 50 // Returns the largest changestamp. |
51 int64 GetLargestChangestamp(); | 51 FileError GetLargestChangestamp(int64* out_value); |
52 | 52 |
53 // Sets the largest changestamp. | 53 // Sets the largest changestamp. |
54 FileError SetLargestChangestamp(int64 value); | 54 FileError SetLargestChangestamp(int64 value); |
55 | 55 |
56 // Adds |entry| to the metadata tree based on its parent_local_id. | 56 // Adds |entry| to the metadata tree based on its parent_local_id. |
57 FileError AddEntry(const ResourceEntry& entry, std::string* out_id); | 57 FileError AddEntry(const ResourceEntry& entry, std::string* out_id); |
58 | 58 |
59 // Removes entry with |id| from its parent. | 59 // Removes entry with |id| from its parent. |
60 FileError RemoveEntry(const std::string& id); | 60 FileError RemoveEntry(const std::string& id); |
61 | 61 |
(...skipping 10 matching lines...) Expand all Loading... |
72 ResourceEntryVector* out_entries); | 72 ResourceEntryVector* out_entries); |
73 | 73 |
74 // Finds and reads a directory by |id|. | 74 // Finds and reads a directory by |id|. |
75 FileError ReadDirectoryById(const std::string& id, | 75 FileError ReadDirectoryById(const std::string& id, |
76 ResourceEntryVector* out_entries); | 76 ResourceEntryVector* out_entries); |
77 | 77 |
78 // Replaces an existing entry with the same local ID as |entry|. | 78 // Replaces an existing entry with the same local ID as |entry|. |
79 FileError RefreshEntry(const ResourceEntry& entry); | 79 FileError RefreshEntry(const ResourceEntry& entry); |
80 | 80 |
81 // Recursively gets directories under the entry pointed to by |id|. | 81 // Recursively gets directories under the entry pointed to by |id|. |
82 void GetSubDirectoriesRecursively(const std::string& id, | 82 FileError GetSubDirectoriesRecursively( |
83 std::set<base::FilePath>* sub_directories); | 83 const std::string& id, |
| 84 std::set<base::FilePath>* sub_directories); |
84 | 85 |
85 // Returns the id of the resource named |base_name| directly under | 86 // Returns the id of the resource named |base_name| directly under |
86 // the directory with |parent_local_id|. | 87 // the directory with |parent_local_id|. |
87 // If not found, empty string will be returned. | 88 // If not found, empty string will be returned. |
88 std::string GetChildId(const std::string& parent_local_id, | 89 FileError GetChildId(const std::string& parent_local_id, |
89 const std::string& base_name); | 90 const std::string& base_name, |
| 91 std::string* out_child_id); |
90 | 92 |
91 // Returns an object to iterate over entries. | 93 // Returns an object to iterate over entries. |
92 scoped_ptr<Iterator> GetIterator(); | 94 scoped_ptr<Iterator> GetIterator(); |
93 | 95 |
94 // Returns virtual file path of the entry. | 96 // Returns virtual file path of the entry. |
95 base::FilePath GetFilePath(const std::string& id); | 97 FileError GetFilePath(const std::string& id, base::FilePath* out_file_path); |
96 | 98 |
97 // Returns ID of the entry at the given path. | 99 // Returns ID of the entry at the given path. |
98 FileError GetIdByPath(const base::FilePath& file_path, std::string* out_id); | 100 FileError GetIdByPath(const base::FilePath& file_path, std::string* out_id); |
99 | 101 |
100 // Returns the local ID associated with the given resource ID. | 102 // Returns the local ID associated with the given resource ID. |
101 FileError GetIdByResourceId(const std::string& resource_id, | 103 FileError GetIdByResourceId(const std::string& resource_id, |
102 std::string* out_local_id); | 104 std::string* out_local_id); |
103 | 105 |
104 private: | 106 private: |
105 // Note: Use Destroy() to delete this object. | 107 // Note: Use Destroy() to delete this object. |
(...skipping 22 matching lines...) Expand all Loading... |
128 | 130 |
129 ResourceMetadataStorage* storage_; | 131 ResourceMetadataStorage* storage_; |
130 | 132 |
131 DISALLOW_COPY_AND_ASSIGN(ResourceMetadata); | 133 DISALLOW_COPY_AND_ASSIGN(ResourceMetadata); |
132 }; | 134 }; |
133 | 135 |
134 } // namespace internal | 136 } // namespace internal |
135 } // namespace drive | 137 } // namespace drive |
136 | 138 |
137 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_ | 139 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_H_ |
OLD | NEW |