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

Side by Side Diff: ppapi/proxy/ppb_url_loader_proxy.h

Issue 6334016: Refactor PPAPI proxy resource handling to maintain which host they came from,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | « ppapi/proxy/ppb_testing_proxy.cc ('k') | ppapi/proxy/ppb_url_loader_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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef PPAPI_PPB_URL_LOADER_PROXY_H_ 5 #ifndef PPAPI_PPB_URL_LOADER_PROXY_H_
6 #define PPAPI_PPB_URL_LOADER_PROXY_H_ 6 #define PPAPI_PPB_URL_LOADER_PROXY_H_
7 7
8 #include "ppapi/c/pp_completion_callback.h" 8 #include "ppapi/c/pp_completion_callback.h"
9 #include "ppapi/c/pp_instance.h" 9 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/c/pp_module.h" 10 #include "ppapi/c/pp_module.h"
11 #include "ppapi/c/pp_resource.h" 11 #include "ppapi/c/pp_resource.h"
12 #include "ppapi/c/pp_size.h" 12 #include "ppapi/c/pp_size.h"
13 #include "ppapi/c/pp_var.h" 13 #include "ppapi/c/pp_var.h"
14 #include "ppapi/cpp/completion_callback.h" 14 #include "ppapi/cpp/completion_callback.h"
15 #include "ppapi/proxy/host_resource.h"
15 #include "ppapi/proxy/interface_proxy.h" 16 #include "ppapi/proxy/interface_proxy.h"
16 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" 17 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
17 18
18 struct PPB_URLLoader; 19 struct PPB_URLLoader;
19 struct PPB_URLLoaderTrusted; 20 struct PPB_URLLoaderTrusted;
20 21
21 namespace pp { 22 namespace pp {
22 namespace proxy { 23 namespace proxy {
23 24
25 struct PPBURLLoader_UpdateProgress_Params;
26
24 class PPB_URLLoader_Proxy : public InterfaceProxy { 27 class PPB_URLLoader_Proxy : public InterfaceProxy {
25 public: 28 public:
26 PPB_URLLoader_Proxy(Dispatcher* dispatcher, const void* target_interface); 29 PPB_URLLoader_Proxy(Dispatcher* dispatcher, const void* target_interface);
27 virtual ~PPB_URLLoader_Proxy(); 30 virtual ~PPB_URLLoader_Proxy();
28 31
29 // URLLoader objects are normally allocated by the Create function, but 32 // URLLoader objects are normally allocated by the Create function, but
30 // they are also provided to PPP_Instance.OnMsgHandleDocumentLoad. This 33 // they are also provided to PPP_Instance.OnMsgHandleDocumentLoad. This
31 // function allows the proxy for DocumentLoad to create the correct plugin 34 // function allows the proxy for DocumentLoad to create the correct plugin
32 // proxied info for the given browser-supplied URLLoader resource ID. 35 // proxied info for the given browser-supplied URLLoader resource ID.
33 static void TrackPluginResource(PP_Instance instance, 36 static PP_Resource TrackPluginResource(
34 PP_Resource url_loader_resource); 37 const HostResource& url_loader_resource);
35 38
36 const PPB_URLLoader* ppb_url_loader_target() const { 39 const PPB_URLLoader* ppb_url_loader_target() const {
37 return reinterpret_cast<const PPB_URLLoader*>(target_interface()); 40 return reinterpret_cast<const PPB_URLLoader*>(target_interface());
38 } 41 }
39 42
40 // InterfaceProxy implementation. 43 // InterfaceProxy implementation.
41 virtual const void* GetSourceInterface() const; 44 virtual const void* GetSourceInterface() const;
42 virtual InterfaceID GetInterfaceId() const; 45 virtual InterfaceID GetInterfaceId() const;
43 virtual bool OnMessageReceived(const IPC::Message& msg); 46 virtual bool OnMessageReceived(const IPC::Message& msg);
44 47
45 private: 48 private:
46 // Data associated with callbacks for ReadResponseBody. 49 // Data associated with callbacks for ReadResponseBody.
47 struct ReadCallbackInfo; 50 struct ReadCallbackInfo;
48 51
49 // Plugin->renderer message handlers. 52 // Plugin->renderer message handlers.
50 void OnMsgCreate(PP_Instance instance, 53 void OnMsgCreate(PP_Instance instance,
51 PP_Resource* result); 54 HostResource* result);
52 void OnMsgOpen(PP_Resource loader, 55 void OnMsgOpen(const HostResource& loader,
53 PP_Resource request_info, 56 const HostResource& request_info,
54 uint32_t serialized_callback); 57 uint32_t serialized_callback);
55 void OnMsgFollowRedirect(PP_Resource loader, 58 void OnMsgFollowRedirect(const HostResource& loader,
56 uint32_t serialized_callback); 59 uint32_t serialized_callback);
57 void OnMsgGetResponseInfo(PP_Resource loader, 60 void OnMsgGetResponseInfo(const HostResource& loader,
58 PP_Resource* result); 61 HostResource* result);
59 void OnMsgReadResponseBody(PP_Resource loader, 62 void OnMsgReadResponseBody(const HostResource& loader,
60 int32_t bytes_to_read); 63 int32_t bytes_to_read);
61 void OnMsgFinishStreamingToFile(PP_Resource loader, 64 void OnMsgFinishStreamingToFile(const HostResource& loader,
62 uint32_t serialized_callback); 65 uint32_t serialized_callback);
63 void OnMsgClose(PP_Resource loader); 66 void OnMsgClose(const HostResource& loader);
64 67
65 // Renderer->plugin message handlers. 68 // Renderer->plugin message handlers.
66 void OnMsgUpdateProgress(PP_Resource resource, 69 void OnMsgUpdateProgress(
67 int64_t bytes_sent, 70 const PPBURLLoader_UpdateProgress_Params& params);
68 int64_t total_bytes_to_be_sent, 71 void OnMsgReadResponseBodyAck(const HostResource& pp_resource,
69 int64_t bytes_received,
70 int64_t total_bytes_to_be_received);
71 void OnMsgReadResponseBodyAck(PP_Resource pp_resource,
72 int32_t result, 72 int32_t result,
73 const std::string& data); 73 const std::string& data);
74 74
75 // Handles callbacks for read complete messages. Takes ownership of the info 75 // Handles callbacks for read complete messages. Takes ownership of the info
76 // pointer. 76 // pointer.
77 void OnReadCallback(int32_t result, ReadCallbackInfo* info); 77 void OnReadCallback(int32_t result, ReadCallbackInfo* info);
78 78
79 CompletionCallbackFactory<PPB_URLLoader_Proxy, 79 CompletionCallbackFactory<PPB_URLLoader_Proxy,
80 ProxyNonThreadSafeRefCount> callback_factory_; 80 ProxyNonThreadSafeRefCount> callback_factory_;
81 }; 81 };
82 82
83 class PPB_URLLoaderTrusted_Proxy : public InterfaceProxy { 83 class PPB_URLLoaderTrusted_Proxy : public InterfaceProxy {
84 public: 84 public:
85 PPB_URLLoaderTrusted_Proxy(Dispatcher* dispatcher, 85 PPB_URLLoaderTrusted_Proxy(Dispatcher* dispatcher,
86 const void* target_interface); 86 const void* target_interface);
87 virtual ~PPB_URLLoaderTrusted_Proxy(); 87 virtual ~PPB_URLLoaderTrusted_Proxy();
88 88
89 const PPB_URLLoaderTrusted* ppb_url_loader_trusted_target() const { 89 const PPB_URLLoaderTrusted* ppb_url_loader_trusted_target() const {
90 return reinterpret_cast<const PPB_URLLoaderTrusted*>(target_interface()); 90 return reinterpret_cast<const PPB_URLLoaderTrusted*>(target_interface());
91 } 91 }
92 92
93 // InterfaceProxy implementation. 93 // InterfaceProxy implementation.
94 virtual const void* GetSourceInterface() const; 94 virtual const void* GetSourceInterface() const;
95 virtual InterfaceID GetInterfaceId() const; 95 virtual InterfaceID GetInterfaceId() const;
96 virtual bool OnMessageReceived(const IPC::Message& msg); 96 virtual bool OnMessageReceived(const IPC::Message& msg);
97 97
98 private: 98 private:
99 // Plugin->renderer message handlers. 99 // Plugin->renderer message handlers.
100 void OnMsgGrantUniversalAccess(PP_Resource loader); 100 void OnMsgGrantUniversalAccess(const HostResource& loader);
101 }; 101 };
102 102
103 } // namespace proxy 103 } // namespace proxy
104 } // namespace pp 104 } // namespace pp
105 105
106 #endif // PPAPI_PPB_URL_LOADER_PROXY_H_ 106 #endif // PPAPI_PPB_URL_LOADER_PROXY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_testing_proxy.cc ('k') | ppapi/proxy/ppb_url_loader_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698