Commit efb2ee24 authored by gbillock@chromium.org's avatar gbillock@chromium.org

[Geolocation] Enable content settings write using permissions bubbles.

BUG=352380,382556

Review URL: https://codereview.chromium.org/360773003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282360 0039d316-1c4b-4281-b951-d872f2087c98
parent 5c5b8bf1
......@@ -50,6 +50,11 @@ class PermissionQueueController : public content::NotificationObserver {
bool update_content_setting,
bool allowed);
// Performs the update to content settings for a particular request frame
// context.
void UpdateContentSetting(
const GURL& requesting_frame, const GURL& embedder, bool allowed);
protected:
// content::NotificationObserver:
virtual void Observe(int type,
......@@ -78,9 +83,6 @@ class PermissionQueueController : public content::NotificationObserver {
void RegisterForInfoBarNotifications(InfoBarService* infobar_service);
void UnregisterForInfoBarNotifications(InfoBarService* infobar_service);
void UpdateContentSetting(
const GURL& requesting_frame, const GURL& embedder, bool allowed);
content::NotificationRegistrar registrar_;
Profile* const profile_;
......
......@@ -33,6 +33,7 @@ class GeolocationPermissionRequest : public PermissionBubbleRequest {
GeolocationPermissionRequest(GeolocationPermissionContext* context,
const PermissionRequestID& id,
const GURL& requesting_frame,
const GURL& embedder,
bool user_gesture,
base::Callback<void(bool)> callback,
const std::string& display_languages);
......@@ -53,6 +54,7 @@ class GeolocationPermissionRequest : public PermissionBubbleRequest {
GeolocationPermissionContext* context_;
PermissionRequestID id_;
GURL requesting_frame_;
GURL embedder_;
bool user_gesture_;
base::Callback<void(bool)> callback_;
std::string display_languages_;
......@@ -62,12 +64,14 @@ GeolocationPermissionRequest::GeolocationPermissionRequest(
GeolocationPermissionContext* context,
const PermissionRequestID& id,
const GURL& requesting_frame,
const GURL& embedder,
bool user_gesture,
base::Callback<void(bool)> callback,
const std::string& display_languages)
: context_(context),
id_(id),
requesting_frame_(requesting_frame),
embedder_(embedder),
user_gesture_(user_gesture),
callback_(callback),
display_languages_(display_languages) {}
......@@ -100,10 +104,14 @@ GURL GeolocationPermissionRequest::GetRequestingHostname() const {
}
void GeolocationPermissionRequest::PermissionGranted() {
context_->QueueController()->UpdateContentSetting(
requesting_frame_, embedder_, true);
context_->NotifyPermissionSet(id_, requesting_frame_, callback_, true);
}
void GeolocationPermissionRequest::PermissionDenied() {
context_->QueueController()->UpdateContentSetting(
requesting_frame_, embedder_, false);
context_->NotifyPermissionSet(id_, requesting_frame_, callback_, false);
}
......@@ -218,7 +226,7 @@ void GeolocationPermissionContext::DecidePermission(
if (mgr) {
scoped_ptr<GeolocationPermissionRequest> request_ptr(
new GeolocationPermissionRequest(
this, id, requesting_frame, user_gesture, callback,
this, id, requesting_frame, embedder, user_gesture, callback,
profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)));
GeolocationPermissionRequest* request = request_ptr.get();
pending_requests_.add(id.ToString(), request_ptr.Pass());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment