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

Side by Side Diff: chrome/browser/thumbnail_store.cc

Issue 151168: Moved typedef of RedirectList from HistoryService class to history namespace.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/thumbnail_store.h ('k') | chrome/tools/profiles/generate_profile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/thumbnail_store.h" 5 #include "chrome/browser/thumbnail_store.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // of the form "url => {redirect1 -> redirect2 -> .... -> final url}". 202 // of the form "url => {redirect1 -> redirect2 -> .... -> final url}".
203 // If the redirect info has not been cached, tell the caller to call 203 // If the redirect info has not been cached, tell the caller to call
204 // GetPageThumbnailAsync instead which will wait for the redirect info 204 // GetPageThumbnailAsync instead which will wait for the redirect info
205 // and return the thumbnail data when it becomes available. 205 // and return the thumbnail data when it becomes available.
206 ThumbnailStore::RedirectMap::iterator it = redirect_urls_.find(url); 206 ThumbnailStore::RedirectMap::iterator it = redirect_urls_.find(url);
207 if (it == redirect_urls_.end()) 207 if (it == redirect_urls_.end())
208 return ThumbnailStore::ASYNC; 208 return ThumbnailStore::ASYNC;
209 209
210 // Return the first available thumbnail starting at the end of the 210 // Return the first available thumbnail starting at the end of the
211 // redirect list. 211 // redirect list.
212 HistoryService::RedirectList::reverse_iterator rit; 212 history::RedirectList::reverse_iterator rit;
213 for (rit = it->second->data.rbegin(); 213 for (rit = it->second->data.rbegin();
214 rit != it->second->data.rend(); ++rit) { 214 rit != it->second->data.rend(); ++rit) {
215 if (cache_->find(*rit) != cache_->end()) { 215 if (cache_->find(*rit) != cache_->end()) {
216 *data = (*cache_)[*rit].first; 216 *data = (*cache_)[*rit].first;
217 (*data)->AddRef(); 217 (*data)->AddRef();
218 return ThumbnailStore::SUCCESS; 218 return ThumbnailStore::SUCCESS;
219 } 219 }
220 } 220 }
221 221
222 // TODO(meelapshah) bug 14643: check past redirect lists 222 // TODO(meelapshah) bug 14643: check past redirect lists
(...skipping 15 matching lines...) Expand all
238 url, &hs_consumer_, 238 url, &hs_consumer_,
239 NewCallback(this, &ThumbnailStore::OnRedirectQueryComplete)); 239 NewCallback(this, &ThumbnailStore::OnRedirectQueryComplete));
240 hs_consumer_.SetClientData(hs_, handle, request_id); 240 hs_consumer_.SetClientData(hs_, handle, request_id);
241 redirect_requests_[request_id] = std::make_pair(cb, handle); 241 redirect_requests_[request_id] = std::make_pair(cb, handle);
242 } 242 }
243 243
244 void ThumbnailStore::OnRedirectQueryComplete( 244 void ThumbnailStore::OnRedirectQueryComplete(
245 HistoryService::Handle request_handle, 245 HistoryService::Handle request_handle,
246 GURL url, 246 GURL url,
247 bool success, 247 bool success,
248 HistoryService::RedirectList* redirects) { 248 history::RedirectList* redirects) {
249 if (!success) 249 if (!success)
250 return; 250 return;
251 251
252 // Copy the redirects list returned by the HistoryService into our cache. 252 // Copy the redirects list returned by the HistoryService into our cache.
253 redirect_urls_[url] = new RefCountedVector<GURL>(*redirects); 253 redirect_urls_[url] = new RefCountedVector<GURL>(*redirects);
254 254
255 // Get the request_id associated with this request. 255 // Get the request_id associated with this request.
256 int request_id = hs_consumer_.GetClientData(hs_, request_handle); 256 int request_id = hs_consumer_.GetClientData(hs_, request_handle);
257 257
258 // Return if no callback was associated with this redirect query. 258 // Return if no callback was associated with this redirect query.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 std::wstring ThumbnailStore::GetDictionaryKeyForURL( 433 std::wstring ThumbnailStore::GetDictionaryKeyForURL(
434 const std::string& url) const { 434 const std::string& url) const {
435 return ASCIIToWide(MD5String(url)); 435 return ASCIIToWide(MD5String(url));
436 } 436 }
437 437
438 bool ThumbnailStore::IsPopular(const GURL& url) const { 438 bool ThumbnailStore::IsPopular(const GURL& url) const {
439 return most_visited_urls_.end() != find(most_visited_urls_.begin(), 439 return most_visited_urls_.end() != find(most_visited_urls_.begin(),
440 most_visited_urls_.end(), 440 most_visited_urls_.end(),
441 url); 441 url);
442 } 442 }
OLDNEW
« no previous file with comments | « chrome/browser/thumbnail_store.h ('k') | chrome/tools/profiles/generate_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698