| 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_GDATA_GDATA_DIRECTORY_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Used to get entry info from the file system. | 82 // Used to get entry info from the file system. |
| 83 // If |error| is not GDATA_FILE_OK, |entry_info| is set to NULL. | 83 // If |error| is not GDATA_FILE_OK, |entry_info| is set to NULL. |
| 84 typedef base::Callback<void(GDataFileError error, | 84 typedef base::Callback<void(GDataFileError error, |
| 85 scoped_ptr<GDataEntryProto> entry_proto)> | 85 scoped_ptr<GDataEntryProto> entry_proto)> |
| 86 GetEntryInfoCallback; | 86 GetEntryInfoCallback; |
| 87 | 87 |
| 88 typedef base::Callback<void(GDataFileError error, | 88 typedef base::Callback<void(GDataFileError error, |
| 89 scoped_ptr<GDataEntryProtoVector> entries)> | 89 scoped_ptr<GDataEntryProtoVector> entries)> |
| 90 ReadDirectoryCallback; | 90 ReadDirectoryCallback; |
| 91 | 91 |
| 92 // Used to get entry info from the file system, with the Drive file path. |
| 93 // If |error| is not GDATA_FILE_OK, |entry_proto| is set to NULL. |
| 94 // |
| 95 // |drive_file_path| parameter is provided as GDataEntryProto does not contain |
| 96 // the Drive file path (i.e. only contains the base name without parent |
| 97 // directory names). |
| 98 typedef base::Callback<void(GDataFileError error, |
| 99 const FilePath& drive_file_path, |
| 100 scoped_ptr<GDataEntryProto> entry_proto)> |
| 101 GetEntryInfoWithFilePathCallback; |
| 102 |
| 92 // This is a part of EntryInfoPairResult. | 103 // This is a part of EntryInfoPairResult. |
| 93 struct EntryInfoResult { | 104 struct EntryInfoResult { |
| 94 EntryInfoResult(); | 105 EntryInfoResult(); |
| 95 ~EntryInfoResult(); | 106 ~EntryInfoResult(); |
| 96 | 107 |
| 97 FilePath path; | 108 FilePath path; |
| 98 GDataFileError error; | 109 GDataFileError error; |
| 99 scoped_ptr<GDataEntryProto> proto; | 110 scoped_ptr<GDataEntryProto> proto; |
| 100 }; | 111 }; |
| 101 | 112 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // Returns the GDataEntry* in the callback with the corresponding | 206 // Returns the GDataEntry* in the callback with the corresponding |
| 196 // |resource_id|. TODO(satorux): Remove this in favor of | 207 // |resource_id|. TODO(satorux): Remove this in favor of |
| 197 // GetEntryInfoByResourceId(). crbug.com/137512 | 208 // GetEntryInfoByResourceId(). crbug.com/137512 |
| 198 void GetEntryByResourceIdAsync(const std::string& resource_id, | 209 void GetEntryByResourceIdAsync(const std::string& resource_id, |
| 199 const GetEntryByResourceIdCallback& callback); | 210 const GetEntryByResourceIdCallback& callback); |
| 200 | 211 |
| 201 // Finds an entry (a file or a directory) by |resource_id|. | 212 // Finds an entry (a file or a directory) by |resource_id|. |
| 202 // | 213 // |
| 203 // Must be called from UI thread. |callback| is run on UI thread. | 214 // Must be called from UI thread. |callback| is run on UI thread. |
| 204 // |callback| must not be null. | 215 // |callback| must not be null. |
| 205 void GetEntryInfoByResourceId(const std::string& resource_id, | 216 void GetEntryInfoByResourceId( |
| 206 const GetEntryInfoCallback& callback); | 217 const std::string& resource_id, |
| 218 const GetEntryInfoWithFilePathCallback& callback); |
| 207 | 219 |
| 208 // Finds an entry (a file or a directory) by |file_path|. | 220 // Finds an entry (a file or a directory) by |file_path|. |
| 209 // | 221 // |
| 210 // Must be called from UI thread. |callback| is run on UI thread. | 222 // Must be called from UI thread. |callback| is run on UI thread. |
| 211 // |callback| must not be null. | 223 // |callback| must not be null. |
| 212 void GetEntryInfoByPath(const FilePath& file_path, | 224 void GetEntryInfoByPath(const FilePath& file_path, |
| 213 const GetEntryInfoCallback& callback); | 225 const GetEntryInfoCallback& callback); |
| 214 | 226 |
| 215 // Finds and reads a directory by |file_path|. | 227 // Finds and reads a directory by |file_path|. |
| 216 // | 228 // |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // This should remain the last member so it'll be destroyed first and | 324 // This should remain the last member so it'll be destroyed first and |
| 313 // invalidate its weak pointers before other members are destroyed. | 325 // invalidate its weak pointers before other members are destroyed. |
| 314 base::WeakPtrFactory<GDataDirectoryService> weak_ptr_factory_; | 326 base::WeakPtrFactory<GDataDirectoryService> weak_ptr_factory_; |
| 315 | 327 |
| 316 DISALLOW_COPY_AND_ASSIGN(GDataDirectoryService); | 328 DISALLOW_COPY_AND_ASSIGN(GDataDirectoryService); |
| 317 }; | 329 }; |
| 318 | 330 |
| 319 } // namespace gdata | 331 } // namespace gdata |
| 320 | 332 |
| 321 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ | 333 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DIRECTORY_SERVICE_H_ |
| OLD | NEW |