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

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

Issue 10116044: gdata: Support mounting archive files in GData cache. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: gdata: Support mounting archive files in GData cache. Created 8 years, 8 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_FILES_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // Represents "file" in in a GData virtual file system. On gdata feed side, 155 // Represents "file" in in a GData virtual file system. On gdata feed side,
156 // this could be either a regular file or a server side document. 156 // this could be either a regular file or a server side document.
157 class GDataFile : public GDataEntry { 157 class GDataFile : public GDataEntry {
158 public: 158 public:
159 // This is used as a bitmask for the cache state. 159 // This is used as a bitmask for the cache state.
160 enum CacheState { 160 enum CacheState {
161 CACHE_STATE_NONE = 0x0, 161 CACHE_STATE_NONE = 0x0,
162 CACHE_STATE_PINNED = 0x1 << 0, 162 CACHE_STATE_PINNED = 0x1 << 0,
163 CACHE_STATE_PRESENT = 0x1 << 1, 163 CACHE_STATE_PRESENT = 0x1 << 1,
164 CACHE_STATE_DIRTY = 0x1 << 2, 164 CACHE_STATE_DIRTY = 0x1 << 2,
165 CACHE_STATE_MOUNTED = 0x1 << 3,
165 }; 166 };
166 167
167 explicit GDataFile(GDataDirectory* parent, GDataRootDirectory* root); 168 explicit GDataFile(GDataDirectory* parent, GDataRootDirectory* root);
168 virtual ~GDataFile(); 169 virtual ~GDataFile();
169 virtual GDataFile* AsGDataFile() OVERRIDE; 170 virtual GDataFile* AsGDataFile() OVERRIDE;
170 171
171 static GDataEntry* FromDocumentEntry(GDataDirectory* parent, 172 static GDataEntry* FromDocumentEntry(GDataDirectory* parent,
172 DocumentEntry* doc, 173 DocumentEntry* doc,
173 GDataRootDirectory* root); 174 GDataRootDirectory* root);
174 175
175 // Convert to/from proto. 176 // Convert to/from proto.
176 void FromProto(const GDataFileProto& proto); 177 void FromProto(const GDataFileProto& proto);
177 void ToProto(GDataFileProto* proto) const; 178 void ToProto(GDataFileProto* proto) const;
178 179
179 static bool IsCachePresent(int cache_state) { 180 static bool IsCachePresent(int cache_state) {
180 return cache_state & CACHE_STATE_PRESENT; 181 return cache_state & CACHE_STATE_PRESENT;
181 } 182 }
182 static bool IsCachePinned(int cache_state) { 183 static bool IsCachePinned(int cache_state) {
183 return cache_state & CACHE_STATE_PINNED; 184 return cache_state & CACHE_STATE_PINNED;
184 } 185 }
185 static bool IsCacheDirty(int cache_state) { 186 static bool IsCacheDirty(int cache_state) {
186 return cache_state & CACHE_STATE_DIRTY; 187 return cache_state & CACHE_STATE_DIRTY;
187 } 188 }
189 static bool IsCacheMounted(int cache_state) {
190 return cache_state & CACHE_STATE_MOUNTED;
191 }
188 static int SetCachePresent(int cache_state) { 192 static int SetCachePresent(int cache_state) {
189 return cache_state |= CACHE_STATE_PRESENT; 193 return cache_state |= CACHE_STATE_PRESENT;
190 } 194 }
191 static int SetCachePinned(int cache_state) { 195 static int SetCachePinned(int cache_state) {
192 return cache_state |= CACHE_STATE_PINNED; 196 return cache_state |= CACHE_STATE_PINNED;
193 } 197 }
194 static int SetCacheDirty(int cache_state) { 198 static int SetCacheDirty(int cache_state) {
195 return cache_state |= CACHE_STATE_DIRTY; 199 return cache_state |= CACHE_STATE_DIRTY;
196 } 200 }
201 static int SetCacheMounted(int cache_state) {
202 return cache_state |= CACHE_STATE_MOUNTED;
203 }
197 static int ClearCachePresent(int cache_state) { 204 static int ClearCachePresent(int cache_state) {
198 return cache_state &= ~CACHE_STATE_PRESENT; 205 return cache_state &= ~CACHE_STATE_PRESENT;
199 } 206 }
200 static int ClearCachePinned(int cache_state) { 207 static int ClearCachePinned(int cache_state) {
201 return cache_state &= ~CACHE_STATE_PINNED; 208 return cache_state &= ~CACHE_STATE_PINNED;
202 } 209 }
203 static int ClearCacheDirty(int cache_state) { 210 static int ClearCacheDirty(int cache_state) {
204 return cache_state &= ~CACHE_STATE_DIRTY; 211 return cache_state &= ~CACHE_STATE_DIRTY;
205 } 212 }
213 static int ClearCacheMounted(int cache_state) {
214 return cache_state &= ~CACHE_STATE_MOUNTED;
215 }
206 216
207 DocumentEntry::EntryKind kind() const { return kind_; } 217 DocumentEntry::EntryKind kind() const { return kind_; }
208 const GURL& thumbnail_url() const { return thumbnail_url_; } 218 const GURL& thumbnail_url() const { return thumbnail_url_; }
209 const GURL& alternate_url() const { return alternate_url_; } 219 const GURL& alternate_url() const { return alternate_url_; }
210 const std::string& content_mime_type() const { return content_mime_type_; } 220 const std::string& content_mime_type() const { return content_mime_type_; }
211 const std::string& etag() const { return etag_; } 221 const std::string& etag() const { return etag_; }
212 const std::string& id() const { return id_; } 222 const std::string& id() const { return id_; }
213 const std::string& file_md5() const { return file_md5_; } 223 const std::string& file_md5() const { return file_md5_; }
214 const std::string& document_extension() const { return document_extension_; } 224 const std::string& document_extension() const { return document_extension_; }
215 bool is_hosted_document() const { return is_hosted_document_; } 225 bool is_hosted_document() const { return is_hosted_document_; }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 357
348 bool IsPresent() const { 358 bool IsPresent() const {
349 return GDataFile::IsCachePresent(cache_state); 359 return GDataFile::IsCachePresent(cache_state);
350 } 360 }
351 bool IsPinned() const { 361 bool IsPinned() const {
352 return GDataFile::IsCachePinned(cache_state); 362 return GDataFile::IsCachePinned(cache_state);
353 } 363 }
354 bool IsDirty() const { 364 bool IsDirty() const {
355 return GDataFile::IsCacheDirty(cache_state); 365 return GDataFile::IsCacheDirty(cache_state);
356 } 366 }
367 bool IsMounted() const {
368 return GDataFile::IsCacheMounted(cache_state);
369 }
357 370
358 // For debugging purposes. 371 // For debugging purposes.
359 std::string ToString() const; 372 std::string ToString() const;
360 373
361 std::string md5; 374 std::string md5;
362 CacheSubDirectoryType sub_dir_type; 375 CacheSubDirectoryType sub_dir_type;
363 int cache_state; 376 int cache_state;
364 }; 377 };
365 378
366 // A map table of cache file's resource id to its CacheEntry* entry. 379 // A map table of cache file's resource id to its CacheEntry* entry.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 base::Time last_serialized_; 451 base::Time last_serialized_;
439 int largest_changestamp_; 452 int largest_changestamp_;
440 size_t serialized_size_; 453 size_t serialized_size_;
441 454
442 DISALLOW_COPY_AND_ASSIGN(GDataRootDirectory); 455 DISALLOW_COPY_AND_ASSIGN(GDataRootDirectory);
443 }; 456 };
444 457
445 } // namespace gdata 458 } // namespace gdata
446 459
447 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ 460 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc ('k') | chrome/browser/chromeos/gdata/gdata_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698