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

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

Issue 11885021: Don't derive from ChromeURLDataManager::DataSource, and instead have these classes implement a dele… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: nits Created 7 years, 11 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
===================================================================
--- chrome/browser/ui/webui/ntp/thumbnail_source.cc (revision 176443)
+++ chrome/browser/ui/webui/ntp/thumbnail_source.cc (working copy)
@@ -10,27 +10,31 @@
#include "chrome/browser/thumbnails/thumbnail_service.h"
#include "chrome/browser/thumbnails/thumbnail_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/common/url_constants.h"
#include "googleurl/src/gurl.h"
#include "grit/theme_resources.h"
#include "ui/base/resource/resource_bundle.h"
+// Set ThumbnailService now as Profile isn't thread safe.
ThumbnailSource::ThumbnailSource(Profile* profile)
- : DataSource(chrome::kChromeUIThumbnailHost, MessageLoop::current()),
- // Set ThumbnailService now as Profile isn't thread safe.
- thumbnail_service_(ThumbnailServiceFactory::GetForProfile(profile)) {
+ : thumbnail_service_(ThumbnailServiceFactory::GetForProfile(profile)) {
}
ThumbnailSource::~ThumbnailSource() {
}
+std::string ThumbnailSource::GetSource() {
+ return chrome::kChromeUIThumbnailHost;
+}
+
void ThumbnailSource::StartDataRequest(const std::string& path,
bool is_incognito,
int request_id) {
scoped_refptr<base::RefCountedMemory> data;
if (thumbnail_service_->GetPageThumbnail(GURL(path), &data)) {
// We have the thumbnail.
- SendResponse(request_id, data.get());
+ url_data_source()->SendResponse(request_id, data.get());
} else {
SendDefaultThumbnail(request_id);
}
@@ -46,9 +50,9 @@
const std::string& path) const {
// TopSites can be accessed from the IO thread.
return thumbnail_service_.get() ?
- NULL : DataSource::MessageLoopForRequestPath(path);
+ NULL : content::URLDataSourceDelegate::MessageLoopForRequestPath(path);
}
void ThumbnailSource::SendDefaultThumbnail(int request_id) {
- SendResponse(request_id, default_thumbnail_);
+ url_data_source()->SendResponse(request_id, default_thumbnail_);
}

Powered by Google App Engine
This is Rietveld 408576698