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

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
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/interface_proxy.h" 15 #include "ppapi/proxy/interface_proxy.h"
16 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" 16 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
17 #include "ppapi/proxy/serialized_resource.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 PP_Instance instance,
38 SerializedResource url_loader_resource);
35 39
36 const PPB_URLLoader* ppb_url_loader_target() const { 40 const PPB_URLLoader* ppb_url_loader_target() const {
37 return reinterpret_cast<const PPB_URLLoader*>(target_interface()); 41 return reinterpret_cast<const PPB_URLLoader*>(target_interface());
38 } 42 }
39 43
40 // InterfaceProxy implementation. 44 // InterfaceProxy implementation.
41 virtual const void* GetSourceInterface() const; 45 virtual const void* GetSourceInterface() const;
42 virtual InterfaceID GetInterfaceId() const; 46 virtual InterfaceID GetInterfaceId() const;
43 virtual bool OnMessageReceived(const IPC::Message& msg); 47 virtual bool OnMessageReceived(const IPC::Message& msg);
44 48
45 private: 49 private:
46 // Data associated with callbacks for ReadResponseBody. 50 // Data associated with callbacks for ReadResponseBody.
47 struct ReadCallbackInfo; 51 struct ReadCallbackInfo;
48 52
49 // Plugin->renderer message handlers. 53 // Plugin->renderer message handlers.
50 void OnMsgCreate(PP_Instance instance, 54 void OnMsgCreate(PP_Instance instance,
51 PP_Resource* result); 55 SerializedResource* result);
52 void OnMsgOpen(PP_Resource loader, 56 void OnMsgOpen(SerializedResource loader,
53 PP_Resource request_info, 57 SerializedResource request_info,
54 uint32_t serialized_callback); 58 uint32_t serialized_callback);
55 void OnMsgFollowRedirect(PP_Resource loader, 59 void OnMsgFollowRedirect(SerializedResource loader,
56 uint32_t serialized_callback); 60 uint32_t serialized_callback);
57 void OnMsgGetResponseInfo(PP_Resource loader, 61 void OnMsgGetResponseInfo(SerializedResource loader,
58 PP_Resource* result); 62 SerializedResource* result);
59 void OnMsgReadResponseBody(PP_Resource loader, 63 void OnMsgReadResponseBody(PP_Instance instance,
64 SerializedResource loader,
60 int32_t bytes_to_read); 65 int32_t bytes_to_read);
61 void OnMsgFinishStreamingToFile(PP_Resource loader, 66 void OnMsgFinishStreamingToFile(SerializedResource loader,
62 uint32_t serialized_callback); 67 uint32_t serialized_callback);
63 void OnMsgClose(PP_Resource loader); 68 void OnMsgClose(SerializedResource loader);
64 69
65 // Renderer->plugin message handlers. 70 // Renderer->plugin message handlers.
66 void OnMsgUpdateProgress(PP_Resource resource, 71 void OnMsgUpdateProgress(
67 int64_t bytes_sent, 72 const PPBURLLoader_UpdateProgress_Params& params);
68 int64_t total_bytes_to_be_sent, 73 void OnMsgReadResponseBodyAck(PP_Instance instance,
69 int64_t bytes_received, 74 SerializedResource pp_resource,
70 int64_t total_bytes_to_be_received);
71 void OnMsgReadResponseBodyAck(PP_Resource pp_resource,
72 int32_t result, 75 int32_t result,
73 const std::string& data); 76 const std::string& data);
74 77
75 // Handles callbacks for read complete messages. Takes ownership of the info 78 // Handles callbacks for read complete messages. Takes ownership of the info
76 // pointer. 79 // pointer.
77 void OnReadCallback(int32_t result, ReadCallbackInfo* info); 80 void OnReadCallback(int32_t result, ReadCallbackInfo* info);
78 81
79 CompletionCallbackFactory<PPB_URLLoader_Proxy, 82 CompletionCallbackFactory<PPB_URLLoader_Proxy,
80 ProxyNonThreadSafeRefCount> callback_factory_; 83 ProxyNonThreadSafeRefCount> callback_factory_;
81 }; 84 };
82 85
83 class PPB_URLLoaderTrusted_Proxy : public InterfaceProxy { 86 class PPB_URLLoaderTrusted_Proxy : public InterfaceProxy {
84 public: 87 public:
85 PPB_URLLoaderTrusted_Proxy(Dispatcher* dispatcher, 88 PPB_URLLoaderTrusted_Proxy(Dispatcher* dispatcher,
86 const void* target_interface); 89 const void* target_interface);
87 virtual ~PPB_URLLoaderTrusted_Proxy(); 90 virtual ~PPB_URLLoaderTrusted_Proxy();
88 91
89 const PPB_URLLoaderTrusted* ppb_url_loader_trusted_target() const { 92 const PPB_URLLoaderTrusted* ppb_url_loader_trusted_target() const {
90 return reinterpret_cast<const PPB_URLLoaderTrusted*>(target_interface()); 93 return reinterpret_cast<const PPB_URLLoaderTrusted*>(target_interface());
91 } 94 }
92 95
93 // InterfaceProxy implementation. 96 // InterfaceProxy implementation.
94 virtual const void* GetSourceInterface() const; 97 virtual const void* GetSourceInterface() const;
95 virtual InterfaceID GetInterfaceId() const; 98 virtual InterfaceID GetInterfaceId() const;
96 virtual bool OnMessageReceived(const IPC::Message& msg); 99 virtual bool OnMessageReceived(const IPC::Message& msg);
97 100
98 private: 101 private:
99 // Plugin->renderer message handlers. 102 // Plugin->renderer message handlers.
100 void OnMsgGrantUniversalAccess(PP_Resource loader); 103 void OnMsgGrantUniversalAccess(SerializedResource loader);
101 }; 104 };
102 105
103 } // namespace proxy 106 } // namespace proxy
104 } // namespace pp 107 } // namespace pp
105 108
106 #endif // PPAPI_PPB_URL_LOADER_PROXY_H_ 109 #endif // PPAPI_PPB_URL_LOADER_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698