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

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

Issue 59903010: Ensure using chrome://thumb2/... adds the URL as a forced URL in TopSites so that a thumbnail is ca… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Completed with unit test. Created 7 years, 1 month 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 a14239f57937830d2d94e0f65a5baf0d554bdeed..29ffde0d45533445d877d3b149d518aea7ed8aba 100644
--- a/chrome/browser/ui/webui/ntp/thumbnail_source.cc
+++ b/chrome/browser/ui/webui/ntp/thumbnail_source.cc
@@ -20,17 +20,17 @@
using content::BrowserThread;
// Set ThumbnailService now as Profile isn't thread safe.
-ThumbnailSource::ThumbnailSource(Profile* profile, bool prefix_match)
+ThumbnailSource::ThumbnailSource(Profile* profile, bool forced_thumbnails)
: thumbnail_service_(ThumbnailServiceFactory::GetForProfile(profile)),
profile_(profile),
- prefix_match_(prefix_match) {
+ forced_thumbnails_(forced_thumbnails) {
}
ThumbnailSource::~ThumbnailSource() {
}
std::string ThumbnailSource::GetSource() const {
- return prefix_match_ ?
+ return forced_thumbnails_ ?
chrome::kChromeUIThumbnailHost2 : chrome::kChromeUIThumbnailHost;
}
@@ -40,12 +40,15 @@ void ThumbnailSource::StartDataRequest(
int render_view_id,
const content::URLDataSource::GotDataCallback& callback) {
scoped_refptr<base::RefCountedMemory> data;
- if (thumbnail_service_->GetPageThumbnail(GURL(path), prefix_match_, &data)) {
+ if (thumbnail_service_->GetPageThumbnail(GURL(path), forced_thumbnails_,
+ &data)) {
// We have the thumbnail.
callback.Run(data.get());
} else {
callback.Run(default_thumbnail_.get());
}
+ if (forced_thumbnails_)
+ thumbnail_service_->AddForcedURL(GURL(path));
}
std::string ThumbnailSource::GetMimeType(const std::string&) const {

Powered by Google App Engine
This is Rietveld 408576698