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

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

Issue 16290004: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 } else if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { 53 } else if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
54 path = InstantService::MaybeTranslateInstantPathOnUI(profile_, raw_path); 54 path = InstantService::MaybeTranslateInstantPathOnUI(profile_, raw_path);
55 } 55 }
56 56
57 scoped_refptr<base::RefCountedMemory> data; 57 scoped_refptr<base::RefCountedMemory> data;
58 if (thumbnail_service_->GetPageThumbnail(GURL(path), &data)) { 58 if (thumbnail_service_->GetPageThumbnail(GURL(path), &data)) {
59 // We have the thumbnail. 59 // We have the thumbnail.
60 callback.Run(data.get()); 60 callback.Run(data.get());
61 } else { 61 } else {
62 callback.Run(default_thumbnail_); 62 callback.Run(default_thumbnail_.get());
63 } 63 }
64 } 64 }
65 65
66 std::string ThumbnailSource::GetMimeType(const std::string&) const { 66 std::string ThumbnailSource::GetMimeType(const std::string&) const {
67 // We need to explicitly return a mime type, otherwise if the user tries to 67 // We need to explicitly return a mime type, otherwise if the user tries to
68 // drag the image they get no extension. 68 // drag the image they get no extension.
69 return "image/png"; 69 return "image/png";
70 } 70 }
71 71
72 base::MessageLoop* ThumbnailSource::MessageLoopForRequestPath( 72 base::MessageLoop* ThumbnailSource::MessageLoopForRequestPath(
(...skipping 17 matching lines...) Expand all
90 if (!MessageLoopForRequestPath(raw_path)) { 90 if (!MessageLoopForRequestPath(raw_path)) {
91 id_to_url_map_[raw_path] = 91 id_to_url_map_[raw_path] =
92 InstantService::MaybeTranslateInstantPathOnIO(request, raw_path); 92 InstantService::MaybeTranslateInstantPathOnIO(request, raw_path);
93 } 93 }
94 return true; 94 return true;
95 } 95 }
96 return false; 96 return false;
97 } 97 }
98 return URLDataSource::ShouldServiceRequest(request); 98 return URLDataSource::ShouldServiceRequest(request);
99 } 99 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.cc ('k') | chrome/browser/ui/webui/options/certificate_manager_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698