Chromium Code Reviews| 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 <memory> | 10 #include <memory> |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 void StoreSnippetHostsToPrefs(const std::set<std::string>& hosts); | 215 void StoreSnippetHostsToPrefs(const std::set<std::string>& hosts); |
| 216 | 216 |
| 217 // Removes the expired snippets (including discarded) from the service and the | 217 // Removes the expired snippets (including discarded) from the service and the |
| 218 // database, and schedules another pass for the next expiration. | 218 // database, and schedules another pass for the next expiration. |
| 219 void ClearExpiredSnippets(); | 219 void ClearExpiredSnippets(); |
| 220 | 220 |
| 221 // Completes the initialization phase of the service, registering the last | 221 // Completes the initialization phase of the service, registering the last |
| 222 // observers. This is done after construction, once the database is loaded. | 222 // observers. This is done after construction, once the database is loaded. |
| 223 void FinishInitialization(); | 223 void FinishInitialization(); |
| 224 | 224 |
| 225 void LoadingSnippetsFinished(); | |
|
Marc Treib
2016/07/19 14:50:56
unrelated: no implementation
| |
| 226 | |
| 227 void OnSnippetImageFetchedFromDatabase(const std::string& snippet_id, | 225 void OnSnippetImageFetchedFromDatabase(const std::string& snippet_id, |
| 228 const ImageFetchedCallback& callback, | 226 const ImageFetchedCallback& callback, |
| 229 std::string data); | 227 std::string data); |
| 230 | 228 |
| 231 void OnSnippetImageDecoded(const std::string& snippet_id, | 229 void OnSnippetImageDecoded(const std::string& snippet_id, |
| 232 const ImageFetchedCallback& callback, | 230 const ImageFetchedCallback& callback, |
| 233 const gfx::Image& image); | 231 const gfx::Image& image); |
| 234 | 232 |
| 235 void FetchSnippetImageFromNetwork(const std::string& snippet_id, | 233 void FetchSnippetImageFromNetwork(const std::string& snippet_id, |
| 236 const ImageFetchedCallback& callback); | 234 const ImageFetchedCallback& callback); |
| 237 | 235 |
| 238 // Triggers a state transition depending on the provided reason to be | 236 // Triggers a state transition depending on the provided reason to be |
| 239 // disabled (or lack thereof). This method is called when a change is detected | 237 // disabled (or lack thereof). This method is called when a change is detected |
| 240 // by |snippets_status_service_|. | 238 // by |snippets_status_service_|. |
| 241 void UpdateStateForStatus(DisabledReason disabled_reason); | 239 void OnDisabledReasonChanged(DisabledReason disabled_reason); |
|
Marc Treib
2016/07/19 14:50:56
unrelated: confusing name
| |
| 242 | 240 |
| 243 // Verifies state transitions (see |State|'s documentation) and applies them. | 241 // Verifies state transitions (see |State|'s documentation) and applies them. |
| 244 // Also updates the provider status. Does nothing except updating the provider | 242 // Also updates the provider status. Does nothing except updating the provider |
| 245 // status if called with the current state. | 243 // status if called with the current state. |
| 246 void EnterState(State state, ContentSuggestionsCategoryStatus status); | 244 void EnterState(State state, ContentSuggestionsCategoryStatus status); |
| 247 | 245 |
| 248 // Enables the service and triggers a fetch if required. Do not call directly, | 246 // Enables the service and triggers a fetch if required. Do not call directly, |
| 249 // use |EnterState| instead. | 247 // use |EnterState| instead. |
| 250 void EnterStateEnabled(bool fetch_snippets); | 248 void EnterStateEnabled(bool fetch_snippets); |
| 251 | 249 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 // If the service might be enabled, DisabledReason::NONE will be provided. | 334 // If the service might be enabled, DisabledReason::NONE will be provided. |
| 337 virtual void NTPSnippetsServiceDisabledReasonChanged(DisabledReason) = 0; | 335 virtual void NTPSnippetsServiceDisabledReasonChanged(DisabledReason) = 0; |
| 338 | 336 |
| 339 protected: | 337 protected: |
| 340 virtual ~NTPSnippetsServiceObserver() {} | 338 virtual ~NTPSnippetsServiceObserver() {} |
| 341 }; | 339 }; |
| 342 | 340 |
| 343 } // namespace ntp_snippets | 341 } // namespace ntp_snippets |
| 344 | 342 |
| 345 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ | 343 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ |
| OLD | NEW |