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

Unified Diff: chrome/browser/geolocation/chrome_geolocation_permission_context.cc

Issue 8775004: Geolocation InfoBar sometimes doesn't expire when navigating back. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « no previous file | chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/geolocation/chrome_geolocation_permission_context.cc
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
index f97d1dc78430f26a4900c5b2fd23b779795d6638..4be6d372d68490c9fe7e1bf90a8eca2397f371c9 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
@@ -24,6 +24,7 @@
#include "chrome/common/pref_names.h"
#include "content/browser/geolocation/geolocation_provider.h"
#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/tab_contents/navigation_details.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_registrar.h"
@@ -131,6 +132,8 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual ~GeolocationConfirmInfoBarDelegate();
// ConfirmInfoBarDelegate:
+ virtual bool ShouldExpire(
+ const content::LoadCommittedDetails& details) const OVERRIDE;
virtual gfx::Image* GetIcon() const OVERRIDE;
virtual Type GetInfoBarType() const OVERRIDE;
virtual string16 GetMessageText() const OVERRIDE;
@@ -144,6 +147,10 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
int render_process_id_;
int render_view_id_;
int bridge_id_;
+ // The unique id of the committed NavigationEntry of the TabContents that we
+ // were opened for. Used to help expire on navigations.
+ int committed_contents_unique_id_;
+
GURL requesting_frame_url_;
std::string display_languages_;
@@ -165,6 +172,10 @@ GeolocationConfirmInfoBarDelegate::GeolocationConfirmInfoBarDelegate(
bridge_id_(bridge_id),
requesting_frame_url_(requesting_frame_url),
display_languages_(display_languages) {
+ const NavigationEntry* committed_entry =
+ infobar_helper->tab_contents()->controller().GetLastCommittedEntry();
+ committed_contents_unique_id_ = committed_entry ?
+ committed_entry->unique_id() : 0;
}
GeolocationConfirmInfoBarDelegate::~GeolocationConfirmInfoBarDelegate() {
@@ -172,6 +183,15 @@ GeolocationConfirmInfoBarDelegate::~GeolocationConfirmInfoBarDelegate() {
bridge_id_);
}
+bool GeolocationConfirmInfoBarDelegate::ShouldExpire(
+ const content::LoadCommittedDetails& details) const {
+ if (details.did_replace_entry || !details.is_navigation_to_different_page())
+ return false;
+ return committed_contents_unique_id_ != details.entry->unique_id() ||
+ content::PageTransitionStripQualifier(details.entry->transition_type()) ==
+ content::PAGE_TRANSITION_RELOAD;
+}
+
gfx::Image* GeolocationConfirmInfoBarDelegate::GetIcon() const {
return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
IDR_GEOLOCATION_INFOBAR_ICON);
« no previous file with comments | « no previous file | chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698