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

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 650180: Initial Geolocation location bar icons. (Closed)
Patch Set: Addresses Peter and Brett's comments. Created 10 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/tab_contents/tab_contents.h ('k') | chrome/browser/views/content_blocked_bubble_contents.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents.cc
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index db8e51ff8ee91b522d09951951007dbe0e73d708..1398303a23c0aa1fd5d96e39abd439a1c64ec7ba 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -603,6 +603,18 @@ bool TabContents::IsContentBlocked(ContentSettingsType content_type) const {
content_type == CONTENT_SETTINGS_TYPE_COOKIES)
return content_blocked_[content_type];
+ if (content_type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
+ for (GeolocationContentSettings::const_iterator i =
+ geolocation_content_settings_.begin();
+ i != geolocation_content_settings_.end(); ++i ) {
+ if (i->second == CONTENT_SETTING_ALLOW)
+ return false;
+ }
+ // Note: this does not necessarily mean that Geolocation is blocked, rather
+ // that there are no frames currently using or allowed to use Geolocation.
+ return true;
+ }
+
NOTREACHED();
return false;
}
@@ -1285,6 +1297,11 @@ void TabContents::ClearBlockedContentSettings() {
content_blocked_[i] = false;
}
+// Resets the |geolocation_settings_| map.
+void TabContents::ClearGeolocationContentSettings() {
+ geolocation_content_settings_.clear();
+}
+
// Notifies the RenderWidgetHost instance about the fact that the page is
// loading, or done loading and calls the base implementation.
void TabContents::SetIsLoading(bool is_loading,
@@ -1472,6 +1489,7 @@ void TabContents::DidNavigateMainFramePostCommit(
// Clear "blocked" flags.
ClearBlockedContentSettings();
+ ClearGeolocationContentSettings();
if (delegate_)
delegate_->OnBlockedContentChange(this);
}
@@ -2006,6 +2024,15 @@ void TabContents::OnContentBlocked(ContentSettingsType type) {
delegate_->OnBlockedContentChange(this);
}
+void TabContents::OnGeolocationPermissionSet(
+ const std::string& host, bool allowed) {
+ geolocation_content_settings_[host] =
+ allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK;
+ // TODO(bulach): rename OnBlockedContentChange to OnContentSettingsChange.
+ if (delegate_)
+ delegate_->OnBlockedContentChange(this);
+}
+
RenderViewHostDelegate::View* TabContents::GetViewDelegate() {
return view_.get();
}
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/browser/views/content_blocked_bubble_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698