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

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

Issue 9545006: This adds some GData private API to the file manager (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
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 #include <utility>
10 #include <vector>
9 11
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
12 #include "base/platform_file.h" 14 #include "base/platform_file.h"
13 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
14 #include "chrome/browser/chromeos/gdata/gdata.h" 16 #include "chrome/browser/chromeos/gdata/gdata.h"
15 #include "chrome/browser/chromeos/gdata/gdata_parser.h" 17 #include "chrome/browser/chromeos/gdata/gdata_parser.h"
16 #include "chrome/browser/profiles/profile_keyed_service.h" 18 #include "chrome/browser/profiles/profile_keyed_service.h"
17 #include "chrome/browser/profiles/profile_keyed_service_factory.h" 19 #include "chrome/browser/profiles/profile_keyed_service_factory.h"
18 20
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 private: 62 private:
61 DISALLOW_COPY_AND_ASSIGN(GDataFileBase); 63 DISALLOW_COPY_AND_ASSIGN(GDataFileBase);
62 }; 64 };
63 65
64 typedef std::map<FilePath::StringType, GDataFileBase*> GDataFileCollection; 66 typedef std::map<FilePath::StringType, GDataFileBase*> GDataFileCollection;
65 67
66 // Represents "file" in in a GData virtual file system. On gdata feed side, 68 // 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. 69 // this could be either a regular file or a server side document.
68 class GDataFile : public GDataFileBase { 70 class GDataFile : public GDataFileBase {
69 public: 71 public:
72 typedef std::vector<std::pair<std::string, std::string> > AuthorList;
73
74 // This is used as a bitmask for the pinned state.
75 enum PinnedState {
76 PINNED_STATE_NONE = 0x0,
77 PINNED_STATE_PINNED = 0x1 << 0,
78 PINNED_STATE_PRESENT = 0x1 << 1,
79 };
80
70 explicit GDataFile(GDataDirectory* parent); 81 explicit GDataFile(GDataDirectory* parent);
71 virtual ~GDataFile(); 82 virtual ~GDataFile();
72 virtual GDataFile* AsGDataFile() OVERRIDE; 83 virtual GDataFile* AsGDataFile() OVERRIDE;
73 84
74 static GDataFileBase* FromDocumentEntry(GDataDirectory* parent, 85 static GDataFileBase* FromDocumentEntry(GDataDirectory* parent,
75 DocumentEntry* doc); 86 DocumentEntry* doc);
76 87
77 DocumentEntry::EntryKind kind() const { return kind_; } 88 DocumentEntry::EntryKind kind() const { return kind_; }
78 const GURL& content_url() const { return content_url_; } 89 const GURL& content_url() const { return content_url_; }
90 const GURL& thumbnail_url() const { return thumbnail_url_; }
79 const std::string& content_mime_type() const { return content_mime_type_; } 91 const std::string& content_mime_type() const { return content_mime_type_; }
80 const std::string& etag() const { return etag_; } 92 const std::string& etag() const { return etag_; }
81 const std::string& resource() const { return resource_id_; } 93 const std::string& resource() const { return resource_id_; }
82 const std::string& id() const { return id_; } 94 const std::string& id() const { return id_; }
83 const std::string& file_md5() const { return file_md5_; } 95 const std::string& file_md5() const { return file_md5_; }
96 // Returns a bitmask of PinnedState enum values.
97 const int pinned_state() const { return pinned_state_; }
achuithb 2012/02/29 23:33:06 const int?
Greg Spencer (Chromium) 2012/03/01 02:26:32 Haha! Yes, they're so much more constant this way.
98 const AuthorList& authors() const { return authors_; }
84 99
85 private: 100 private:
86 // Content URL for files. 101 // Content URL for files.
87 DocumentEntry::EntryKind kind_; 102 DocumentEntry::EntryKind kind_;
88 GURL content_url_; 103 GURL content_url_;
104 GURL thumbnail_url_;
89 std::string content_mime_type_; 105 std::string content_mime_type_;
90 std::string etag_; 106 std::string etag_;
91 std::string resource_id_; 107 std::string resource_id_;
92 std::string id_; 108 std::string id_;
93 std::string file_md5_; 109 std::string file_md5_;
110 AuthorList authors_;
zel 2012/02/29 23:46:38 let's just drop authors for there altogether... we
Greg Spencer (Chromium) 2012/03/01 02:26:32 Done.
111 std::string author_email_;
112 int pinned_state_;
94 113
95 DISALLOW_COPY_AND_ASSIGN(GDataFile); 114 DISALLOW_COPY_AND_ASSIGN(GDataFile);
96 }; 115 };
97 116
98 // Represents "directory" in a GData virtual file system. Maps to gdata 117 // Represents "directory" in a GData virtual file system. Maps to gdata
99 // collection element. 118 // collection element.
100 class GDataDirectory : public GDataFileBase { 119 class GDataDirectory : public GDataFileBase {
101 public: 120 public:
102 explicit GDataDirectory(GDataDirectory* parent); 121 explicit GDataDirectory(GDataDirectory* parent);
103 virtual ~GDataDirectory(); 122 virtual ~GDataDirectory();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 }; 346 };
328 347
329 // Singleton that owns all GDataFileSystems and associates them with 348 // Singleton that owns all GDataFileSystems and associates them with
330 // Profiles. 349 // Profiles.
331 class GDataFileSystemFactory : public ProfileKeyedServiceFactory { 350 class GDataFileSystemFactory : public ProfileKeyedServiceFactory {
332 public: 351 public:
333 // Returns the GDataFileSystem for |profile|, creating it if it is not 352 // Returns the GDataFileSystem for |profile|, creating it if it is not
334 // yet created. 353 // yet created.
335 static GDataFileSystem* GetForProfile(Profile* profile); 354 static GDataFileSystem* GetForProfile(Profile* profile);
336 355
337 // Returns the GDataFileSystemFactory instance. 356 // Returns the GDataFileSystemFactory instance.
338 static GDataFileSystemFactory* GetInstance(); 357 static GDataFileSystemFactory* GetInstance();
339 358
340 private: 359 private:
341 friend struct DefaultSingletonTraits<GDataFileSystemFactory>; 360 friend struct DefaultSingletonTraits<GDataFileSystemFactory>;
342 361
343 GDataFileSystemFactory(); 362 GDataFileSystemFactory();
344 virtual ~GDataFileSystemFactory(); 363 virtual ~GDataFileSystemFactory();
345 364
346 // ProfileKeyedServiceFactory: 365 // ProfileKeyedServiceFactory:
347 virtual ProfileKeyedService* BuildServiceInstanceFor( 366 virtual ProfileKeyedService* BuildServiceInstanceFor(
348 Profile* profile) const OVERRIDE; 367 Profile* profile) const OVERRIDE;
349 }; 368 };
350 369
351 } // namespace gdata 370 } // namespace gdata
352 371
353 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ 372 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698