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

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

Issue 13243003: Move MessageLoop to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 callback.Run(default_thumbnail_); 61 callback.Run(default_thumbnail_);
62 } 62 }
63 } 63 }
64 64
65 std::string ThumbnailSource::GetMimeType(const std::string&) const { 65 std::string ThumbnailSource::GetMimeType(const std::string&) const {
66 // We need to explicitly return a mime type, otherwise if the user tries to 66 // We need to explicitly return a mime type, otherwise if the user tries to
67 // drag the image they get no extension. 67 // drag the image they get no extension.
68 return "image/png"; 68 return "image/png";
69 } 69 }
70 70
71 MessageLoop* ThumbnailSource::MessageLoopForRequestPath( 71 base::MessageLoop* ThumbnailSource::MessageLoopForRequestPath(
72 const std::string& path) const { 72 const std::string& path) const {
73 // TopSites can be accessed from the IO thread. 73 // TopSites can be accessed from the IO thread.
74 return thumbnail_service_.get() ? 74 return thumbnail_service_.get() ?
75 NULL : content::URLDataSource::MessageLoopForRequestPath(path); 75 NULL : content::URLDataSource::MessageLoopForRequestPath(path);
76 } 76 }
77 77
78 bool ThumbnailSource::ShouldServiceRequest( 78 bool ThumbnailSource::ShouldServiceRequest(
79 const net::URLRequest* request) const { 79 const net::URLRequest* request) const {
80 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) { 80 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) {
81 if (InstantService::IsInstantPath(request->url()) && 81 if (InstantService::IsInstantPath(request->url()) &&
82 InstantIOContext::ShouldServiceRequest(request)) { 82 InstantIOContext::ShouldServiceRequest(request)) {
83 // If this request will be serviced on the IO thread, then do the 83 // If this request will be serviced on the IO thread, then do the
84 // translation from raw_path to path here, where we have the |request| 84 // translation from raw_path to path here, where we have the |request|
85 // object in-hand, saving the result for later use. 85 // object in-hand, saving the result for later use.
86 86
87 // Strip leading slash from path. 87 // Strip leading slash from path.
88 std::string raw_path = request->url().path().substr(1); 88 std::string raw_path = request->url().path().substr(1);
89 if (!MessageLoopForRequestPath(raw_path)) { 89 if (!MessageLoopForRequestPath(raw_path)) {
90 id_to_url_map_[raw_path] = 90 id_to_url_map_[raw_path] =
91 InstantService::MaybeTranslateInstantPathOnIO(request, raw_path); 91 InstantService::MaybeTranslateInstantPathOnIO(request, raw_path);
92 } 92 }
93 return true; 93 return true;
94 } 94 }
95 return false; 95 return false;
96 } 96 }
97 return URLDataSource::ShouldServiceRequest(request); 97 return URLDataSource::ShouldServiceRequest(request);
98 } 98 }
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