| 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/favicon_source.h" | 5 #include "chrome/browser/ui/webui/favicon_source.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "chrome/browser/favicon/favicon_service_factory.h" | 9 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 10 #include "chrome/browser/history/top_sites.h" | 10 #include "chrome/browser/history/top_sites.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 SendResponse(request_id, | 102 SendResponse(request_id, |
| 103 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 103 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
| 104 history::kPrepopulatedPages[i].favicon_id, | 104 history::kPrepopulatedPages[i].favicon_id, |
| 105 ui::SCALE_FACTOR_100P)); | 105 ui::SCALE_FACTOR_100P)); |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 // TODO(estade): fetch the requested size. | 110 // TODO(estade): fetch the requested size. |
| 111 handle = favicon_service->GetRawFaviconForURL( | 111 handle = favicon_service->GetRawFaviconForURL( |
| 112 profile_, | 112 FaviconService::FaviconForURLParams( |
| 113 url, | 113 profile_, |
| 114 icon_types_, | 114 url, |
| 115 gfx::kFaviconSize, | 115 icon_types_, |
| 116 gfx::kFaviconSize, |
| 117 &cancelable_consumer_), |
| 116 ui::SCALE_FACTOR_100P, | 118 ui::SCALE_FACTOR_100P, |
| 117 &cancelable_consumer_, | |
| 118 base::Bind(&FaviconSource::OnFaviconDataAvailable, | 119 base::Bind(&FaviconSource::OnFaviconDataAvailable, |
| 119 base::Unretained(this))); | 120 base::Unretained(this))); |
| 120 } | 121 } |
| 121 | 122 |
| 122 // Attach the ChromeURLDataManager request ID to the history request. | 123 // Attach the ChromeURLDataManager request ID to the history request. |
| 123 cancelable_consumer_.SetClientData(favicon_service, handle, request_id); | 124 cancelable_consumer_.SetClientData(favicon_service, handle, request_id); |
| 124 } | 125 } |
| 125 | 126 |
| 126 std::string FaviconSource::GetMimeType(const std::string&) const { | 127 std::string FaviconSource::GetMimeType(const std::string&) const { |
| 127 // We need to explicitly return a mime type, otherwise if the user tries to | 128 // We need to explicitly return a mime type, otherwise if the user tries to |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 default_favicon_ = | 166 default_favicon_ = |
| 166 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 167 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
| 167 IDR_DEFAULT_FAVICON, ui::SCALE_FACTOR_100P); | 168 IDR_DEFAULT_FAVICON, ui::SCALE_FACTOR_100P); |
| 168 } | 169 } |
| 169 bytes = default_favicon_; | 170 bytes = default_favicon_; |
| 170 } | 171 } |
| 171 request_size_map_.erase(request_id); | 172 request_size_map_.erase(request_id); |
| 172 | 173 |
| 173 SendResponse(request_id, bytes); | 174 SendResponse(request_id, bytes); |
| 174 } | 175 } |
| OLD | NEW |