Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: chrome/browser/ui/webui/favicon_source.cc

Issue 11896113: Add chrome-search: access from Instant overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Yet another rebase Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/browser/favicon/favicon_service_factory.h" 10 #include "chrome/browser/favicon/favicon_service_factory.h"
11 #include "chrome/browser/history/top_sites.h" 11 #include "chrome/browser/history/top_sites.h"
12 #include "chrome/browser/instant/instant_io_context.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
14 #include "grit/locale_settings.h" 15 #include "grit/locale_settings.h"
15 #include "grit/ui_resources.h" 16 #include "grit/ui_resources.h"
17 #include "net/url_request/url_request.h"
16 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/layout.h" 19 #include "ui/base/layout.h"
18 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/webui/web_ui_util.h" 21 #include "ui/webui/web_ui_util.h"
20 22
21 namespace { 23 namespace {
22 24
23 // Parameters which can be used in chrome://favicon path. See .h file for a 25 // Parameters which can be used in chrome://favicon path. See .h file for a
24 // description of what each does. 26 // description of what each does.
25 const char kIconURLParameter[] = "iconurl/"; 27 const char kIconURLParameter[] = "iconurl/";
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // drag the image they get no extension. 211 // drag the image they get no extension.
210 return "image/png"; 212 return "image/png";
211 } 213 }
212 214
213 bool FaviconSource::ShouldReplaceExistingSource() const { 215 bool FaviconSource::ShouldReplaceExistingSource() const {
214 // Leave the existing DataSource in place, otherwise we'll drop any pending 216 // Leave the existing DataSource in place, otherwise we'll drop any pending
215 // requests on the floor. 217 // requests on the floor.
216 return false; 218 return false;
217 } 219 }
218 220
221 bool FaviconSource::ShouldServiceRequest(const net::URLRequest* request) const {
222 if (request->url().SchemeIs(chrome::kChromeSearchScheme))
223 return InstantIOContext::ShouldServiceRequest(request);
224 return URLDataSource::ShouldServiceRequest(request);
225 }
226
219 bool FaviconSource::HandleMissingResource(const IconRequest& request) { 227 bool FaviconSource::HandleMissingResource(const IconRequest& request) {
220 // No additional checks to locate the favicon resource in the base 228 // No additional checks to locate the favicon resource in the base
221 // implementation. 229 // implementation.
222 return false; 230 return false;
223 } 231 }
224 232
225 void FaviconSource::OnFaviconDataAvailable( 233 void FaviconSource::OnFaviconDataAvailable(
226 const IconRequest& request, 234 const IconRequest& request,
227 const history::FaviconBitmapResult& bitmap_result) { 235 const history::FaviconBitmapResult& bitmap_result) {
228 if (bitmap_result.is_valid()) { 236 if (bitmap_result.is_valid()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 270
263 if (!default_favicon) { 271 if (!default_favicon) {
264 ui::ScaleFactor scale_factor = icon_request.scale_factor; 272 ui::ScaleFactor scale_factor = icon_request.scale_factor;
265 default_favicon = ResourceBundle::GetSharedInstance() 273 default_favicon = ResourceBundle::GetSharedInstance()
266 .LoadDataResourceBytesForScale(resource_id, scale_factor); 274 .LoadDataResourceBytesForScale(resource_id, scale_factor);
267 default_favicons_[favicon_index] = default_favicon; 275 default_favicons_[favicon_index] = default_favicon;
268 } 276 }
269 277
270 icon_request.callback.Run(default_favicon); 278 icon_request.callback.Run(default_favicon);
271 } 279 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/favicon_source.h ('k') | chrome/browser/ui/webui/ntp/thumbnail_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698