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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system.h

Issue 9570031: This adds some more attributes to the GData files. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Upload after merge Created 8 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_file_system.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 private: 65 private:
66 DISALLOW_COPY_AND_ASSIGN(GDataFileBase); 66 DISALLOW_COPY_AND_ASSIGN(GDataFileBase);
67 }; 67 };
68 68
69 typedef std::map<FilePath::StringType, GDataFileBase*> GDataFileCollection; 69 typedef std::map<FilePath::StringType, GDataFileBase*> GDataFileCollection;
70 70
71 // Represents "file" in in a GData virtual file system. On gdata feed side, 71 // Represents "file" in in a GData virtual file system. On gdata feed side,
72 // this could be either a regular file or a server side document. 72 // this could be either a regular file or a server side document.
73 class GDataFile : public GDataFileBase { 73 class GDataFile : public GDataFileBase {
74 public: 74 public:
75 // This is used as a bitmask for the cache state.
76 enum CacheState {
77 CACHE_STATE_NONE = 0x0,
78 CACHE_STATE_PINNED = 0x1 << 0,
79 CACHE_STATE_PRESENT = 0x1 << 1,
80 CACHE_STATE_DIRTY = 0x1 << 2,
81 };
82
75 explicit GDataFile(GDataDirectory* parent); 83 explicit GDataFile(GDataDirectory* parent);
76 virtual ~GDataFile(); 84 virtual ~GDataFile();
77 virtual GDataFile* AsGDataFile() OVERRIDE; 85 virtual GDataFile* AsGDataFile() OVERRIDE;
78 86
79 static GDataFileBase* FromDocumentEntry(GDataDirectory* parent, 87 static GDataFileBase* FromDocumentEntry(GDataDirectory* parent,
80 DocumentEntry* doc); 88 DocumentEntry* doc);
81 89
82 DocumentEntry::EntryKind kind() const { return kind_; } 90 DocumentEntry::EntryKind kind() const { return kind_; }
91 const GURL& thumbnail_url() const { return thumbnail_url_; }
92 const GURL& edit_url() const { return edit_url_; }
83 const std::string& content_mime_type() const { return content_mime_type_; } 93 const std::string& content_mime_type() const { return content_mime_type_; }
84 const std::string& etag() const { return etag_; } 94 const std::string& etag() const { return etag_; }
85 const std::string& resource() const { return resource_id_; } 95 const std::string& resource() const { return resource_id_; }
86 const std::string& id() const { return id_; } 96 const std::string& id() const { return id_; }
87 const std::string& file_md5() const { return file_md5_; } 97 const std::string& file_md5() const { return file_md5_; }
98 // Returns a bitmask of CacheState enum values.
99 const int cache_state() const { return cache_state_; }
88 100
89 private: 101 private:
90 // Content URL for files. 102 // Content URL for files.
91 DocumentEntry::EntryKind kind_; 103 DocumentEntry::EntryKind kind_;
104 GURL thumbnail_url_;
105 GURL edit_url_;
92 std::string content_mime_type_; 106 std::string content_mime_type_;
93 std::string etag_; 107 std::string etag_;
94 std::string resource_id_; 108 std::string resource_id_;
95 std::string id_; 109 std::string id_;
96 std::string file_md5_; 110 std::string file_md5_;
111 int cache_state_;
97 112
98 DISALLOW_COPY_AND_ASSIGN(GDataFile); 113 DISALLOW_COPY_AND_ASSIGN(GDataFile);
99 }; 114 };
100 115
101 // Represents "directory" in a GData virtual file system. Maps to gdata 116 // Represents "directory" in a GData virtual file system. Maps to gdata
102 // collection element. 117 // collection element.
103 class GDataDirectory : public GDataFileBase { 118 class GDataDirectory : public GDataFileBase {
104 public: 119 public:
105 explicit GDataDirectory(GDataDirectory* parent); 120 explicit GDataDirectory(GDataDirectory* parent);
106 virtual ~GDataDirectory(); 121 virtual ~GDataDirectory();
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 }; 419 };
405 420
406 // Singleton that owns all GDataFileSystems and associates them with 421 // Singleton that owns all GDataFileSystems and associates them with
407 // Profiles. 422 // Profiles.
408 class GDataFileSystemFactory : public ProfileKeyedServiceFactory { 423 class GDataFileSystemFactory : public ProfileKeyedServiceFactory {
409 public: 424 public:
410 // Returns the GDataFileSystem for |profile|, creating it if it is not 425 // Returns the GDataFileSystem for |profile|, creating it if it is not
411 // yet created. 426 // yet created.
412 static GDataFileSystem* GetForProfile(Profile* profile); 427 static GDataFileSystem* GetForProfile(Profile* profile);
413 428
414 // Returns the GDataFileSystemFactory instance. 429 // Returns the GDataFileSystemFactory instance.
415 static GDataFileSystemFactory* GetInstance(); 430 static GDataFileSystemFactory* GetInstance();
416 431
417 private: 432 private:
418 friend struct DefaultSingletonTraits<GDataFileSystemFactory>; 433 friend struct DefaultSingletonTraits<GDataFileSystemFactory>;
419 434
420 GDataFileSystemFactory(); 435 GDataFileSystemFactory();
421 virtual ~GDataFileSystemFactory(); 436 virtual ~GDataFileSystemFactory();
422 437
423 // ProfileKeyedServiceFactory: 438 // ProfileKeyedServiceFactory:
424 virtual ProfileKeyedService* BuildServiceInstanceFor( 439 virtual ProfileKeyedService* BuildServiceInstanceFor(
425 Profile* profile) const OVERRIDE; 440 Profile* profile) const OVERRIDE;
426 }; 441 };
427 442
428 } // namespace gdata 443 } // namespace gdata
429 444
430 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 445 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_file_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698