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

Unified Diff: chrome/browser/search/suggestions/suggestions_service.cc

Issue 299713007: [Suggestions] Adding a Thumbnail Manager for the Suggestions Service (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search/suggestions/suggestions_service.cc
diff --git a/chrome/browser/search/suggestions/suggestions_service.cc b/chrome/browser/search/suggestions/suggestions_service.cc
index f6c0d5fc1dadc1dfdf0bc96347414c3ef277ef82..2746682f4c3eca9fe1a80d593ebe9ea5f86dbb4c 100644
--- a/chrome/browser/search/suggestions/suggestions_service.cc
+++ b/chrome/browser/search/suggestions/suggestions_service.cc
@@ -68,7 +68,8 @@ const char kSuggestionsFieldTrialStateParam[] = "state";
const char kSuggestionsFieldTrialStateEnabled[] = "enabled";
SuggestionsService::SuggestionsService(Profile* profile)
- : profile_(profile) {
+ : thumbnail_manager_(new ThumbnailManager(profile)),
+ profile_(profile) {
// Obtain the URL to use to fetch suggestions data from the Variations param.
suggestions_url_ = GURL(GetExperimentParam(kSuggestionsFieldTrialURLParam));
}
@@ -111,6 +112,12 @@ void SuggestionsService::FetchSuggestionsData(
last_request_started_time_ = base::TimeTicks::Now();
}
+void SuggestionsService::GetURLThumbnail(
+ const GURL& url,
+ ThumbnailManager::BitmapResponseCallback callback) {
+ thumbnail_manager_->GetURLThumbnail(url, callback);
+}
+
void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK_EQ(pending_request_.get(), source);
@@ -154,6 +161,7 @@ void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) {
LogResponseState(RESPONSE_EMPTY);
} else if (suggestions.ParseFromString(suggestions_data)) {
LogResponseState(RESPONSE_VALID);
+ thumbnail_manager_->InitializeThumbnailMap(suggestions);
} else {
LogResponseState(RESPONSE_INVALID);
}

Powered by Google App Engine
This is Rietveld 408576698