Chromium Code Reviews| Index: chrome/browser/ui/webui/favicon_source.cc |
| diff --git a/chrome/browser/ui/webui/favicon_source.cc b/chrome/browser/ui/webui/favicon_source.cc |
| index 3c8658237e4703f4d7c00a289968a2930d120d9d..d9f051254898845884152a1c440e375ef2250a91 100644 |
| --- a/chrome/browser/ui/webui/favicon_source.cc |
| +++ b/chrome/browser/ui/webui/favicon_source.cc |
| @@ -10,6 +10,8 @@ |
| #include "chrome/browser/favicon/favicon_service_factory.h" |
| #include "chrome/browser/history/top_sites.h" |
| #include "chrome/browser/instant/instant_io_context.h" |
| +#include "chrome/browser/instant/instant_service.h" |
| +#include "chrome/browser/instant/instant_service_factory.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/common/url_constants.h" |
| #include "grit/locale_settings.h" |
| @@ -80,16 +82,21 @@ std::string FaviconSource::GetSource() { |
| } |
| void FaviconSource::StartDataRequest( |
| - const std::string& path, |
| + const std::string& raw_path, |
| bool is_incognito, |
| const content::URLDataSource::GotDataCallback& callback) { |
| FaviconService* favicon_service = |
| FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
| - if (!favicon_service || path.empty()) { |
| + if (!favicon_service || raw_path.empty()) { |
| SendDefaultResponse(callback); |
| return; |
| } |
| + // Translate to regular path if |raw_path| is of the form |
| + // chrome-search://favicon/<rid>, where rid is a uint64. |
|
Evan Stade
2013/03/12 01:30:23
nit: rid no longer makes sense here
dhollowa
2013/03/12 01:48:07
Done.
|
| + std::string path = InstantService::MaybeTranslateInstantPathOnUI(profile_, |
| + raw_path); |
| + |
| DCHECK_EQ(16, gfx::kFaviconSize); |
| int size_in_dip = 16; |
| ui::ScaleFactor scale_factor = ui::SCALE_FACTOR_100P; |
| @@ -219,8 +226,10 @@ bool FaviconSource::ShouldReplaceExistingSource() const { |
| } |
| bool FaviconSource::ShouldServiceRequest(const net::URLRequest* request) const { |
| - if (request->url().SchemeIs(chrome::kChromeSearchScheme)) |
| - return InstantIOContext::ShouldServiceRequest(request); |
| + if (request->url().SchemeIs(chrome::kChromeSearchScheme)) { |
| + return InstantService::IsInstantPath(request->url()) && |
| + InstantIOContext::ShouldServiceRequest(request); |
| + } |
| return URLDataSource::ShouldServiceRequest(request); |
| } |