OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_DATABASE_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_DATABASE_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_DATABASE_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_DATABASE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 void LoadSnippets(const SnippetsCallback& callback); | 54 void LoadSnippets(const SnippetsCallback& callback); |
55 | 55 |
56 // Adds or updates the given snippet. | 56 // Adds or updates the given snippet. |
57 void SaveSnippet(const NTPSnippet& snippet); | 57 void SaveSnippet(const NTPSnippet& snippet); |
58 // Adds or updates all the given snippets. | 58 // Adds or updates all the given snippets. |
59 void SaveSnippets(const NTPSnippet::PtrVector& snippets); | 59 void SaveSnippets(const NTPSnippet::PtrVector& snippets); |
60 | 60 |
61 // Deletes the snippet with the given ID. | 61 // Deletes the snippet with the given ID. |
62 void DeleteSnippet(const std::string& snippet_id); | 62 void DeleteSnippet(const std::string& snippet_id); |
63 // Deletes all the given snippets (identified by their IDs). | 63 // Deletes all the given snippets (identified by their IDs). |
64 void DeleteSnippets(std::unique_ptr<std::vector<std::string>> keys_to_remove); | 64 void DeleteSnippets(std::unique_ptr<std::vector<std::string>> snippet_ids); |
65 | 65 |
66 // Loads the image data for the snippet with the given ID and passes it to | 66 // Loads the image data for the snippet with the given ID and passes it to |
67 // |callback|. Passes an empty string if not found. | 67 // |callback|. Passes an empty string if not found. |
68 void LoadImage(const std::string& snippet_id, | 68 void LoadImage(const std::string& snippet_id, |
69 const SnippetImageCallback& callback); | 69 const SnippetImageCallback& callback); |
70 | 70 |
71 // Adds or updates the image data for the given snippet ID. | 71 // Adds or updates the image data for the given snippet ID. |
72 void SaveImage(const std::string& snippet_id, const std::string& image_data); | 72 void SaveImage(const std::string& snippet_id, const std::string& image_data); |
73 | 73 |
74 // Deletes the image data for the given snippet ID. | 74 // Deletes the image data for the given snippet ID. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 base::Closure error_callback_; | 130 base::Closure error_callback_; |
131 | 131 |
132 base::WeakPtrFactory<NTPSnippetsDatabase> weak_ptr_factory_; | 132 base::WeakPtrFactory<NTPSnippetsDatabase> weak_ptr_factory_; |
133 | 133 |
134 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsDatabase); | 134 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsDatabase); |
135 }; | 135 }; |
136 | 136 |
137 } // namespace ntp_snippets | 137 } // namespace ntp_snippets |
138 | 138 |
139 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_DATABASE_H_ | 139 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_DATABASE_H_ |
OLD | NEW |