| 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_REMOTE_REMOTE_SUGGESTIONS_PROVIDER_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_PROVIDER_H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_PROVIDER_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Fetchs content suggestions from the Content Suggestions server for all | 95 // Fetchs content suggestions from the Content Suggestions server for all |
| 96 // remote categories in the background. | 96 // remote categories in the background. |
| 97 void FetchSnippetsInTheBackground(); | 97 void FetchSnippetsInTheBackground(); |
| 98 | 98 |
| 99 // Fetchs content suggestions from the Content Suggestions server for all | 99 // Fetchs content suggestions from the Content Suggestions server for all |
| 100 // remote categories. The request to the server is performed as an interactive | 100 // remote categories. The request to the server is performed as an interactive |
| 101 // request. Interactive requests are used for actions triggered by the user | 101 // request. Interactive requests are used for actions triggered by the user |
| 102 // and request lower latency processing. | 102 // and request lower latency processing. |
| 103 void FetchSnippetsForAllCategories(); | 103 void FetchSnippetsForAllCategories(); |
| 104 | 104 |
| 105 // Fetches snippets from the server for specified hosts and adds them to the | |
| 106 // current ones. Only called from chrome://snippets-internals, DO NOT USE | |
| 107 // otherwise! Ignored while ready() is false. | |
| 108 void FetchSnippetsFromHosts(const std::set<std::string>& hosts, | |
| 109 bool interactive_request); | |
| 110 | |
| 111 const NTPSnippetsFetcher* snippets_fetcher() const { | 105 const NTPSnippetsFetcher* snippets_fetcher() const { |
| 112 return snippets_fetcher_.get(); | 106 return snippets_fetcher_.get(); |
| 113 } | 107 } |
| 114 | 108 |
| 115 // (Re)schedules the periodic fetching of snippets. If |force| is true, the | 109 // (Re)schedules the periodic fetching of snippets. If |force| is true, the |
| 116 // tasks will be re-scheduled even if they already exist and have the correct | 110 // tasks will be re-scheduled even if they already exist and have the correct |
| 117 // periods. | 111 // periods. |
| 118 void RescheduleFetching(bool force); | 112 void RescheduleFetching(bool force); |
| 119 | 113 |
| 120 // ContentSuggestionsProvider implementation | 114 // ContentSuggestionsProvider implementation |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 | 412 |
| 419 // A clock for getting the time. This allows to inject a clock in tests. | 413 // A clock for getting the time. This allows to inject a clock in tests. |
| 420 std::unique_ptr<base::Clock> clock_; | 414 std::unique_ptr<base::Clock> clock_; |
| 421 | 415 |
| 422 DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsProvider); | 416 DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsProvider); |
| 423 }; | 417 }; |
| 424 | 418 |
| 425 } // namespace ntp_snippets | 419 } // namespace ntp_snippets |
| 426 | 420 |
| 427 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_PROVIDER_H_ | 421 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_PROVIDER_H_ |
| OLD | NEW |