| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/ui/webui/history/favicon_source.h" | 5 #include "ios/chrome/browser/ui/webui/history/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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool FaviconSource::ShouldReplaceExistingSource() const { | 116 bool FaviconSource::ShouldReplaceExistingSource() const { |
| 117 // Leave the existing DataSource in place, otherwise we'll drop any pending | 117 // Leave the existing DataSource in place, otherwise we'll drop any pending |
| 118 // requests on the floor. | 118 // requests on the floor. |
| 119 return false; | 119 return false; |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool FaviconSource::HandleMissingResource(const IconRequest& request) { | 122 bool FaviconSource::HandleMissingResource(const IconRequest& request) { |
| 123 // If the favicon is not available, try to use the synced favicon. | 123 // If the favicon is not available, try to use the synced favicon. |
| 124 sync_driver::OpenTabsUIDelegate* open_tabs = | 124 sync_sessions::OpenTabsUIDelegate* open_tabs = |
| 125 sync_service_ ? sync_service_->GetOpenTabsUIDelegate() : nullptr; | 125 sync_service_ ? sync_service_->GetOpenTabsUIDelegate() : nullptr; |
| 126 | 126 |
| 127 scoped_refptr<base::RefCountedMemory> response; | 127 scoped_refptr<base::RefCountedMemory> response; |
| 128 if (open_tabs && | 128 if (open_tabs && |
| 129 open_tabs->GetSyncedFaviconForPageURL(request.request_path.spec(), | 129 open_tabs->GetSyncedFaviconForPageURL(request.request_path.spec(), |
| 130 &response)) { | 130 &response)) { |
| 131 request.callback.Run(response.get()); | 131 request.callback.Run(response.get()); |
| 132 return true; | 132 return true; |
| 133 } | 133 } |
| 134 return false; | 134 return false; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 ui::ScaleFactor resource_scale_factor = | 174 ui::ScaleFactor resource_scale_factor = |
| 175 ui::GetSupportedScaleFactor(icon_request.device_scale_factor); | 175 ui::GetSupportedScaleFactor(icon_request.device_scale_factor); |
| 176 default_favicon = | 176 default_favicon = |
| 177 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 177 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
| 178 resource_id, resource_scale_factor); | 178 resource_id, resource_scale_factor); |
| 179 default_favicons_[favicon_index] = default_favicon; | 179 default_favicons_[favicon_index] = default_favicon; |
| 180 } | 180 } |
| 181 | 181 |
| 182 icon_request.callback.Run(default_favicon); | 182 icon_request.callback.Run(default_favicon); |
| 183 } | 183 } |
| OLD | NEW |