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

Unified Diff: chrome/browser/search/thumbnail_source.cc

Issue 1151563005: Revert of NTP Zombie Code Slayer Part IV: Most Visited (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « chrome/browser/search/thumbnail_source.h ('k') | chrome/browser/ui/webui/app_launcher_page_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/thumbnail_source.cc
diff --git a/chrome/browser/search/thumbnail_source.cc b/chrome/browser/search/thumbnail_source.cc
deleted file mode 100644
index e2023c282ece51ddae10910e859608ba7c0f8920..0000000000000000000000000000000000000000
--- a/chrome/browser/search/thumbnail_source.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/search/thumbnail_source.h"
-
-#include "base/callback.h"
-#include "base/memory/ref_counted_memory.h"
-#include "base/message_loop/message_loop.h"
-#include "chrome/browser/search/instant_io_context.h"
-#include "chrome/browser/thumbnails/thumbnail_service.h"
-#include "chrome/browser/thumbnails/thumbnail_service_factory.h"
-#include "chrome/common/url_constants.h"
-#include "net/url_request/url_request.h"
-#include "url/gurl.h"
-
-// Set ThumbnailService now as Profile isn't thread safe.
-ThumbnailSource::ThumbnailSource(Profile* profile, bool capture_thumbnails)
- : thumbnail_service_(ThumbnailServiceFactory::GetForProfile(profile)),
- capture_thumbnails_(capture_thumbnails) {
-}
-
-ThumbnailSource::~ThumbnailSource() {
-}
-
-std::string ThumbnailSource::GetSource() const {
- return capture_thumbnails_ ?
- chrome::kChromeUIThumbnailHost2 : chrome::kChromeUIThumbnailHost;
-}
-
-void ThumbnailSource::StartDataRequest(
- const std::string& path,
- int render_process_id,
- int render_frame_id,
- const content::URLDataSource::GotDataCallback& callback) {
- scoped_refptr<base::RefCountedMemory> data;
- if (thumbnail_service_->GetPageThumbnail(GURL(path), capture_thumbnails_,
- &data)) {
- // We have the thumbnail.
- callback.Run(data.get());
- } else {
- callback.Run(default_thumbnail_.get());
- }
- if (capture_thumbnails_)
- thumbnail_service_->AddForcedURL(GURL(path));
-}
-
-std::string ThumbnailSource::GetMimeType(const std::string&) const {
- // We need to explicitly return a mime type, otherwise if the user tries to
- // drag the image they get no extension.
- return "image/png";
-}
-
-base::MessageLoop* ThumbnailSource::MessageLoopForRequestPath(
- const std::string& path) const {
- // TopSites can be accessed from the IO thread.
- return thumbnail_service_.get() ?
- NULL : content::URLDataSource::MessageLoopForRequestPath(path);
-}
-
-bool ThumbnailSource::ShouldServiceRequest(
- const net::URLRequest* request) const {
- if (request->url().SchemeIs(chrome::kChromeSearchScheme))
- return InstantIOContext::ShouldServiceRequest(request);
- return URLDataSource::ShouldServiceRequest(request);
-}
« no previous file with comments | « chrome/browser/search/thumbnail_source.h ('k') | chrome/browser/ui/webui/app_launcher_page_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698