Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: chrome/browser/chromeos/drive/drive_resource_metadata.h

Issue 11227020: Set root resource ID upon full feed update. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make root_resource_id() work when root_ is not initialized. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // Content is initialized from disk cache. 52 // Content is initialized from disk cache.
53 FROM_CACHE, 53 FROM_CACHE,
54 // Content is initialized from the direct server response. 54 // Content is initialized from the direct server response.
55 FROM_SERVER, 55 FROM_SERVER,
56 }; 56 };
57 57
58 // The root directory name used for the Google Drive file system tree. The 58 // The root directory name used for the Google Drive file system tree. The
59 // name is used in URLs for the file manager, hence user-visible. 59 // name is used in URLs for the file manager, hence user-visible.
60 const FilePath::CharType kDriveRootDirectory[] = FILE_PATH_LITERAL("drive"); 60 const FilePath::CharType kDriveRootDirectory[] = FILE_PATH_LITERAL("drive");
61 61
62 // The resource ID for the root directory is defined in the spec: 62 // The resource ID for the root directory for WAPI is defined in the spec:
63 // https://developers.google.com/google-apps/documents-list/ 63 // https://developers.google.com/google-apps/documents-list/
64 const char kDriveRootDirectoryResourceId[] = "folder:root"; 64 // Note that this special ID only applies to WAPI. Drive uses a non-constant
65 // unique ID given in About resource.
66 const char kWAPIRootDirectoryResourceId[] = "folder:root";
65 67
66 // This should be incremented when incompatibility change is made in 68 // This should be incremented when incompatibility change is made in
67 // drive.proto. 69 // drive.proto.
68 const int32 kProtoVersion = 2; 70 const int32 kProtoVersion = 2;
69 71
70 // Used for file operations like removing files. 72 // Used for file operations like removing files.
71 typedef base::Callback<void(DriveFileError error)> 73 typedef base::Callback<void(DriveFileError error)>
72 FileOperationCallback; 74 FileOperationCallback;
73 75
74 // Callback similar to FileOperationCallback but with a given |file_path|. 76 // Callback similar to FileOperationCallback but with a given |file_path|.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 void SerializeToString(std::string* serialized_proto) const; 257 void SerializeToString(std::string* serialized_proto) const;
256 bool ParseFromString(const std::string& serialized_proto); 258 bool ParseFromString(const std::string& serialized_proto);
257 259
258 // Restores from and saves to database, calling |callback| asynchronously. 260 // Restores from and saves to database, calling |callback| asynchronously.
259 // |callback| must not be null. 261 // |callback| must not be null.
260 void InitFromDB(const FilePath& db_path, 262 void InitFromDB(const FilePath& db_path,
261 base::SequencedTaskRunner* blocking_task_runner, 263 base::SequencedTaskRunner* blocking_task_runner,
262 const FileOperationCallback& callback); 264 const FileOperationCallback& callback);
263 void SaveToDB(); 265 void SaveToDB();
264 266
267 // Returns the resource ID of the root directory or empty string if it is
268 // not initialized.
269 const std::string root_resource_id() const;
satorux1 2012/10/23 08:06:26 Drop the first const. Besides, this seems to be o
kochi 2012/10/23 08:21:21 Done.
270
265 private: 271 private:
266 // Initializes the resource map using serialized_resources fetched from the 272 // Initializes the resource map using serialized_resources fetched from the
267 // database. 273 // database.
268 // |callback| must not be null. 274 // |callback| must not be null.
269 void InitResourceMap(CreateDBParams* create_params, 275 void InitResourceMap(CreateDBParams* create_params,
270 const FileOperationCallback& callback); 276 const FileOperationCallback& callback);
271 277
272 // Clears root_ and the resource map. 278 // Clears root_ and the resource map.
273 void ClearRoot(); 279 void ClearRoot();
274 280
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // This should remain the last member so it'll be destroyed first and 321 // This should remain the last member so it'll be destroyed first and
316 // invalidate its weak pointers before other members are destroyed. 322 // invalidate its weak pointers before other members are destroyed.
317 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; 323 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_;
318 324
319 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); 325 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata);
320 }; 326 };
321 327
322 } // namespace drive 328 } // namespace drive
323 329
324 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ 330 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698