| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 scoped_refptr<base::SequencedTaskRunner> file_task_runner, | 51 scoped_refptr<base::SequencedTaskRunner> file_task_runner, |
| 52 const std::string& application_language_code, | 52 const std::string& application_language_code, |
| 53 NTPSnippetsScheduler* scheduler, | 53 NTPSnippetsScheduler* scheduler, |
| 54 scoped_ptr<NTPSnippetsFetcher> snippets_fetcher); | 54 scoped_ptr<NTPSnippetsFetcher> snippets_fetcher); |
| 55 ~NTPSnippetsService() override; | 55 ~NTPSnippetsService() override; |
| 56 | 56 |
| 57 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 57 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 58 | 58 |
| 59 void Init(bool enabled); | 59 void Init(bool enabled); |
| 60 | 60 |
| 61 // Fetches snippets from the server. |overwrite| is true if existing snippets | 61 // Fetches snippets from the server. |
| 62 // should be overwritten. | 62 void FetchSnippets(); |
| 63 void FetchSnippets(bool overwrite); | |
| 64 | 63 |
| 65 // Inherited from KeyedService. | 64 // Inherited from KeyedService. |
| 66 void Shutdown() override; | 65 void Shutdown() override; |
| 67 | 66 |
| 68 // True once the data is loaded in memory and available to loop over. | 67 // True once the data is loaded in memory and available to loop over. |
| 69 bool is_loaded() { return loaded_; } | 68 bool is_loaded() { return loaded_; } |
| 70 | 69 |
| 71 // Observer accessors. | 70 // Observer accessors. |
| 72 void AddObserver(NTPSnippetsServiceObserver* observer); | 71 void AddObserver(NTPSnippetsServiceObserver* observer); |
| 73 void RemoveObserver(NTPSnippetsServiceObserver* observer); | 72 void RemoveObserver(NTPSnippetsServiceObserver* observer); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Send when the service is shutting down. | 160 // Send when the service is shutting down. |
| 162 virtual void NTPSnippetsServiceShutdown(NTPSnippetsService* service) = 0; | 161 virtual void NTPSnippetsServiceShutdown(NTPSnippetsService* service) = 0; |
| 163 | 162 |
| 164 protected: | 163 protected: |
| 165 virtual ~NTPSnippetsServiceObserver() {} | 164 virtual ~NTPSnippetsServiceObserver() {} |
| 166 }; | 165 }; |
| 167 | 166 |
| 168 } // namespace ntp_snippets | 167 } // namespace ntp_snippets |
| 169 | 168 |
| 170 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ | 169 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ |
| OLD | NEW |