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

Unified Diff: chrome/browser/ui/webui/favicon_source.cc

Issue 12732005: Most visited thumbnails and favicons need id-based urls (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address estade's comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/instant/instant_service.cc ('k') | chrome/browser/ui/webui/ntp/thumbnail_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7414c431c958dc076ca2270cbb08dd1b980b0e2d 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,22 @@ 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/<most_visited_item_id>, where
+ // "most_visited_item_id" is a uint64.
+ 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 +227,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);
}
« no previous file with comments | « chrome/browser/instant/instant_service.cc ('k') | chrome/browser/ui/webui/ntp/thumbnail_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698