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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 bool FaviconSource::ShouldServiceRequest(const net::URLRequest* request) const { | 142 bool FaviconSource::ShouldServiceRequest(const net::URLRequest* request) const { |
143 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) | 143 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) |
144 return InstantIOContext::ShouldServiceRequest(request); | 144 return InstantIOContext::ShouldServiceRequest(request); |
145 return URLDataSource::ShouldServiceRequest(request); | 145 return URLDataSource::ShouldServiceRequest(request); |
146 } | 146 } |
147 | 147 |
148 bool FaviconSource::HandleMissingResource(const IconRequest& request) { | 148 bool FaviconSource::HandleMissingResource(const IconRequest& request) { |
149 // If the favicon is not available, try to use the synced favicon. | 149 // If the favicon is not available, try to use the synced favicon. |
150 ProfileSyncService* sync_service = | 150 ProfileSyncService* sync_service = |
151 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); | 151 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); |
152 sync_driver::OpenTabsUIDelegate* open_tabs = | 152 sync_sessions::OpenTabsUIDelegate* open_tabs = |
153 sync_service ? sync_service->GetOpenTabsUIDelegate() : nullptr; | 153 sync_service ? sync_service->GetOpenTabsUIDelegate() : nullptr; |
154 | 154 |
155 scoped_refptr<base::RefCountedMemory> response; | 155 scoped_refptr<base::RefCountedMemory> response; |
156 if (open_tabs && | 156 if (open_tabs && |
157 open_tabs->GetSyncedFaviconForPageURL(request.request_path.spec(), | 157 open_tabs->GetSyncedFaviconForPageURL(request.request_path.spec(), |
158 &response)) { | 158 &response)) { |
159 request.callback.Run(response.get()); | 159 request.callback.Run(response.get()); |
160 return true; | 160 return true; |
161 } | 161 } |
162 return false; | 162 return false; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 ui::ScaleFactor resource_scale_factor = | 202 ui::ScaleFactor resource_scale_factor = |
203 ui::GetSupportedScaleFactor(icon_request.device_scale_factor); | 203 ui::GetSupportedScaleFactor(icon_request.device_scale_factor); |
204 default_favicon = | 204 default_favicon = |
205 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 205 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
206 resource_id, resource_scale_factor); | 206 resource_id, resource_scale_factor); |
207 default_favicons_[favicon_index] = default_favicon; | 207 default_favicons_[favicon_index] = default_favicon; |
208 } | 208 } |
209 | 209 |
210 icon_request.callback.Run(default_favicon); | 210 icon_request.callback.Run(default_favicon); |
211 } | 211 } |
OLD | NEW |