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

Unified Diff: components/favicon/content/content_favicon_driver.cc

Issue 2732653002: Add favicon integration tests for FaviconDriverImpl (Closed)
Patch Set: Added verification of color Created 3 years, 10 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 | « components/favicon/content/content_favicon_driver.h ('k') | components/favicon/core/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/content/content_favicon_driver.cc
diff --git a/components/favicon/content/content_favicon_driver.cc b/components/favicon/content/content_favicon_driver.cc
index cf9bba46bd0e8602c7267d70d0bfda0dce657bcf..1fd8d3a5f774c361c00e204a56ea31b5606fa151 100644
--- a/components/favicon/content/content_favicon_driver.cc
+++ b/components/favicon/content/content_favicon_driver.cc
@@ -21,6 +21,15 @@
DEFINE_WEB_CONTENTS_USER_DATA_KEY(favicon::ContentFaviconDriver);
namespace favicon {
+namespace {
+
+#if defined(OS_ANDROID)
+const bool kEnableTouchIcon = true;
+#else
+const bool kEnableTouchIcon = false;
+#endif
+
+} // namespace
// static
void ContentFaviconDriver::CreateForWebContents(
@@ -74,34 +83,16 @@ gfx::Image ContentFaviconDriver::GetFavicon() const {
return gfx::Image();
}
-bool ContentFaviconDriver::FaviconIsValid() const {
- const content::NavigationController& controller =
- web_contents()->GetController();
- content::NavigationEntry* entry = controller.GetTransientEntry();
- if (entry)
- return entry->GetFavicon().valid;
-
- entry = controller.GetLastCommittedEntry();
- if (entry)
- return entry->GetFavicon().valid;
-
- return false;
-}
-
-GURL ContentFaviconDriver::GetActiveURL() {
- content::NavigationEntry* entry =
- web_contents()->GetController().GetLastCommittedEntry();
- return entry ? entry->GetURL() : GURL();
-}
-
ContentFaviconDriver::ContentFaviconDriver(
content::WebContents* web_contents,
FaviconService* favicon_service,
history::HistoryService* history_service,
bookmarks::BookmarkModel* bookmark_model)
: content::WebContentsObserver(web_contents),
- FaviconDriverImpl(favicon_service, history_service, bookmark_model) {
-}
+ FaviconDriverImpl(kEnableTouchIcon,
+ favicon_service,
+ history_service,
+ bookmark_model) {}
ContentFaviconDriver::~ContentFaviconDriver() {
}
@@ -114,7 +105,11 @@ int ContentFaviconDriver::DownloadImage(const GURL& url,
return 0;
}
- bool bypass_cache = (bypass_cache_page_url_ == GetActiveURL());
+ content::NavigationEntry* entry =
+ web_contents()->GetController().GetLastCommittedEntry();
+ const GURL active_url = entry ? entry->GetURL() : GURL();
+
+ bool bypass_cache = (bypass_cache_page_url_ == active_url);
bypass_cache_page_url_ = GURL();
return web_contents()->DownloadImage(url, true, max_image_size, bypass_cache,
« no previous file with comments | « components/favicon/content/content_favicon_driver.h ('k') | components/favicon/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698