OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ | 5 #ifndef COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ |
6 #define COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ | 6 #define COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 void BlacklistURL(const GURL& candidate_url, | 80 void BlacklistURL(const GURL& candidate_url, |
81 const ResponseCallback& callback, | 81 const ResponseCallback& callback, |
82 const base::Closure& fail_callback); | 82 const base::Closure& fail_callback); |
83 | 83 |
84 // Removes a URL from the local blacklist, then invokes |callback|. If the URL | 84 // Removes a URL from the local blacklist, then invokes |callback|. If the URL |
85 // cannot be removed, the |fail_callback| is called. | 85 // cannot be removed, the |fail_callback| is called. |
86 void UndoBlacklistURL(const GURL& url, | 86 void UndoBlacklistURL(const GURL& url, |
87 const ResponseCallback& callback, | 87 const ResponseCallback& callback, |
88 const base::Closure& fail_callback); | 88 const base::Closure& fail_callback); |
89 | 89 |
90 // Removes all URLs from the blacklist then invokes |callback|. | |
91 void ClearBlacklist(const ResponseCallback& callback); | |
92 | |
90 // Determines which URL a blacklist request was for, irrespective of the | 93 // Determines which URL a blacklist request was for, irrespective of the |
91 // request's status. Returns false if |request| is not a blacklist request. | 94 // request's status. Returns false if |request| is not a blacklist request. |
92 static bool GetBlacklistedUrl(const net::URLFetcher& request, GURL* url); | 95 static bool GetBlacklistedUrl(const net::URLFetcher& request, GURL* url); |
93 | 96 |
94 // Register SuggestionsService related prefs in the Profile prefs. | 97 // Register SuggestionsService related prefs in the Profile prefs. |
95 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 98 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
96 | 99 |
97 // Sets default timestamp for suggestions which do not have expiry timestamp. | 100 // Sets default timestamp for suggestions which do not have expiry timestamp. |
98 void SetDefaultExpiryTimestamp(SuggestionsProfile* suggestions, | 101 void SetDefaultExpiryTimestamp(SuggestionsProfile* suggestions, |
99 int64 timestamp_usec); | 102 int64 timestamp_usec); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 // Schedules a blacklisting request if the local blacklist isn't empty. | 134 // Schedules a blacklisting request if the local blacklist isn't empty. |
132 void ScheduleBlacklistUpload(); | 135 void ScheduleBlacklistUpload(); |
133 | 136 |
134 // If the local blacklist isn't empty, picks a URL from it and issues a | 137 // If the local blacklist isn't empty, picks a URL from it and issues a |
135 // blacklist request for it. | 138 // blacklist request for it. |
136 void UploadOneFromBlacklist(); | 139 void UploadOneFromBlacklist(); |
137 | 140 |
138 // Updates |scheduling_delay_| based on the success of the last request. | 141 // Updates |scheduling_delay_| based on the success of the last request. |
139 void UpdateBlacklistDelay(bool last_request_successful); | 142 void UpdateBlacklistDelay(bool last_request_successful); |
140 | 143 |
144 void PopulateFavicons(SuggestionsProfile* suggestions); | |
Mathieu
2015/07/28 13:09:29
PopulateFaviconUrls?
Mathieu
2015/07/28 13:09:29
comment
fserb
2015/07/28 15:31:34
Done.
fserb
2015/07/28 15:31:34
Done.
| |
145 | |
141 // Test seams. | 146 // Test seams. |
142 base::TimeDelta blacklist_delay() const { return scheduling_delay_; } | 147 base::TimeDelta blacklist_delay() const { return scheduling_delay_; } |
143 void set_blacklist_delay(base::TimeDelta delay) { | 148 void set_blacklist_delay(base::TimeDelta delay) { |
144 scheduling_delay_ = delay; } | 149 scheduling_delay_ = delay; } |
145 | 150 |
146 base::ThreadChecker thread_checker_; | 151 base::ThreadChecker thread_checker_; |
147 | 152 |
148 net::URLRequestContextGetter* url_request_context_; | 153 net::URLRequestContextGetter* url_request_context_; |
149 | 154 |
150 // The cache for the suggestions. | 155 // The cache for the suggestions. |
(...skipping 28 matching lines...) Expand all Loading... | |
179 | 184 |
180 // For callbacks may be run after destruction. | 185 // For callbacks may be run after destruction. |
181 base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_; | 186 base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_; |
182 | 187 |
183 DISALLOW_COPY_AND_ASSIGN(SuggestionsService); | 188 DISALLOW_COPY_AND_ASSIGN(SuggestionsService); |
184 }; | 189 }; |
185 | 190 |
186 } // namespace suggestions | 191 } // namespace suggestions |
187 | 192 |
188 #endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ | 193 #endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ |
OLD | NEW |