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

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

Issue 8295023: Move PPB/PPP_MouseLock out of dev/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and resolve conflicts. Created 9 years, 2 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 | « ppapi/cpp/mouse_lock.h ('k') | ppapi/examples/mouse_lock/mouse_lock.cc » ('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 "ppapi/cpp/dev/mouse_lock_dev.h" 5 #include "ppapi/cpp/mouse_lock.h"
6 6
7 #include "ppapi/c/dev/ppb_mouse_lock_dev.h" 7 #include "ppapi/c/ppb_mouse_lock.h"
8 #include "ppapi/c/dev/ppp_mouse_lock_dev.h" 8 #include "ppapi/c/ppp_mouse_lock.h"
9 #include "ppapi/cpp/completion_callback.h" 9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/instance.h" 10 #include "ppapi/cpp/instance.h"
11 #include "ppapi/cpp/module.h" 11 #include "ppapi/cpp/module.h"
12 #include "ppapi/cpp/module_impl.h" 12 #include "ppapi/cpp/module_impl.h"
13 13
14 namespace pp { 14 namespace pp {
15 15
16 namespace { 16 namespace {
17 17
18 static const char kPPPMouseLockInterface[] = PPP_MOUSELOCK_DEV_INTERFACE; 18 static const char kPPPMouseLockInterface[] = PPP_MOUSELOCK_INTERFACE;
19 19
20 void MouseLockLost(PP_Instance instance) { 20 void MouseLockLost(PP_Instance instance) {
21 void* object = 21 void* object =
22 pp::Instance::GetPerInstanceObject(instance, kPPPMouseLockInterface); 22 pp::Instance::GetPerInstanceObject(instance, kPPPMouseLockInterface);
23 if (!object) 23 if (!object)
24 return; 24 return;
25 static_cast<MouseLock_Dev*>(object)->MouseLockLost(); 25 static_cast<MouseLock*>(object)->MouseLockLost();
26 } 26 }
27 27
28 const PPP_MouseLock_Dev ppp_mouse_lock = { 28 const PPP_MouseLock ppp_mouse_lock = {
29 &MouseLockLost 29 &MouseLockLost
30 }; 30 };
31 31
32 template <> const char* interface_name<PPB_MouseLock_Dev>() { 32 template <> const char* interface_name<PPB_MouseLock>() {
33 return PPB_MOUSELOCK_DEV_INTERFACE; 33 return PPB_MOUSELOCK_INTERFACE;
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 MouseLock_Dev::MouseLock_Dev(Instance* instance) 38 MouseLock::MouseLock(Instance* instance)
39 : associated_instance_(instance) { 39 : associated_instance_(instance) {
40 pp::Module::Get()->AddPluginInterface(kPPPMouseLockInterface, 40 pp::Module::Get()->AddPluginInterface(kPPPMouseLockInterface,
41 &ppp_mouse_lock); 41 &ppp_mouse_lock);
42 associated_instance_->AddPerInstanceObject(kPPPMouseLockInterface, this); 42 associated_instance_->AddPerInstanceObject(kPPPMouseLockInterface, this);
43 } 43 }
44 44
45 MouseLock_Dev::~MouseLock_Dev() { 45 MouseLock::~MouseLock() {
46 associated_instance_->RemovePerInstanceObject(kPPPMouseLockInterface, this); 46 associated_instance_->RemovePerInstanceObject(kPPPMouseLockInterface, this);
47 } 47 }
48 48
49 int32_t MouseLock_Dev::LockMouse(const CompletionCallback& cc) { 49 int32_t MouseLock::LockMouse(const CompletionCallback& cc) {
50 if (!has_interface<PPB_MouseLock_Dev>()) 50 if (!has_interface<PPB_MouseLock>())
51 return cc.MayForce(PP_ERROR_NOINTERFACE); 51 return cc.MayForce(PP_ERROR_NOINTERFACE);
52 return get_interface<PPB_MouseLock_Dev>()->LockMouse( 52 return get_interface<PPB_MouseLock>()->LockMouse(
53 associated_instance_->pp_instance(), cc.pp_completion_callback()); 53 associated_instance_->pp_instance(), cc.pp_completion_callback());
54 } 54 }
55 55
56 void MouseLock_Dev::UnlockMouse() { 56 void MouseLock::UnlockMouse() {
57 if (has_interface<PPB_MouseLock_Dev>()) { 57 if (has_interface<PPB_MouseLock>()) {
58 get_interface<PPB_MouseLock_Dev>()->UnlockMouse( 58 get_interface<PPB_MouseLock>()->UnlockMouse(
59 associated_instance_->pp_instance()); 59 associated_instance_->pp_instance());
60 } 60 }
61 } 61 }
62 62
63 } // namespace pp 63 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/mouse_lock.h ('k') | ppapi/examples/mouse_lock/mouse_lock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698