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