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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 239113007: <webview>: Move pointerLock permission to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_downloads_to_chrome
Patch Set: Created 6 years, 8 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
Index: content/browser/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index c397642e83fffa9f0cbf8f5a05874a3759cf521b..3ec1a0a5157e5db5692d7a3c3ff32d94d8fe77a1 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -140,24 +140,6 @@ class BrowserPluginGuest::JavaScriptDialogRequest : public PermissionRequest {
DialogClosedCallback callback_;
};
-class BrowserPluginGuest::PointerLockRequest : public PermissionRequest {
- public:
- explicit PointerLockRequest(const base::WeakPtr<BrowserPluginGuest>& guest)
- : PermissionRequest(guest) {
- RecordAction(
- base::UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.PointerLock"));
- }
-
- virtual void RespondImpl(bool should_allow,
- const std::string& user_input) OVERRIDE {
- guest_->SendMessageToEmbedder(
- new BrowserPluginMsg_SetMouseLock(guest_->instance_id(), should_allow));
- }
-
- private:
- virtual ~PointerLockRequest() {}
-};
-
namespace {
std::string WindowOpenDispositionToString(
WindowOpenDisposition window_open_disposition) {
@@ -731,6 +713,11 @@ void BrowserPluginGuest::SetZoom(double zoom_factor) {
delegate_->SetZoom(zoom_factor);
}
+void BrowserPluginGuest::PointerLockPermissionResponse(bool allow) {
+ SendMessageToEmbedder(
+ new BrowserPluginMsg_SetMouseLock(instance_id(), allow));
+}
+
void BrowserPluginGuest::FindReply(WebContents* contents,
int request_id,
int number_of_matches,
@@ -1285,19 +1272,17 @@ void BrowserPluginGuest::OnLockMouse(bool user_gesture,
Send(new ViewMsg_LockMouse_ACK(routing_id(), false));
return;
}
+
+ if (!delegate_)
+ return;
+
pending_lock_request_ = true;
- base::DictionaryValue request_info;
- request_info.Set(browser_plugin::kUserGesture,
- base::Value::CreateBooleanValue(user_gesture));
- request_info.Set(browser_plugin::kLastUnlockedBySelf,
- base::Value::CreateBooleanValue(last_unlocked_by_target));
- request_info.Set(browser_plugin::kURL,
- base::Value::CreateStringValue(
- web_contents()->GetLastCommittedURL().spec()));
- RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_POINTER_LOCK,
- new PointerLockRequest(weak_ptr_factory_.GetWeakPtr()),
- request_info);
+ delegate_->RequestPointerLockPermission(
+ user_gesture,
+ last_unlocked_by_target,
+ base::Bind(&BrowserPluginGuest::PointerLockPermissionResponse,
+ weak_ptr_factory_.GetWeakPtr()));
}
void BrowserPluginGuest::OnLockMouseAck(int instance_id, bool succeeded) {
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/common/browser_plugin/browser_plugin_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698