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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 2915613004: [PointerLock] Move "silent mouse lock" logic from renderer to RWHI (Closed)
Patch Set: jochen's comment: Remove 'const' before local bool Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 int browser_plugin_instance_id, 931 int browser_plugin_instance_id,
932 int before, 932 int before,
933 int after) { 933 int after) {
934 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>( 934 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(
935 web_contents()->GetFocusedFrame()); 935 web_contents()->GetFocusedFrame());
936 if (rfh) 936 if (rfh)
937 rfh->GetFrameInputHandler()->ExtendSelectionAndDelete(before, after); 937 rfh->GetFrameInputHandler()->ExtendSelectionAndDelete(before, after);
938 } 938 }
939 939
940 void BrowserPluginGuest::OnLockMouse(bool user_gesture, 940 void BrowserPluginGuest::OnLockMouse(bool user_gesture,
941 bool last_unlocked_by_target,
942 bool privileged) { 941 bool privileged) {
943 if (pending_lock_request_) { 942 if (pending_lock_request_) {
944 // Immediately reject the lock because only one pointerLock may be active 943 // Immediately reject the lock because only one pointerLock may be active
945 // at a time. 944 // at a time.
946 Send(new ViewMsg_LockMouse_ACK(routing_id(), false)); 945 Send(new ViewMsg_LockMouse_ACK(routing_id(), false));
947 return; 946 return;
948 } 947 }
949 948
950 pending_lock_request_ = true; 949 pending_lock_request_ = true;
951 950
951 RenderWidgetHostImpl* owner = GetOwnerRenderWidgetHost();
952 bool is_last_unlocked_by_target =
953 owner ? owner->is_last_unlocked_by_target() : false;
954
952 delegate_->RequestPointerLockPermission( 955 delegate_->RequestPointerLockPermission(
953 user_gesture, 956 user_gesture, is_last_unlocked_by_target,
954 last_unlocked_by_target,
955 base::Bind(&BrowserPluginGuest::PointerLockPermissionResponse, 957 base::Bind(&BrowserPluginGuest::PointerLockPermissionResponse,
956 weak_ptr_factory_.GetWeakPtr())); 958 weak_ptr_factory_.GetWeakPtr()));
957 } 959 }
958 960
959 void BrowserPluginGuest::OnLockMouseAck(int browser_plugin_instance_id, 961 void BrowserPluginGuest::OnLockMouseAck(int browser_plugin_instance_id,
960 bool succeeded) { 962 bool succeeded) {
961 Send(new ViewMsg_LockMouse_ACK(routing_id(), succeeded)); 963 Send(new ViewMsg_LockMouse_ACK(routing_id(), succeeded));
962 pending_lock_request_ = false; 964 pending_lock_request_ = false;
963 if (succeeded) 965 if (succeeded)
964 mouse_locked_ = true; 966 mouse_locked_ = true;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 range, character_bounds); 1074 range, character_bounds);
1073 } 1075 }
1074 #endif 1076 #endif
1075 1077
1076 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { 1078 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) {
1077 if (delegate_) 1079 if (delegate_)
1078 delegate_->SetContextMenuPosition(position); 1080 delegate_->SetContextMenuPosition(position);
1079 } 1081 }
1080 1082
1081 } // namespace content 1083 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698