summaryrefslogtreecommitdiffstats
path: root/ppapi/examples
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-03 10:29:24 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-03 10:29:24 +0000
commit890545016b87381a5ed5db6e840735c9fd08106c (patch)
tree1c6b71cf7add01245ff0f3f3ef7487a45856bd2a /ppapi/examples
parentcb56392fa58db991fa609f04d37ee78a2f1f41fa (diff)
downloadchromium_src-890545016b87381a5ed5db6e840735c9fd08106c.zip
chromium_src-890545016b87381a5ed5db6e840735c9fd08106c.tar.gz
chromium_src-890545016b87381a5ed5db6e840735c9fd08106c.tar.bz2
Support mouse lock in Flash fullscreen mode.
In this mode, we won't show a bubble to ask for user permission. Mouse lock content settings are not considered, either. BUG=129241 TEST=1) run ppapi/examples/mouse_lock; 2) when one of the plugins is focused, press 'f' to enter Flash fullscreen; 3) left click to enter mouse lock. Review URL: https://chromiumcodereview.appspot.com/10458008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140231 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/examples')
-rw-r--r--ppapi/examples/mouse_lock/mouse_lock.cc15
-rw-r--r--ppapi/examples/mouse_lock/mouse_lock.html26
2 files changed, 25 insertions, 16 deletions
diff --git a/ppapi/examples/mouse_lock/mouse_lock.cc b/ppapi/examples/mouse_lock/mouse_lock.cc
index 7eec828..4203622 100644
--- a/ppapi/examples/mouse_lock/mouse_lock.cc
+++ b/ppapi/examples/mouse_lock/mouse_lock.cc
@@ -15,6 +15,7 @@
#include "ppapi/cpp/logging.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/mouse_lock.h"
+#include "ppapi/cpp/private/flash_fullscreen.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/var.h"
#include "ppapi/utility/completion_callback_factory.h"
@@ -30,7 +31,8 @@ class MyInstance : public pp::Instance, public pp::MouseLock {
pending_paint_(false),
waiting_for_flush_completion_(false),
callback_factory_(this),
- console_(NULL) {
+ console_(NULL),
+ flash_fullscreen_(this) {
}
virtual ~MyInstance() {}
@@ -66,13 +68,18 @@ class MyInstance : public pp::Instance, public pp::MouseLock {
}
case PP_INPUTEVENT_TYPE_KEYDOWN: {
pp::KeyboardInputEvent key_event(event);
- // Lock the mouse when the Enter key is pressed.
if (key_event.GetKeyCode() == 13) {
+ // Lock the mouse when the Enter key is pressed.
if (mouse_locked_)
UnlockMouse();
else
LockMouse(callback_factory_.NewCallback(&MyInstance::DidLockMouse));
return true;
+ } else if (key_event.GetKeyCode() == 70) {
+ // Enter Flash fullscreen mode when the 'f' key is pressed.
+ if (!flash_fullscreen_.IsFullscreen())
+ flash_fullscreen_.SetFullscreen(true);
+ return true;
}
return false;
}
@@ -199,7 +206,7 @@ class MyInstance : public pp::Instance, public pp::MouseLock {
(direction == UP && y < center_y) ||
(direction == DOWN && y > center_y) ||
(direction == LEFT && x < center_x) ||
- (direction == RIGHT && x > center_y);
+ (direction == RIGHT && x > center_x);
if (within_bound_1 && within_bound_2 && within_bound_3) {
*image.GetAddr32(pp::Point(x, y)) = foreground_color;
@@ -244,6 +251,8 @@ class MyInstance : public pp::Instance, public pp::MouseLock {
const PPB_Console_Dev* console_;
+ pp::FlashFullscreen flash_fullscreen_;
+
pp::Graphics2D device_context_;
};
diff --git a/ppapi/examples/mouse_lock/mouse_lock.html b/ppapi/examples/mouse_lock/mouse_lock.html
index 5f0e5aa..e06349c 100644
--- a/ppapi/examples/mouse_lock/mouse_lock.html
+++ b/ppapi/examples/mouse_lock/mouse_lock.html
@@ -17,18 +17,6 @@
<body title="This tooltip should not be shown if the mouse is locked.">
<div id="container">
<ul>
- <li>There are two different kinds of fullscreen mode - "tab fullscreen" and
- "browser fullscreen".
- <ul>
- <li>"tab fullscreen" refers to when a tab enters fullscreen mode via the
- JS or Pepper fullscreen API;</li>
- <li>"browser fullscreen" refers to the user putting the browser itself
- into fullscreen mode from the UI (e.g., pressing F11).</li>
- </ul>
- <span style="font-weight:bold">
- NOTE: Mouse lock is only allowed in "tab fullscreen" mode.
- </span>
- </li>
<li>Lock mouse:
<ul>
<li>left click in either of the two boxes; or</li>
@@ -46,7 +34,19 @@
<ul>
<li>lose focus; or</li>
<li>press Esc key; or</li>
- <li>exit from the "tab fullscreen" mode.</li>
+ <li>exit from "tab fullscreen"/"browser fullscreen"/"Flash fullscreen".
+ <ul>
+ <li>"tab fullscreen" refers to when a tab enters fullscreen mode via
+ the JS or Pepper fullscreen API;</li>
+ <li>"browser fullscreen" refers to the user putting the browser
+ itself into fullscreen mode from the UI (e.g., pressing F11).
+ </li>
+ <li>"Flash fullscreen" refers to the fullscreen mode used by Pepper
+ Flash. You could enter Flash fullscreen by pressing 'f' key
+ when either of the boxes is focused, and exit by pressing Esc
+ key.</li>
+ </ul>
+ </li>
</ul>
</li>
</ul>