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 { ...@@ -50,6 +50,11 @@ class PermissionQueueController : public content::NotificationObserver {
bool update_content_setting, bool update_content_setting,
bool allowed); 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: protected:
// content::NotificationObserver: // content::NotificationObserver:
virtual void Observe(int type, virtual void Observe(int type,
...@@ -78,9 +83,6 @@ class PermissionQueueController : public content::NotificationObserver { ...@@ -78,9 +83,6 @@ class PermissionQueueController : public content::NotificationObserver {
void RegisterForInfoBarNotifications(InfoBarService* infobar_service); void RegisterForInfoBarNotifications(InfoBarService* infobar_service);
void UnregisterForInfoBarNotifications(InfoBarService* infobar_service); void UnregisterForInfoBarNotifications(InfoBarService* infobar_service);
void UpdateContentSetting(
const GURL& requesting_frame, const GURL& embedder, bool allowed);
content::NotificationRegistrar registrar_; content::NotificationRegistrar registrar_;
Profile* const profile_; Profile* const profile_;
......
...@@ -33,6 +33,7 @@ class GeolocationPermissionRequest : public PermissionBubbleRequest { ...@@ -33,6 +33,7 @@ class GeolocationPermissionRequest : public PermissionBubbleRequest {
GeolocationPermissionRequest(GeolocationPermissionContext* context, GeolocationPermissionRequest(GeolocationPermissionContext* context,
const PermissionRequestID& id, const PermissionRequestID& id,
const GURL& requesting_frame, const GURL& requesting_frame,
const GURL& embedder,
bool user_gesture, bool user_gesture,
base::Callback<void(bool)> callback, base::Callback<void(bool)> callback,
const std::string& display_languages); const std::string& display_languages);
...@@ -53,6 +54,7 @@ class GeolocationPermissionRequest : public PermissionBubbleRequest { ...@@ -53,6 +54,7 @@ class GeolocationPermissionRequest : public PermissionBubbleRequest {
GeolocationPermissionContext* context_; GeolocationPermissionContext* context_;
PermissionRequestID id_; PermissionRequestID id_;
GURL requesting_frame_; GURL requesting_frame_;
GURL embedder_;
bool user_gesture_; bool user_gesture_;
base::Callback<void(bool)> callback_; base::Callback<void(bool)> callback_;
std::string display_languages_; std::string display_languages_;
...@@ -62,12 +64,14 @@ GeolocationPermissionRequest::GeolocationPermissionRequest( ...@@ -62,12 +64,14 @@ GeolocationPermissionRequest::GeolocationPermissionRequest(
GeolocationPermissionContext* context, GeolocationPermissionContext* context,
const PermissionRequestID& id, const PermissionRequestID& id,
const GURL& requesting_frame, const GURL& requesting_frame,
const GURL& embedder,
bool user_gesture, bool user_gesture,
base::Callback<void(bool)> callback, base::Callback<void(bool)> callback,
const std::string& display_languages) const std::string& display_languages)
: context_(context), : context_(context),
id_(id), id_(id),
requesting_frame_(requesting_frame), requesting_frame_(requesting_frame),
embedder_(embedder),
user_gesture_(user_gesture), user_gesture_(user_gesture),
callback_(callback), callback_(callback),
display_languages_(display_languages) {} display_languages_(display_languages) {}
...@@ -100,10 +104,14 @@ GURL GeolocationPermissionRequest::GetRequestingHostname() const { ...@@ -100,10 +104,14 @@ GURL GeolocationPermissionRequest::GetRequestingHostname() const {
} }
void GeolocationPermissionRequest::PermissionGranted() { void GeolocationPermissionRequest::PermissionGranted() {
context_->QueueController()->UpdateContentSetting(
requesting_frame_, embedder_, true);
context_->NotifyPermissionSet(id_, requesting_frame_, callback_, true); context_->NotifyPermissionSet(id_, requesting_frame_, callback_, true);
} }
void GeolocationPermissionRequest::PermissionDenied() { void GeolocationPermissionRequest::PermissionDenied() {
context_->QueueController()->UpdateContentSetting(
requesting_frame_, embedder_, false);
context_->NotifyPermissionSet(id_, requesting_frame_, callback_, false); context_->NotifyPermissionSet(id_, requesting_frame_, callback_, false);
} }
...@@ -218,7 +226,7 @@ void GeolocationPermissionContext::DecidePermission( ...@@ -218,7 +226,7 @@ void GeolocationPermissionContext::DecidePermission(
if (mgr) { if (mgr) {
scoped_ptr<GeolocationPermissionRequest> request_ptr( scoped_ptr<GeolocationPermissionRequest> request_ptr(
new GeolocationPermissionRequest( new GeolocationPermissionRequest(
this, id, requesting_frame, user_gesture, callback, this, id, requesting_frame, embedder, user_gesture, callback,
profile_->GetPrefs()->GetString(prefs::kAcceptLanguages))); profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)));
GeolocationPermissionRequest* request = request_ptr.get(); GeolocationPermissionRequest* request = request_ptr.get();
pending_requests_.add(id.ToString(), request_ptr.Pass()); 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