| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 ThumbnailSource::~ThumbnailSource() { | 30 ThumbnailSource::~ThumbnailSource() { |
| 31 } | 31 } |
| 32 | 32 |
| 33 std::string ThumbnailSource::GetSource() { | 33 std::string ThumbnailSource::GetSource() { |
| 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 const content::URLDataSource::ExtraRequestInfo& info, |
| 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. |
| 44 std::string path = raw_path; | 44 std::string path = raw_path; |
| 45 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 45 if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 46 std::map<std::string, std::string>::iterator it = | 46 std::map<std::string, std::string>::iterator it = |
| 47 id_to_url_map_.find(raw_path); | 47 id_to_url_map_.find(raw_path); |
| 48 if (it != id_to_url_map_.end()) { | 48 if (it != id_to_url_map_.end()) { |
| 49 path = id_to_url_map_[raw_path]; | 49 path = id_to_url_map_[raw_path]; |
| (...skipping 39 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 |