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

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

Issue 288113005: <webview>: Cleanup Pointer Lock & Simplify HandleKeyboardEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary braces Created 6 years, 7 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 4ad5382b9f447101404fd0991f5784658608f4fe..301fa0647581969a7533b58424880edcbb1a4f32 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -341,6 +341,13 @@ base::WeakPtr<BrowserPluginGuest> BrowserPluginGuest::AsWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
+bool BrowserPluginGuest::LockMouse(bool allowed) {
+ if (!attached() || (mouse_locked_ == allowed))
+ return false;
+
+ return embedder_web_contents()->GotResponseToLockMouseRequest(allowed);
+}
+
void BrowserPluginGuest::EmbedderDestroyed() {
embedder_web_contents_ = NULL;
if (delegate_)
@@ -655,26 +662,10 @@ bool BrowserPluginGuest::HandleContextMenu(const ContextMenuParams& params) {
void BrowserPluginGuest::HandleKeyboardEvent(
WebContents* source,
const NativeWebKeyboardEvent& event) {
- if (!attached())
- return;
-
- if (UnlockMouseIfNecessary(event))
- return;
-
- if (delegate_ && delegate_->HandleKeyboardEvent(event))
- return;
-
- if (!embedder_web_contents_->GetDelegate())
+ if (!delegate_)
return;
- // Send the unhandled keyboard events back to the embedder to reprocess them.
- // TODO(fsamuel): This introduces the possibility of out-of-order keyboard
- // events because the guest may be arbitrarily delayed when responding to
- // keyboard events. In that time, the embedder may have received and processed
- // additional key events. This needs to be fixed as soon as possible.
- // See http://crbug.com/229882.
- embedder_web_contents_->GetDelegate()->HandleKeyboardEvent(
- web_contents(), event);
+ delegate_->HandleKeyboardEvent(event);
}
void BrowserPluginGuest::SetZoom(double zoom_factor) {
@@ -823,15 +814,6 @@ void BrowserPluginGuest::RequestNewWindowPermission(
request_info);
}
-bool BrowserPluginGuest::UnlockMouseIfNecessary(
- const NativeWebKeyboardEvent& event) {
- if (!mouse_locked_)
- return false;
-
- embedder_web_contents()->GotResponseToLockMouseRequest(false);
- return true;
-}
-
void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) {
if (!attached()) {
// Some pages such as data URLs, javascript URLs, and about:blank
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698