| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_NTP_SNIPPETS_SERVICE_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // etc...). The URL is the only mandatory value. | 128 // etc...). The URL is the only mandatory value. |
| 129 bool LoadFromListValue(const base::ListValue& list); | 129 bool LoadFromListValue(const base::ListValue& list); |
| 130 | 130 |
| 131 // TODO(treib): Investigate a better storage, maybe LevelDB or SQLite? | 131 // TODO(treib): Investigate a better storage, maybe LevelDB or SQLite? |
| 132 void LoadSnippetsFromPrefs(); | 132 void LoadSnippetsFromPrefs(); |
| 133 void StoreSnippetsToPrefs(); | 133 void StoreSnippetsToPrefs(); |
| 134 | 134 |
| 135 void LoadDiscardedSnippetsFromPrefs(); | 135 void LoadDiscardedSnippetsFromPrefs(); |
| 136 void StoreDiscardedSnippetsToPrefs(); | 136 void StoreDiscardedSnippetsToPrefs(); |
| 137 | 137 |
| 138 std::vector<std::string> GetSnippetHostsFromPrefs() const; |
| 139 void StoreSnippetHostsToPrefs(const std::vector<std::string>& hosts); |
| 140 |
| 138 bool HasDiscardedSnippet(const GURL& url) const; | 141 bool HasDiscardedSnippet(const GURL& url) const; |
| 139 | 142 |
| 140 void RemoveExpiredSnippets(); | 143 void RemoveExpiredSnippets(); |
| 141 | 144 |
| 142 PrefService* pref_service_; | 145 PrefService* pref_service_; |
| 143 | 146 |
| 144 suggestions::SuggestionsService* suggestions_service_; | 147 suggestions::SuggestionsService* suggestions_service_; |
| 145 | 148 |
| 146 // True if the suggestions are loaded. | 149 // True if the suggestions are loaded. |
| 147 bool loaded_; | 150 bool loaded_; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // Send when the service is shutting down. | 199 // Send when the service is shutting down. |
| 197 virtual void NTPSnippetsServiceShutdown(NTPSnippetsService* service) = 0; | 200 virtual void NTPSnippetsServiceShutdown(NTPSnippetsService* service) = 0; |
| 198 | 201 |
| 199 protected: | 202 protected: |
| 200 virtual ~NTPSnippetsServiceObserver() {} | 203 virtual ~NTPSnippetsServiceObserver() {} |
| 201 }; | 204 }; |
| 202 | 205 |
| 203 } // namespace ntp_snippets | 206 } // namespace ntp_snippets |
| 204 | 207 |
| 205 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ | 208 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ |
| OLD | NEW |