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_DB_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Fetches a GDataEntry* by key |resource_id| or |path| respectively. | 40 // Fetches a GDataEntry* by key |resource_id| or |path| respectively. |
41 virtual Status GetByResourceId(const std::string& resource_id, | 41 virtual Status GetByResourceId(const std::string& resource_id, |
42 scoped_ptr<GDataEntry>* entry) = 0; | 42 scoped_ptr<GDataEntry>* entry) = 0; |
43 virtual Status GetByPath(const FilePath& path, | 43 virtual Status GetByPath(const FilePath& path, |
44 scoped_ptr<GDataEntry>* entry) = 0; | 44 scoped_ptr<GDataEntry>* entry) = 0; |
45 | 45 |
46 // Creates an iterator to fetch all GDataEntry's under |path|. | 46 // Creates an iterator to fetch all GDataEntry's under |path|. |
47 // Will not return NULL. | 47 // Will not return NULL. |
48 virtual scoped_ptr<GDataDBIter> CreateIterator(const FilePath& path) = 0; | 48 virtual scoped_ptr<GDataDBIter> CreateIterator(const FilePath& path) = 0; |
49 | 49 |
| 50 // Puts |raw_value| keyed with |resource_id| to the database. |
| 51 // Used for testing (ex. injecting incompatible proto). |
| 52 virtual Status PutRawForTesting(const std::string& resource_id, |
| 53 const std::string& raw_value) = 0; |
| 54 |
50 protected: | 55 protected: |
51 GDataDB() {} | 56 GDataDB() {} |
52 }; | 57 }; |
53 | 58 |
54 // GData Database Iterator interface class. | 59 // GData Database Iterator interface class. |
55 class GDataDBIter { | 60 class GDataDBIter { |
56 public: | 61 public: |
57 virtual ~GDataDBIter() {} | 62 virtual ~GDataDBIter() {} |
58 | 63 |
59 // Fetches the next |entry| in the iteration sequence. Returns false when | 64 // Fetches the next |entry| in the iteration sequence. Returns false when |
60 // there are no more entries. | 65 // there are no more entries. |
61 virtual bool GetNext(std::string* path, scoped_ptr<GDataEntry>* entry) = 0; | 66 virtual bool GetNext(std::string* path, scoped_ptr<GDataEntry>* entry) = 0; |
62 | 67 |
63 protected: | 68 protected: |
64 GDataDBIter() {} | 69 GDataDBIter() {} |
65 }; | 70 }; |
66 | 71 |
67 } // namespace gdata | 72 } // namespace gdata |
68 | 73 |
69 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ | 74 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ |
OLD | NEW |