summaryrefslogtreecommitdiffstats
path: root/components/favicon
diff options
context:
space:
mode:
authorpkotwicz <pkotwicz@chromium.org>2015-10-14 08:17:21 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-14 15:18:23 +0000
commitf1b2f5e47074c52c24411f4b90d32396cca4c73f (patch)
tree2d5d9adbb858aafbf9a86f7ebb9c023fc7ea071a /components/favicon
parent53c51725895c756d1a6a192883c92dc4ed5b5b93 (diff)
downloadchromium_src-f1b2f5e47074c52c24411f4b90d32396cca4c73f.zip
chromium_src-f1b2f5e47074c52c24411f4b90d32396cca4c73f.tar.gz
chromium_src-f1b2f5e47074c52c24411f4b90d32396cca4c73f.tar.bz2
Stop FaviconHandler from querying GetActiveFaviconValidity() part 2/2
Remove the GetActiveFaviconValidity() check in FaviconHandler::OnFaviconDataForInitialURLFromFaviconService(). - Calling NotifyFaviconAvailable() on non-Android is inexpensive. - GetActiveFaviconValidity() is only true during back and forward navigations. - Android already ignores GetActiveFaviconValidity() Android Java solely uses the notifications fired from NotifyFaviconAvailable() to determine a page's favicon. It needs to get notifications to update the page's favicon as a result of back and forward notifications BUG=517089 Review URL: https://codereview.chromium.org/1399913002 Cr-Commit-Position: refs/heads/master@{#354026}
Diffstat (limited to 'components/favicon')
-rw-r--r--components/favicon/content/content_favicon_driver.cc4
-rw-r--r--components/favicon/content/content_favicon_driver.h1
-rw-r--r--components/favicon/core/favicon_driver.h4
-rw-r--r--components/favicon/core/favicon_handler.cc3
-rw-r--r--components/favicon/core/favicon_handler_unittest.cc2
-rw-r--r--components/favicon/ios/web_favicon_driver.cc17
-rw-r--r--components/favicon/ios/web_favicon_driver.h4
7 files changed, 4 insertions, 31 deletions
diff --git a/components/favicon/content/content_favicon_driver.cc b/components/favicon/content/content_favicon_driver.cc
index 5d71df0..8cf9066 100644
--- a/components/favicon/content/content_favicon_driver.cc
+++ b/components/favicon/content/content_favicon_driver.cc
@@ -113,10 +113,6 @@ GURL ContentFaviconDriver::GetActiveURL() {
return entry ? entry->GetURL() : GURL();
}
-bool ContentFaviconDriver::GetActiveFaviconValidity() {
- return GetFaviconStatus().valid;
-}
-
void ContentFaviconDriver::SetActiveFaviconValidity(bool valid) {
GetFaviconStatus().valid = valid;
}
diff --git a/components/favicon/content/content_favicon_driver.h b/components/favicon/content/content_favicon_driver.h
index adbc7e7..1af8bb1 100644
--- a/components/favicon/content/content_favicon_driver.h
+++ b/components/favicon/content/content_favicon_driver.h
@@ -47,7 +47,6 @@ class ContentFaviconDriver
int StartDownload(const GURL& url, int max_bitmap_size) override;
bool IsOffTheRecord() override;
GURL GetActiveURL() override;
- bool GetActiveFaviconValidity() override;
void SetActiveFaviconValidity(bool valid) override;
GURL GetActiveFaviconURL() override;
void SetActiveFaviconURL(const GURL& url) override;
diff --git a/components/favicon/core/favicon_driver.h b/components/favicon/core/favicon_driver.h
index cf9a4a5..0c2747e 100644
--- a/components/favicon/core/favicon_driver.h
+++ b/components/favicon/core/favicon_driver.h
@@ -61,10 +61,6 @@ class FaviconDriver {
// otherwise.
virtual GURL GetActiveURL() = 0;
- // Returns whether the page's favicon is valid (returns false if the default
- // favicon is being used).
- virtual bool GetActiveFaviconValidity() = 0;
-
// Sets whether the page's favicon is valid (if false, the default favicon is
// being used).
virtual void SetActiveFaviconValidity(bool valid) = 0;
diff --git a/components/favicon/core/favicon_handler.cc b/components/favicon/core/favicon_handler.cc
index d8ec1ea..3d15052 100644
--- a/components/favicon/core/favicon_handler.cc
+++ b/components/favicon/core/favicon_handler.cc
@@ -568,8 +568,7 @@ void FaviconHandler::OnFaviconDataForInitialURLFromFaviconService(
preferred_icon_size(), favicon_bitmap_results);
bool has_valid_result = HasValidResult(favicon_bitmap_results);
- if (has_results && handler_type_ == FAVICON &&
- !download_largest_icon_ && !driver_->GetActiveFaviconValidity() &&
+ if (has_results && handler_type_ == FAVICON && !download_largest_icon_ &&
(!current_candidate() ||
DoUrlsAndIconsMatch(*current_candidate(), favicon_bitmap_results))) {
if (has_valid_result) {
diff --git a/components/favicon/core/favicon_handler_unittest.cc b/components/favicon/core/favicon_handler_unittest.cc
index ca89afa..2afd9bf 100644
--- a/components/favicon/core/favicon_handler_unittest.cc
+++ b/components/favicon/core/favicon_handler_unittest.cc
@@ -229,7 +229,7 @@ class TestFaviconDriver : public FaviconDriver {
GURL GetActiveURL() override { return url_; }
- bool GetActiveFaviconValidity() override { return favicon_validity_; }
+ bool GetActiveFaviconValidity() { return favicon_validity_; }
void SetActiveFaviconValidity(bool favicon_validity) override {
favicon_validity_ = favicon_validity;
diff --git a/components/favicon/ios/web_favicon_driver.cc b/components/favicon/ios/web_favicon_driver.cc
index cadd60f..b1a8e11 100644
--- a/components/favicon/ios/web_favicon_driver.cc
+++ b/components/favicon/ios/web_favicon_driver.cc
@@ -72,16 +72,12 @@ GURL WebFaviconDriver::GetActiveURL() {
return item ? item->GetURL() : GURL();
}
-bool WebFaviconDriver::GetActiveFaviconValidity() {
- return !ActiveURLChangedSinceFetchFavicon() && GetFaviconStatus().valid;
-}
-
void WebFaviconDriver::SetActiveFaviconValidity(bool validity) {
GetFaviconStatus().valid = validity;
}
GURL WebFaviconDriver::GetActiveFaviconURL() {
- return ActiveURLChangedSinceFetchFavicon() ? GURL() : GetFaviconStatus().url;
+ return GetFaviconStatus().url;
}
void WebFaviconDriver::SetActiveFaviconURL(const GURL& url) {
@@ -92,17 +88,8 @@ void WebFaviconDriver::SetActiveFaviconImage(const gfx::Image& image) {
GetFaviconStatus().image = image;
}
-bool WebFaviconDriver::ActiveURLChangedSinceFetchFavicon() {
- // On iOS the active URL can change in between calls to FetchFavicon(). For
- // instance, FetchFavicon() is not synchronously called when the active URL
- // changes as a result of CRWSessionController::goToEntry().
- // TODO(stuartmorgan): Remove this once iOS always triggers favicon fetches
- // synchronously after active URL changes.
- return GetActiveURL() != fetch_favicon_url_;
-}
-
web::FaviconStatus& WebFaviconDriver::GetFaviconStatus() {
- DCHECK(!ActiveURLChangedSinceFetchFavicon());
+ DCHECK(web_state()->GetNavigationManager()->GetVisibleItem());
return web_state()->GetNavigationManager()->GetVisibleItem()->GetFavicon();
}
diff --git a/components/favicon/ios/web_favicon_driver.h b/components/favicon/ios/web_favicon_driver.h
index 0be7bce..1e17e49 100644
--- a/components/favicon/ios/web_favicon_driver.h
+++ b/components/favicon/ios/web_favicon_driver.h
@@ -35,7 +35,6 @@ class WebFaviconDriver : public web::WebStateObserver,
int StartDownload(const GURL& url, int max_bitmap_size) override;
bool IsOffTheRecord() override;
GURL GetActiveURL() override;
- bool GetActiveFaviconValidity() override;
void SetActiveFaviconValidity(bool valid) override;
GURL GetActiveFaviconURL() override;
void SetActiveFaviconURL(const GURL& url) override;
@@ -50,9 +49,6 @@ class WebFaviconDriver : public web::WebStateObserver,
bookmarks::BookmarkModel* bookmark_model);
~WebFaviconDriver() override;
- // Returns whether the active URL has changed since FetchFavicon() was called.
- bool ActiveURLChangedSinceFetchFavicon();
-
// web::WebStateObserver implementation.
void FaviconUrlUpdated(
const std::vector<web::FaviconURL>& candidates) override;