summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/dom_ui/dom_ui_thumbnail_source.cc')
-rw-r--r--chrome/browser/dom_ui/dom_ui_thumbnail_source.cc31
1 files changed, 2 insertions, 29 deletions
diff --git a/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc b/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc
index c3d51a1..fd40e867 100644
--- a/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc
+++ b/chrome/browser/dom_ui/dom_ui_thumbnail_source.cc
@@ -21,20 +21,15 @@ DOMUIThumbnailSource::DOMUIThumbnailSource(Profile* profile)
store_(profile->GetThumbnailStore()) {
}
-DOMUIThumbnailSource::~DOMUIThumbnailSource() {
- store_->CancelPendingRequests(pending_requests_);
-}
-
void DOMUIThumbnailSource::StartDataRequest(const std::string& path,
int request_id) {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kThumbnailStore)) {
RefCountedBytes* data = NULL;
- ThumbnailStore::GetStatus res = store_->GetPageThumbnail(GURL(path), &data);
- if (res == ThumbnailStore::SUCCESS) {
+ if (store_->GetPageThumbnail(GURL(path), &data)) {
// Got the thumbnail.
SendResponse(request_id, data);
- } else if (res == ThumbnailStore::FAIL) {
+ } else {
// Don't have the thumbnail so return the default thumbnail.
if (!default_thumbnail_.get()) {
default_thumbnail_ = new RefCountedBytes;
@@ -42,12 +37,6 @@ void DOMUIThumbnailSource::StartDataRequest(const std::string& path,
IDR_DEFAULT_THUMBNAIL, &default_thumbnail_->data);
}
SendResponse(request_id, default_thumbnail_);
- } else if (res == ThumbnailStore::ASYNC) {
- // Getting the redirect list for the url. Will return thumbnail later.
- ThumbnailStore::ThumbnailDataCallback* cb =
- NewCallback(this, &DOMUIThumbnailSource::ReturnData);
- pending_requests_.insert(request_id);
- store_->GetPageThumbnailAsync(GURL(path), request_id, cb);
}
return;
} // end --thumbnail-store switch
@@ -66,22 +55,6 @@ void DOMUIThumbnailSource::StartDataRequest(const std::string& path,
}
}
-void DOMUIThumbnailSource::ReturnData(int request_id,
- scoped_refptr<RefCountedBytes> data) {
- pending_requests_.erase(request_id);
- if (data.get() && !data->data.empty()) {
- SendResponse(request_id, data);
- } else {
- if (!default_thumbnail_.get()) {
- default_thumbnail_ = new RefCountedBytes;
- ResourceBundle::GetSharedInstance().LoadImageResourceBytes(
- IDR_DEFAULT_THUMBNAIL, &default_thumbnail_->data);
- }
-
- SendResponse(request_id, default_thumbnail_);
- }
-}
-
void DOMUIThumbnailSource::OnThumbnailDataAvailable(
HistoryService::Handle request_handle,
scoped_refptr<RefCountedBytes> data) {