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

Side by Side Diff: ppapi/proxy/ppb_file_ref_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_file_chooser_proxy.cc ('k') | ppapi/proxy/ppb_flash_file_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_file_ref_proxy.h" 5 #include "ppapi/proxy/ppb_file_ref_proxy.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_file_ref.h" 8 #include "ppapi/c/ppb_file_ref.h"
9 #include "ppapi/c/private/ppb_proxy_private.h" 9 #include "ppapi/c/private/ppb_proxy_private.h"
10 #include "ppapi/proxy/enter_proxy.h" 10 #include "ppapi/proxy/enter_proxy.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 int32_t FileRef::Delete(PP_CompletionCallback callback) { 83 int32_t FileRef::Delete(PP_CompletionCallback callback) {
84 GetDispatcher()->Send(new PpapiHostMsg_PPBFileRef_Delete( 84 GetDispatcher()->Send(new PpapiHostMsg_PPBFileRef_Delete(
85 INTERFACE_ID_PPB_FILE_REF, host_resource(), 85 INTERFACE_ID_PPB_FILE_REF, host_resource(),
86 GetDispatcher()->callback_tracker().SendCallback(callback))); 86 GetDispatcher()->callback_tracker().SendCallback(callback)));
87 return PP_OK_COMPLETIONPENDING; 87 return PP_OK_COMPLETIONPENDING;
88 } 88 }
89 89
90 int32_t FileRef::Rename(PP_Resource new_file_ref, 90 int32_t FileRef::Rename(PP_Resource new_file_ref,
91 PP_CompletionCallback callback) { 91 PP_CompletionCallback callback) {
92 Resource* new_file_ref_object = 92 Resource* new_file_ref_object =
93 PluginResourceTracker::GetInstance()->GetResource(new_file_ref); 93 PpapiGlobals::Get()->GetResourceTracker()->GetResource(new_file_ref);
94 if (!new_file_ref_object || 94 if (!new_file_ref_object ||
95 new_file_ref_object->host_resource().instance() != pp_instance()) 95 new_file_ref_object->host_resource().instance() != pp_instance())
96 return PP_ERROR_BADRESOURCE; 96 return PP_ERROR_BADRESOURCE;
97 97
98 GetDispatcher()->Send(new PpapiHostMsg_PPBFileRef_Rename( 98 GetDispatcher()->Send(new PpapiHostMsg_PPBFileRef_Rename(
99 INTERFACE_ID_PPB_FILE_REF, host_resource(), 99 INTERFACE_ID_PPB_FILE_REF, host_resource(),
100 new_file_ref_object->host_resource(), 100 new_file_ref_object->host_resource(),
101 GetDispatcher()->callback_tracker().SendCallback(callback))); 101 GetDispatcher()->callback_tracker().SendCallback(callback)));
102 return PP_OK_COMPLETIONPENDING; 102 return PP_OK_COMPLETIONPENDING;
103 } 103 }
104 104
105 PPB_FileRef_Proxy::PPB_FileRef_Proxy(Dispatcher* dispatcher) 105 PPB_FileRef_Proxy::PPB_FileRef_Proxy(Dispatcher* dispatcher)
106 : InterfaceProxy(dispatcher) { 106 : InterfaceProxy(dispatcher) {
107 } 107 }
108 108
109 PPB_FileRef_Proxy::~PPB_FileRef_Proxy() { 109 PPB_FileRef_Proxy::~PPB_FileRef_Proxy() {
110 } 110 }
111 111
112 // static 112 // static
113 PP_Resource PPB_FileRef_Proxy::CreateProxyResource(PP_Resource file_system, 113 PP_Resource PPB_FileRef_Proxy::CreateProxyResource(PP_Resource file_system,
114 const char* path) { 114 const char* path) {
115 Resource* file_system_object = 115 Resource* file_system_object =
116 PluginResourceTracker::GetInstance()->GetResource(file_system); 116 PpapiGlobals::Get()->GetResourceTracker()->GetResource(file_system);
117 if (!file_system_object) 117 if (!file_system_object)
118 return 0; 118 return 0;
119 119
120 PPB_FileRef_CreateInfo create_info; 120 PPB_FileRef_CreateInfo create_info;
121 PluginDispatcher::GetForResource(file_system_object)->Send( 121 PluginDispatcher::GetForResource(file_system_object)->Send(
122 new PpapiHostMsg_PPBFileRef_Create( 122 new PpapiHostMsg_PPBFileRef_Create(
123 INTERFACE_ID_PPB_FILE_REF, file_system_object->host_resource(), 123 INTERFACE_ID_PPB_FILE_REF, file_system_object->host_resource(),
124 path, &create_info)); 124 path, &create_info));
125 return PPB_FileRef_Proxy::DeserializeFileRef(create_info); 125 return PPB_FileRef_Proxy::DeserializeFileRef(create_info);
126 } 126 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 return; 219 return;
220 PP_CompletionCallback callback = ReceiveCallback(serialized_callback); 220 PP_CompletionCallback callback = ReceiveCallback(serialized_callback);
221 int32_t result = enter.object()->Rename(new_file_ref.host_resource(), 221 int32_t result = enter.object()->Rename(new_file_ref.host_resource(),
222 callback); 222 callback);
223 if (result != PP_OK_COMPLETIONPENDING) 223 if (result != PP_OK_COMPLETIONPENDING)
224 PP_RunCompletionCallback(&callback, result); 224 PP_RunCompletionCallback(&callback, result);
225 } 225 }
226 226
227 } // namespace proxy 227 } // namespace proxy
228 } // namespace ppapi 228 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_file_chooser_proxy.cc ('k') | ppapi/proxy/ppb_flash_file_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698