| 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 <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 std::string FaviconSource::GetSource() const { | 57 std::string FaviconSource::GetSource() const { |
| 58 return icon_types_ == favicon_base::FAVICON ? chrome::kChromeUIFaviconHost | 58 return icon_types_ == favicon_base::FAVICON ? chrome::kChromeUIFaviconHost |
| 59 : chrome::kChromeUITouchIconHost; | 59 : chrome::kChromeUITouchIconHost; |
| 60 } | 60 } |
| 61 | 61 |
| 62 void FaviconSource::StartDataRequest( | 62 void FaviconSource::StartDataRequest( |
| 63 const std::string& path, | 63 const std::string& path, |
| 64 int render_process_id, | 64 int render_process_id, |
| 65 int render_frame_id, | 65 int render_frame_id, |
| 66 const content::URLDataSource::GotDataCallback& callback) { | 66 const content::URLDataSource::GotDataCallback& callback) { |
| 67 FaviconService* favicon_service = | 67 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
| 68 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 68 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
| 69 if (!favicon_service) { | 69 if (!favicon_service) { |
| 70 SendDefaultResponse(callback); | 70 SendDefaultResponse(callback); |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 | 73 |
| 74 chrome::ParsedFaviconPath parsed; | 74 chrome::ParsedFaviconPath parsed; |
| 75 bool success = chrome::ParseFaviconPath(path, icon_types_, &parsed); | 75 bool success = chrome::ParseFaviconPath(path, icon_types_, &parsed); |
| 76 if (!success) { | 76 if (!success) { |
| 77 SendDefaultResponse(callback); | 77 SendDefaultResponse(callback); |
| 78 return; | 78 return; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 ui::ScaleFactor resource_scale_factor = | 198 ui::ScaleFactor resource_scale_factor = |
| 199 ui::GetSupportedScaleFactor(icon_request.device_scale_factor); | 199 ui::GetSupportedScaleFactor(icon_request.device_scale_factor); |
| 200 default_favicon = | 200 default_favicon = |
| 201 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 201 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
| 202 resource_id, resource_scale_factor); | 202 resource_id, resource_scale_factor); |
| 203 default_favicons_[favicon_index] = default_favicon; | 203 default_favicons_[favicon_index] = default_favicon; |
| 204 } | 204 } |
| 205 | 205 |
| 206 icon_request.callback.Run(default_favicon); | 206 icon_request.callback.Run(default_favicon); |
| 207 } | 207 } |
| OLD | NEW |