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

Unified Diff: chrome/browser/banners/app_banner_manager.cc

Issue 1017193002: [App banners] Be less strict about navigations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 5 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/banners/app_banner_manager.h ('k') | chrome/browser/banners/app_banner_settings_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/banners/app_banner_manager.cc
diff --git a/chrome/browser/banners/app_banner_manager.cc b/chrome/browser/banners/app_banner_manager.cc
index c16251fdf2896b7f0cf735a7fec6955760874198..67eae4f8e924d68b879681d0b664bba145e67ebd 100644
--- a/chrome/browser/banners/app_banner_manager.cc
+++ b/chrome/browser/banners/app_banner_manager.cc
@@ -6,6 +6,7 @@
#include "base/metrics/field_trial.h"
#include "chrome/browser/banners/app_banner_data_fetcher.h"
+#include "chrome/browser/banners/app_banner_settings_helper.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
@@ -19,6 +20,12 @@ bool gDisableSecureCheckForTesting = false;
namespace banners {
+bool AppBannerManager::URLsAreForTheSamePage(const GURL& first,
+ const GURL& second) {
+ return first.GetWithEmptyPath() == second.GetWithEmptyPath() &&
+ first.path() == second.path() && first.query() == second.query();
+}
+
AppBannerManager::AppBannerManager(int icon_size)
: ideal_icon_size_(icon_size),
data_fetcher_(nullptr),
@@ -35,6 +42,11 @@ void AppBannerManager::DidFinishLoad(
if (render_frame_host->GetParent())
return;
+ if (data_fetcher_.get() && data_fetcher_->is_active() &&
+ URLsAreForTheSamePage(data_fetcher_->validated_url(), validated_url)) {
+ return;
+ }
+
// A secure scheme is required to show banners, so exit early if we see the
// URL is invalid.
if (!validated_url.SchemeIsSecure() && !gDisableSecureCheckForTesting)
« no previous file with comments | « chrome/browser/banners/app_banner_manager.h ('k') | chrome/browser/banners/app_banner_settings_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698