Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Side by Side Diff: components/suggestions/suggestions_service.cc

Issue 1314493013: Popular sites on the NTP: add thumbnails! (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android_clang_dbg_recipe build Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "components/suggestions/suggestions_service.h" 5 #include "components/suggestions/suggestions_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 // Issue a network request to refresh the suggestions in the cache. 142 // Issue a network request to refresh the suggestions in the cache.
143 IssueRequestIfNoneOngoing(suggestions_url_); 143 IssueRequestIfNoneOngoing(suggestions_url_);
144 } else { 144 } else {
145 NOTREACHED(); 145 NOTREACHED();
146 } 146 }
147 } 147 }
148 148
149 void SuggestionsService::GetPageThumbnail( 149 void SuggestionsService::GetPageThumbnail(
150 const GURL& url, 150 const GURL& url,
151 base::Callback<void(const GURL&, const SkBitmap*)> callback) { 151 const base::Callback<void(const GURL&, const SkBitmap*)>& callback) {
152 thumbnail_manager_->GetImageForURL(url, callback); 152 thumbnail_manager_->GetImageForURL(url, callback);
153 } 153 }
154 154
155 void SuggestionsService::GetPageThumbnailWithURL(
156 const GURL& url,
157 const GURL& thumbnail_url,
158 const base::Callback<void(const GURL&, const SkBitmap*)>& callback) {
159 thumbnail_manager_->AddImageURL(url, thumbnail_url);
160 GetPageThumbnail(url, callback);
161 }
162
155 void SuggestionsService::BlacklistURL( 163 void SuggestionsService::BlacklistURL(
156 const GURL& candidate_url, 164 const GURL& candidate_url,
157 const SuggestionsService::ResponseCallback& callback, 165 const SuggestionsService::ResponseCallback& callback,
158 const base::Closure& fail_callback) { 166 const base::Closure& fail_callback) {
159 DCHECK(thread_checker_.CalledOnValidThread()); 167 DCHECK(thread_checker_.CalledOnValidThread());
160 168
161 if (!blacklist_store_->BlacklistUrl(candidate_url)) { 169 if (!blacklist_store_->BlacklistUrl(candidate_url)) {
162 fail_callback.Run(); 170 fail_callback.Run();
163 return; 171 return;
164 } 172 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); 402 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec);
395 } else { 403 } else {
396 TimeDelta candidate_delay = 404 TimeDelta candidate_delay =
397 scheduling_delay_ * kSchedulingBackoffMultiplier; 405 scheduling_delay_ * kSchedulingBackoffMultiplier;
398 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) 406 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec))
399 scheduling_delay_ = candidate_delay; 407 scheduling_delay_ = candidate_delay;
400 } 408 }
401 } 409 }
402 410
403 } // namespace suggestions 411 } // namespace suggestions
OLDNEW
« no previous file with comments | « components/suggestions/suggestions_service.h ('k') | components/suggestions/suggestions_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698