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

Side by Side Diff: ppapi/examples/mouse_lock/mouse_lock.cc

Issue 8970016: refactoring mouse lock to support pepper and WebKit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CONTENT_EXPORT Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | ppapi/examples/mouse_lock/mouse_lock.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <cmath> 5 #include <cmath>
6 #include <stdarg.h> 6 #include <stdarg.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "ppapi/c/dev/ppb_console_dev.h" 9 #include "ppapi/c/dev/ppb_console_dev.h"
10 #include "ppapi/c/ppb_input_event.h" 10 #include "ppapi/c/ppb_input_event.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 case PP_INPUTEVENT_TYPE_KEYDOWN: { 68 case PP_INPUTEVENT_TYPE_KEYDOWN: {
69 pp::KeyboardInputEvent key_event(event); 69 pp::KeyboardInputEvent key_event(event);
70 // Lock the mouse when the Enter key is pressed. 70 // Lock the mouse when the Enter key is pressed.
71 if (key_event.GetKeyCode() == 13) { 71 if (key_event.GetKeyCode() == 13) {
72 if (mouse_locked_) { 72 if (mouse_locked_) {
73 UnlockMouse(); 73 UnlockMouse();
74 } else { 74 } else {
75 LockMouse(callback_factory_.NewRequiredCallback( 75 LockMouse(callback_factory_.NewRequiredCallback(
76 &MyInstance::DidLockMouse)); 76 &MyInstance::DidLockMouse));
77 } 77 }
78 return true;
78 } 79 }
79 return true; 80 return false;
80 } 81 }
81 default: 82 default:
82 return false; 83 return false;
83 } 84 }
84 } 85 }
85 86
86 virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip) { 87 virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip) {
87 if (position.size().width() == width_ && 88 if (position.size().width() == width_ &&
88 position.size().height() == height_) 89 position.size().height() == height_)
89 return; // We don't care about the position, only the size. 90 return; // We don't care about the position, only the size.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 265
265 namespace pp { 266 namespace pp {
266 267
267 // Factory function for your specialization of the Module object. 268 // Factory function for your specialization of the Module object.
268 Module* CreateModule() { 269 Module* CreateModule() {
269 return new MyModule(); 270 return new MyModule();
270 } 271 }
271 272
272 } // namespace pp 273 } // namespace pp
273 274
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | ppapi/examples/mouse_lock/mouse_lock.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698