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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 | 78 |
| 79 // Available snippets. | 79 // Available snippets. |
| 80 const NTPSnippet::PtrVector& snippets() const { return snippets_; } | 80 const NTPSnippet::PtrVector& snippets() const { return snippets_; } |
| 81 | 81 |
| 82 // Returns the list of snippets previously discarded by the user (that are | 82 // Returns the list of snippets previously discarded by the user (that are |
| 83 // not expired yet). | 83 // not expired yet). |
| 84 const NTPSnippet::PtrVector& discarded_snippets() const { | 84 const NTPSnippet::PtrVector& discarded_snippets() const { |
| 85 return discarded_snippets_; | 85 return discarded_snippets_; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // Returns the last status message from the snippets fetcher. | 88 NTPSnippetsFetcher* snippets_fetcher() const { |
|
Bernhard Bauer
2016/05/19 08:51:19
You could return a const pointer here so it can be
jkrcal
2016/05/19 16:36:24
Done.
| |
| 89 const std::string& last_status() const { | 89 return snippets_fetcher_.get(); |
| 90 return snippets_fetcher_->last_status(); | |
| 91 } | |
| 92 | |
| 93 // Returns the last json from the snippets fetcher. | |
| 94 const std::string& last_json() const { | |
| 95 return snippets_fetcher_->last_json(); | |
| 96 } | 90 } |
| 97 | 91 |
| 98 // (Re)schedules the periodic fetching of snippets. This is necessary because | 92 // (Re)schedules the periodic fetching of snippets. This is necessary because |
| 99 // the schedule depends on the time of day. | 93 // the schedule depends on the time of day. |
| 100 void RescheduleFetching(); | 94 void RescheduleFetching(); |
| 101 | 95 |
| 102 // Fetches the image for the snippet with the given |snippet_id| and runs the | 96 // Fetches the image for the snippet with the given |snippet_id| and runs the |
| 103 // |callback|. If that snippet doesn't exist or the fetch fails, the callback | 97 // |callback|. If that snippet doesn't exist or the fetch fails, the callback |
| 104 // gets a null image. | 98 // gets a null image. |
| 105 void FetchSnippetImage(const std::string& snippet_id, | 99 void FetchSnippetImage(const std::string& snippet_id, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 // hosts. (e.g. the user manually removed all MostLikely tiles.) | 198 // hosts. (e.g. the user manually removed all MostLikely tiles.) |
| 205 virtual void NTPSnippetsServiceCleared() = 0; | 199 virtual void NTPSnippetsServiceCleared() = 0; |
| 206 | 200 |
| 207 protected: | 201 protected: |
| 208 virtual ~NTPSnippetsServiceObserver() {} | 202 virtual ~NTPSnippetsServiceObserver() {} |
| 209 }; | 203 }; |
| 210 | 204 |
| 211 } // namespace ntp_snippets | 205 } // namespace ntp_snippets |
| 212 | 206 |
| 213 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ | 207 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ |
| OLD | NEW |