summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 09:36:55 +0000
committerbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 09:36:55 +0000
commit9d062b16388f2b6671c6dbcc7b09e0b3090b1921 (patch)
treee45b04efca988844aca6486b1c541dda8aceeaba
parent8a25f58b49685057aac9d9e91fc4654a56f3debc (diff)
downloadchromium_src-9d062b16388f2b6671c6dbcc7b09e0b3090b1921.zip
chromium_src-9d062b16388f2b6671c6dbcc7b09e0b3090b1921.tar.gz
chromium_src-9d062b16388f2b6671c6dbcc7b09e0b3090b1921.tar.bz2
The geolocation icon must be displayed even if the current origin change its document or query params.
We should only remove the icon when visiting a new origin or the underlying setting has changed. BUG=40742 Review URL: http://codereview.chromium.org/1640004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44463 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc22
-rw-r--r--chrome/browser/tab_contents/tab_contents.h3
2 files changed, 21 insertions, 4 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 5068275..e2744e1 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -33,6 +33,7 @@
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/favicon_service.h"
#include "chrome/browser/find_bar_state.h"
+#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
#include "chrome/browser/google_util.h"
#include "chrome/browser/host_content_settings_map.h"
#include "chrome/browser/hung_renderer_dialog.h"
@@ -1348,8 +1349,23 @@ void TabContents::ClearBlockedContentSettings() {
}
// Resets the |geolocation_settings_| map.
-void TabContents::ClearGeolocationContentSettings() {
- geolocation_content_settings_.clear();
+void TabContents::ClearGeolocationContentSettings(
+ const NavigationController::LoadCommittedDetails& details) {
+ if (!geolocation_content_settings_.empty()) {
+ // Clear the geolocation settings only if we're going to a new origin,
+ // or if we're staying at the same origin and its setting is ASK.
+ // This is to prevent clearing the icon by just changing some URL param.
+ // TODO(bulach): refactor this logic into its own class and remove the
+ // duplication from ContentSettingDomainListBubbleModel.
+ if (!details.entry ||
+ details.previous_url.GetOrigin() != details.entry->url().GetOrigin() ||
+ (details.entry->url().is_valid() &&
+ profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
+ details.entry->url(), details.entry->url()) ==
+ CONTENT_SETTING_ASK)) {
+ geolocation_content_settings_.clear();
+ }
+ }
}
// Notifies the RenderWidgetHost instance about the fact that the page is
@@ -1539,7 +1555,7 @@ void TabContents::DidNavigateMainFramePostCommit(
// Clear "blocked" flags.
ClearBlockedContentSettings();
- ClearGeolocationContentSettings();
+ ClearGeolocationContentSettings(details);
if (delegate_)
delegate_->OnBlockedContentChange(this);
}
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 97f688a..91519c8 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -720,7 +720,8 @@ class TabContents : public PageNavigator,
void ClearBlockedContentSettings();
// Resets the |geolocation_settings_| map.
- void ClearGeolocationContentSettings();
+ void ClearGeolocationContentSettings(
+ const NavigationController::LoadCommittedDetails& details);
// Changes the IsLoading state and notifies delegate as needed
// |details| is used to provide details on the load that just finished