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

Side by Side Diff: chrome/browser/ui/webui/ntp/thumbnail_source.cc

Issue 11896113: Add chrome-search: access from Instant overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Yet another rebase Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/ntp/thumbnail_source.h ('k') | chrome/browser/ui/webui/theme_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" 5 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "chrome/browser/instant/instant_io_context.h"
10 #include "chrome/browser/thumbnails/thumbnail_service.h" 11 #include "chrome/browser/thumbnails/thumbnail_service.h"
11 #include "chrome/browser/thumbnails/thumbnail_service_factory.h" 12 #include "chrome/browser/thumbnails/thumbnail_service_factory.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
14 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
15 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
17 #include "net/url_request/url_request.h"
16 #include "ui/base/resource/resource_bundle.h" 18 #include "ui/base/resource/resource_bundle.h"
17 19
18 // Set ThumbnailService now as Profile isn't thread safe. 20 // Set ThumbnailService now as Profile isn't thread safe.
19 ThumbnailSource::ThumbnailSource(Profile* profile) 21 ThumbnailSource::ThumbnailSource(Profile* profile)
20 : thumbnail_service_(ThumbnailServiceFactory::GetForProfile(profile)) { 22 : thumbnail_service_(ThumbnailServiceFactory::GetForProfile(profile)) {
21 } 23 }
22 24
23 ThumbnailSource::~ThumbnailSource() { 25 ThumbnailSource::~ThumbnailSource() {
24 } 26 }
25 27
(...skipping 19 matching lines...) Expand all
45 // drag the image they get no extension. 47 // drag the image they get no extension.
46 return "image/png"; 48 return "image/png";
47 } 49 }
48 50
49 MessageLoop* ThumbnailSource::MessageLoopForRequestPath( 51 MessageLoop* ThumbnailSource::MessageLoopForRequestPath(
50 const std::string& path) const { 52 const std::string& path) const {
51 // TopSites can be accessed from the IO thread. 53 // TopSites can be accessed from the IO thread.
52 return thumbnail_service_.get() ? 54 return thumbnail_service_.get() ?
53 NULL : content::URLDataSource::MessageLoopForRequestPath(path); 55 NULL : content::URLDataSource::MessageLoopForRequestPath(path);
54 } 56 }
57
58 bool ThumbnailSource::ShouldServiceRequest(
59 const net::URLRequest* request) const {
60 if (request->url().SchemeIs(chrome::kChromeSearchScheme))
61 return InstantIOContext::ShouldServiceRequest(request);
62 return URLDataSource::ShouldServiceRequest(request);
63 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/thumbnail_source.h ('k') | chrome/browser/ui/webui/theme_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698