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