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

Unified Diff: chrome/browser/ui/webui/ntp/thumbnail_source.cc

Issue 23477033: Implementing URL prefix match for history thumbnail cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Inlining; comment fixes. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/ntp/thumbnail_source.cc
diff --git a/chrome/browser/ui/webui/ntp/thumbnail_source.cc b/chrome/browser/ui/webui/ntp/thumbnail_source.cc
index 324c69432c744b534cc10b0a9e42e7d61d4ffe53..e43c9acbd245cd36fe2ad8de4511b2540edcc31c 100644
--- a/chrome/browser/ui/webui/ntp/thumbnail_source.cc
+++ b/chrome/browser/ui/webui/ntp/thumbnail_source.cc
@@ -19,17 +19,26 @@
using content::BrowserThread;
-// Set ThumbnailService now as Profile isn't thread safe.
+// Set ThumbnailService now as Profile isn't thread safe. By default, perform
+// exact match only.
ThumbnailSource::ThumbnailSource(Profile* profile)
: thumbnail_service_(ThumbnailServiceFactory::GetForProfile(profile)),
- profile_(profile) {
+ profile_(profile),
+ prefix_match_(false) {
+}
+
+ThumbnailSource::ThumbnailSource(Profile* profile, bool prefix_match)
+ : thumbnail_service_(ThumbnailServiceFactory::GetForProfile(profile)),
+ profile_(profile),
+ prefix_match_(prefix_match) {
}
ThumbnailSource::~ThumbnailSource() {
}
std::string ThumbnailSource::GetSource() const {
- return chrome::kChromeUIThumbnailHost;
+ return prefix_match_ ?
+ chrome::kChromeUIThumbnailHost2 : chrome::kChromeUIThumbnailHost;
}
void ThumbnailSource::StartDataRequest(
@@ -38,7 +47,7 @@ void ThumbnailSource::StartDataRequest(
int render_view_id,
const content::URLDataSource::GotDataCallback& callback) {
scoped_refptr<base::RefCountedMemory> data;
- if (thumbnail_service_->GetPageThumbnail(GURL(path), &data)) {
+ if (thumbnail_service_->GetPageThumbnail(GURL(path), prefix_match_, &data)) {
// We have the thumbnail.
callback.Run(data.get());
} else {

Powered by Google App Engine
This is Rietveld 408576698