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 pinned state. | |
71 enum PinnedState { | |
72 PINNED_STATE_NONE = 0x0, | |
73 PINNED_STATE_PINNED = 0x1 << 0, | |
74 PINNED_STATE_PRESENT = 0x1 << 1, | |
75 }; | |
76 | |
70 explicit GDataFile(GDataDirectory* parent); | 77 explicit GDataFile(GDataDirectory* parent); |
71 virtual ~GDataFile(); | 78 virtual ~GDataFile(); |
72 virtual GDataFile* AsGDataFile() OVERRIDE; | 79 virtual GDataFile* AsGDataFile() OVERRIDE; |
73 | 80 |
74 static GDataFileBase* FromDocumentEntry(GDataDirectory* parent, | 81 static GDataFileBase* FromDocumentEntry(GDataDirectory* parent, |
75 DocumentEntry* doc); | 82 DocumentEntry* doc); |
76 | 83 |
77 DocumentEntry::EntryKind kind() const { return kind_; } | 84 DocumentEntry::EntryKind kind() const { return kind_; } |
78 const GURL& content_url() const { return content_url_; } | 85 const GURL& content_url() const { return content_url_; } |
86 const GURL& thumbnail_url() const { return thumbnail_url_; } | |
79 const std::string& content_mime_type() const { return content_mime_type_; } | 87 const std::string& content_mime_type() const { return content_mime_type_; } |
80 const std::string& etag() const { return etag_; } | 88 const std::string& etag() const { return etag_; } |
81 const std::string& resource() const { return resource_id_; } | 89 const std::string& resource() const { return resource_id_; } |
82 const std::string& id() const { return id_; } | 90 const std::string& id() const { return id_; } |
83 const std::string& file_md5() const { return file_md5_; } | 91 const std::string& file_md5() const { return file_md5_; } |
92 // Returns a bitmask of PinnedState enum values. | |
93 const int pinned_state() const { return pinned_state_; } | |
84 | 94 |
85 private: | 95 private: |
86 // Content URL for files. | 96 // Content URL for files. |
87 DocumentEntry::EntryKind kind_; | 97 DocumentEntry::EntryKind kind_; |
88 GURL content_url_; | 98 GURL content_url_; |
99 GURL thumbnail_url_; | |
89 std::string content_mime_type_; | 100 std::string content_mime_type_; |
90 std::string etag_; | 101 std::string etag_; |
91 std::string resource_id_; | 102 std::string resource_id_; |
92 std::string id_; | 103 std::string id_; |
93 std::string file_md5_; | 104 std::string file_md5_; |
105 int pinned_state_; | |
94 | 106 |
95 DISALLOW_COPY_AND_ASSIGN(GDataFile); | 107 DISALLOW_COPY_AND_ASSIGN(GDataFile); |
96 }; | 108 }; |
97 | 109 |
98 // Represents "directory" in a GData virtual file system. Maps to gdata | 110 // Represents "directory" in a GData virtual file system. Maps to gdata |
99 // collection element. | 111 // collection element. |
100 class GDataDirectory : public GDataFileBase { | 112 class GDataDirectory : public GDataFileBase { |
101 public: | 113 public: |
102 explicit GDataDirectory(GDataDirectory* parent); | 114 explicit GDataDirectory(GDataDirectory* parent); |
103 virtual ~GDataDirectory(); | 115 virtual ~GDataDirectory(); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 }; | 339 }; |
328 | 340 |
329 // Singleton that owns all GDataFileSystems and associates them with | 341 // Singleton that owns all GDataFileSystems and associates them with |
330 // Profiles. | 342 // Profiles. |
331 class GDataFileSystemFactory : public ProfileKeyedServiceFactory { | 343 class GDataFileSystemFactory : public ProfileKeyedServiceFactory { |
332 public: | 344 public: |
333 // Returns the GDataFileSystem for |profile|, creating it if it is not | 345 // Returns the GDataFileSystem for |profile|, creating it if it is not |
334 // yet created. | 346 // yet created. |
335 static GDataFileSystem* GetForProfile(Profile* profile); | 347 static GDataFileSystem* GetForProfile(Profile* profile); |
336 | 348 |
337 // Returns the GDataFileSystemFactory instance. | 349 // Returns the GDataFileSystemFactory instance. |
Greg Spencer (Chromium)
2012/03/01 02:31:47
This is different (even if Rietveld doesn't show i
| |
338 static GDataFileSystemFactory* GetInstance(); | 350 static GDataFileSystemFactory* GetInstance(); |
339 | 351 |
340 private: | 352 private: |
341 friend struct DefaultSingletonTraits<GDataFileSystemFactory>; | 353 friend struct DefaultSingletonTraits<GDataFileSystemFactory>; |
342 | 354 |
343 GDataFileSystemFactory(); | 355 GDataFileSystemFactory(); |
344 virtual ~GDataFileSystemFactory(); | 356 virtual ~GDataFileSystemFactory(); |
345 | 357 |
346 // ProfileKeyedServiceFactory: | 358 // ProfileKeyedServiceFactory: |
347 virtual ProfileKeyedService* BuildServiceInstanceFor( | 359 virtual ProfileKeyedService* BuildServiceInstanceFor( |
348 Profile* profile) const OVERRIDE; | 360 Profile* profile) const OVERRIDE; |
349 }; | 361 }; |
350 | 362 |
351 } // namespace gdata | 363 } // namespace gdata |
352 | 364 |
353 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 365 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |