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_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 private: | 60 private: |
61 DISALLOW_COPY_AND_ASSIGN(GDataFileBase); | 61 DISALLOW_COPY_AND_ASSIGN(GDataFileBase); |
62 }; | 62 }; |
63 | 63 |
64 typedef std::map<FilePath::StringType, GDataFileBase*> GDataFileCollection; | 64 typedef std::map<FilePath::StringType, GDataFileBase*> GDataFileCollection; |
65 | 65 |
66 // Represents "file" in in a GData virtual file system. On gdata feed side, | 66 // Represents "file" in in a GData virtual file system. On gdata feed side, |
67 // this could be either a regular file or a server side document. | 67 // this could be either a regular file or a server side document. |
68 class GDataFile : public GDataFileBase { | 68 class GDataFile : public GDataFileBase { |
69 public: | 69 public: |
70 // This is used as a bitmask for the cache state. | |
71 enum CacheState { | |
72 CACHE_STATE_NONE = 0x0, | |
73 CACHE_STATE_PINNED = 0x1 << 0, | |
74 CACHE_STATE_PRESENT = 0x1 << 1, | |
75 CACHE_STATE_DIRTY = 0x1 << 2, | |
76 }; | |
77 | |
70 explicit GDataFile(GDataDirectory* parent); | 78 explicit GDataFile(GDataDirectory* parent); |
71 virtual ~GDataFile(); | 79 virtual ~GDataFile(); |
72 virtual GDataFile* AsGDataFile() OVERRIDE; | 80 virtual GDataFile* AsGDataFile() OVERRIDE; |
73 | 81 |
74 static GDataFileBase* FromDocumentEntry(GDataDirectory* parent, | 82 static GDataFileBase* FromDocumentEntry(GDataDirectory* parent, |
75 DocumentEntry* doc); | 83 DocumentEntry* doc); |
76 | 84 |
77 DocumentEntry::EntryKind kind() const { return kind_; } | 85 DocumentEntry::EntryKind kind() const { return kind_; } |
78 const GURL& content_url() const { return content_url_; } | 86 const GURL& content_url() const { return content_url_; } |
87 const GURL& thumbnail_url() const { return edit_url_; } | |
zel
2012/03/01 22:14:18
thumbnail_url_
| |
88 const GURL& edit_url() const { return thumbnail_url_; } | |
zel
2012/03/01 22:14:18
edit_url_
| |
79 const std::string& content_mime_type() const { return content_mime_type_; } | 89 const std::string& content_mime_type() const { return content_mime_type_; } |
80 const std::string& etag() const { return etag_; } | 90 const std::string& etag() const { return etag_; } |
81 const std::string& resource() const { return resource_id_; } | 91 const std::string& resource() const { return resource_id_; } |
82 const std::string& id() const { return id_; } | 92 const std::string& id() const { return id_; } |
83 const std::string& file_md5() const { return file_md5_; } | 93 const std::string& file_md5() const { return file_md5_; } |
94 // Returns a bitmask of CacheState enum values. | |
95 const int cache_state() const { return cache_state_; } | |
84 | 96 |
85 private: | 97 private: |
86 // Content URL for files. | 98 // Content URL for files. |
87 DocumentEntry::EntryKind kind_; | 99 DocumentEntry::EntryKind kind_; |
88 GURL content_url_; | 100 GURL content_url_; |
101 GURL thumbnail_url_; | |
102 GURL edit_url_; | |
89 std::string content_mime_type_; | 103 std::string content_mime_type_; |
90 std::string etag_; | 104 std::string etag_; |
91 std::string resource_id_; | 105 std::string resource_id_; |
92 std::string id_; | 106 std::string id_; |
93 std::string file_md5_; | 107 std::string file_md5_; |
108 int cache_state_; | |
94 | 109 |
95 DISALLOW_COPY_AND_ASSIGN(GDataFile); | 110 DISALLOW_COPY_AND_ASSIGN(GDataFile); |
96 }; | 111 }; |
97 | 112 |
98 // Represents "directory" in a GData virtual file system. Maps to gdata | 113 // Represents "directory" in a GData virtual file system. Maps to gdata |
99 // collection element. | 114 // collection element. |
100 class GDataDirectory : public GDataFileBase { | 115 class GDataDirectory : public GDataFileBase { |
101 public: | 116 public: |
102 explicit GDataDirectory(GDataDirectory* parent); | 117 explicit GDataDirectory(GDataDirectory* parent); |
103 virtual ~GDataDirectory(); | 118 virtual ~GDataDirectory(); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 }; | 343 }; |
329 | 344 |
330 // Singleton that owns all GDataFileSystems and associates them with | 345 // Singleton that owns all GDataFileSystems and associates them with |
331 // Profiles. | 346 // Profiles. |
332 class GDataFileSystemFactory : public ProfileKeyedServiceFactory { | 347 class GDataFileSystemFactory : public ProfileKeyedServiceFactory { |
333 public: | 348 public: |
334 // Returns the GDataFileSystem for |profile|, creating it if it is not | 349 // Returns the GDataFileSystem for |profile|, creating it if it is not |
335 // yet created. | 350 // yet created. |
336 static GDataFileSystem* GetForProfile(Profile* profile); | 351 static GDataFileSystem* GetForProfile(Profile* profile); |
337 | 352 |
338 // Returns the GDataFileSystemFactory instance. | 353 // Returns the GDataFileSystemFactory instance. |
339 static GDataFileSystemFactory* GetInstance(); | 354 static GDataFileSystemFactory* GetInstance(); |
340 | 355 |
341 private: | 356 private: |
342 friend struct DefaultSingletonTraits<GDataFileSystemFactory>; | 357 friend struct DefaultSingletonTraits<GDataFileSystemFactory>; |
343 | 358 |
344 GDataFileSystemFactory(); | 359 GDataFileSystemFactory(); |
345 virtual ~GDataFileSystemFactory(); | 360 virtual ~GDataFileSystemFactory(); |
346 | 361 |
347 // ProfileKeyedServiceFactory: | 362 // ProfileKeyedServiceFactory: |
348 virtual ProfileKeyedService* BuildServiceInstanceFor( | 363 virtual ProfileKeyedService* BuildServiceInstanceFor( |
349 Profile* profile) const OVERRIDE; | 364 Profile* profile) const OVERRIDE; |
350 }; | 365 }; |
351 | 366 |
352 } // namespace gdata | 367 } // namespace gdata |
353 | 368 |
354 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 369 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |