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_CACHE_ENTRY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_ENTRY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_ENTRY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_ENTRY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace gdata { | 10 namespace gdata { |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 GDataCacheEntry(const std::string& md5, | 28 GDataCacheEntry(const std::string& md5, |
29 int cache_state) | 29 int cache_state) |
30 : md5_(md5), | 30 : md5_(md5), |
31 cache_state_(cache_state) { | 31 cache_state_(cache_state) { |
32 } | 32 } |
33 | 33 |
34 // The MD5 of the cache file. This can be "local" if the file is | 34 // The MD5 of the cache file. This can be "local" if the file is |
35 // locally modified. | 35 // locally modified. |
36 const std::string& md5() const { return md5_; } | 36 const std::string& md5() const { return md5_; } |
| 37 void set_md5(const std::string& md5) { md5_ = md5; } |
37 | 38 |
38 // The cache state represented as a bitmask of GDataCacheState. | 39 // The cache state represented as a bitmask of GDataCacheState. |
| 40 // TODO(satorux): Remove this: crrev.com/136921 |
39 int cache_state() const { return cache_state_; } | 41 int cache_state() const { return cache_state_; } |
40 | 42 |
41 void set_md5(const std::string& md5) { md5_ = md5; } | |
42 void set_cache_state(int cache_state) { cache_state_ = cache_state; } | |
43 | |
44 // Returns true if the file is present locally. | 43 // Returns true if the file is present locally. |
45 bool IsPresent() const { return cache_state_ & CACHE_STATE_PRESENT; } | 44 bool IsPresent() const { return cache_state_ & CACHE_STATE_PRESENT; } |
46 | 45 |
47 // Returns true if the file is pinned (i.e. available offline). | 46 // Returns true if the file is pinned (i.e. available offline). |
48 bool IsPinned() const { return cache_state_ & CACHE_STATE_PINNED; } | 47 bool IsPinned() const { return cache_state_ & CACHE_STATE_PINNED; } |
49 | 48 |
50 // Returns true if the file is dirty (i.e. modified locally). | 49 // Returns true if the file is dirty (i.e. modified locally). |
51 bool IsDirty() const { return cache_state_ & CACHE_STATE_DIRTY; } | 50 bool IsDirty() const { return cache_state_ & CACHE_STATE_DIRTY; } |
52 | 51 |
53 // Returns true if the file is a mounted archive file. | 52 // Returns true if the file is a mounted archive file. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 std::string ToString() const; | 91 std::string ToString() const; |
93 | 92 |
94 private: | 93 private: |
95 std::string md5_; | 94 std::string md5_; |
96 int cache_state_; | 95 int cache_state_; |
97 }; | 96 }; |
98 | 97 |
99 } // namespace gdata | 98 } // namespace gdata |
100 | 99 |
101 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_ENTRY_H_ | 100 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_ENTRY_H_ |
OLD | NEW |