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

Side by Side Diff: ppapi/proxy/ppb_cursor_control_proxy.cc

Issue 8344025: Add a new globals object for PPAPI tracking information. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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/proxy/ppb_core_proxy.cc ('k') | ppapi/proxy/ppb_file_chooser_proxy.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/proxy/ppb_cursor_control_proxy.h" 5 #include "ppapi/proxy/ppb_cursor_control_proxy.h"
6 6
7 #include "ppapi/c/dev/pp_cursor_type_dev.h" 7 #include "ppapi/c/dev/pp_cursor_type_dev.h"
8 #include "ppapi/c/dev/ppb_cursor_control_dev.h" 8 #include "ppapi/c/dev/ppb_cursor_control_dev.h"
9 #include "ppapi/proxy/plugin_dispatcher.h" 9 #include "ppapi/proxy/plugin_dispatcher.h"
10 #include "ppapi/proxy/plugin_resource_tracker.h" 10 #include "ppapi/proxy/plugin_resource_tracker.h"
11 #include "ppapi/proxy/ppapi_messages.h" 11 #include "ppapi/proxy/ppapi_messages.h"
12 #include "ppapi/shared_impl/ppapi_globals.h"
12 #include "ppapi/thunk/enter.h" 13 #include "ppapi/thunk/enter.h"
13 #include "ppapi/thunk/thunk.h" 14 #include "ppapi/thunk/thunk.h"
14 15
15 using ppapi::thunk::EnterFunctionNoLock; 16 using ppapi::thunk::EnterFunctionNoLock;
16 using ppapi::thunk::PPB_CursorControl_FunctionAPI; 17 using ppapi::thunk::PPB_CursorControl_FunctionAPI;
17 18
18 namespace ppapi { 19 namespace ppapi {
19 namespace proxy { 20 namespace proxy {
20 21
21 PPB_CursorControl_Proxy::PPB_CursorControl_Proxy(Dispatcher* dispatcher) 22 PPB_CursorControl_Proxy::PPB_CursorControl_Proxy(Dispatcher* dispatcher)
22 : InterfaceProxy(dispatcher) { 23 : InterfaceProxy(dispatcher) {
23 } 24 }
24 25
25 PPB_CursorControl_Proxy::~PPB_CursorControl_Proxy() { 26 PPB_CursorControl_Proxy::~PPB_CursorControl_Proxy() {
26 } 27 }
27 28
28 ppapi::thunk::PPB_CursorControl_FunctionAPI* 29 ppapi::thunk::PPB_CursorControl_FunctionAPI*
29 PPB_CursorControl_Proxy::AsPPB_CursorControl_FunctionAPI() { 30 PPB_CursorControl_Proxy::AsPPB_CursorControl_FunctionAPI() {
30 return this; 31 return this;
31 } 32 }
32 33
33 PP_Bool PPB_CursorControl_Proxy::SetCursor(PP_Instance instance, 34 PP_Bool PPB_CursorControl_Proxy::SetCursor(PP_Instance instance,
34 PP_CursorType_Dev type, 35 PP_CursorType_Dev type,
35 PP_Resource custom_image_id, 36 PP_Resource custom_image_id,
36 const PP_Point* hot_spot) { 37 const PP_Point* hot_spot) {
37 // It's legal for the image ID to be null if the type is not custom. 38 // It's legal for the image ID to be null if the type is not custom.
38 HostResource cursor_image_resource; 39 HostResource cursor_image_resource;
39 if (type == PP_CURSORTYPE_CUSTOM) { 40 if (type == PP_CURSORTYPE_CUSTOM) {
40 Resource* cursor_image = PluginResourceTracker::GetInstance()-> 41 Resource* cursor_image =
41 GetResource(custom_image_id); 42 PpapiGlobals::Get()->GetResourceTracker()->GetResource(custom_image_id);
42 if (!cursor_image || cursor_image->pp_instance() != instance) 43 if (!cursor_image || cursor_image->pp_instance() != instance)
43 return PP_FALSE; 44 return PP_FALSE;
44 cursor_image_resource = cursor_image->host_resource(); 45 cursor_image_resource = cursor_image->host_resource();
45 } else { 46 } else {
46 if (custom_image_id) 47 if (custom_image_id)
47 return PP_FALSE; // Image specified for a predefined type. 48 return PP_FALSE; // Image specified for a predefined type.
48 } 49 }
49 50
50 PP_Bool result = PP_FALSE; 51 PP_Bool result = PP_FALSE;
51 PP_Point empty_point = { 0, 0 }; 52 PP_Point empty_point = { 0, 0 };
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 140
140 void PPB_CursorControl_Proxy::OnMsgCanLockCursor(PP_Instance instance, 141 void PPB_CursorControl_Proxy::OnMsgCanLockCursor(PP_Instance instance,
141 PP_Bool* result) { 142 PP_Bool* result) {
142 EnterFunctionNoLock<PPB_CursorControl_FunctionAPI> enter(instance, true); 143 EnterFunctionNoLock<PPB_CursorControl_FunctionAPI> enter(instance, true);
143 if (enter.succeeded()) 144 if (enter.succeeded())
144 *result = enter.functions()->CanLockCursor(instance); 145 *result = enter.functions()->CanLockCursor(instance);
145 } 146 }
146 147
147 } // namespace proxy 148 } // namespace proxy
148 } // namespace ppapi 149 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_core_proxy.cc ('k') | ppapi/proxy/ppb_file_chooser_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698