| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 // Set ThumbnailService now as Profile isn't thread safe. | 24 // Set ThumbnailService now as Profile isn't thread safe. |
| 25 ThumbnailSource::ThumbnailSource(Profile* profile) | 25 ThumbnailSource::ThumbnailSource(Profile* profile) |
| 26 : thumbnail_service_(ThumbnailServiceFactory::GetForProfile(profile)), | 26 : thumbnail_service_(ThumbnailServiceFactory::GetForProfile(profile)), |
| 27 profile_(profile) { | 27 profile_(profile) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 ThumbnailSource::~ThumbnailSource() { | 30 ThumbnailSource::~ThumbnailSource() { |
| 31 } | 31 } |
| 32 | 32 |
| 33 std::string ThumbnailSource::GetSource() { | 33 std::string ThumbnailSource::GetSource() const { |
| 34 return chrome::kChromeUIThumbnailHost; | 34 return chrome::kChromeUIThumbnailHost; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void ThumbnailSource::StartDataRequest( | 37 void ThumbnailSource::StartDataRequest( |
| 38 const std::string& raw_path, | 38 const std::string& raw_path, |
| 39 bool is_incognito, | 39 bool is_incognito, |
| 40 const content::URLDataSource::GotDataCallback& callback) { | 40 const content::URLDataSource::GotDataCallback& callback) { |
| 41 // Translate to regular path if |raw_path| is of the form | 41 // Translate to regular path if |raw_path| is of the form |
| 42 // chrome-search://favicon/<id> or chrome-search://thumb/<id>, where <id> is | 42 // chrome-search://favicon/<id> or chrome-search://thumb/<id>, where <id> is |
| 43 // an integer. | 43 // an integer. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |