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

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

Issue 7844018: Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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_url_response_info_proxy.h ('k') | ppapi/proxy/ppb_url_util_proxy.h » ('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_url_response_info_proxy.h" 5 #include "ppapi/proxy/ppb_url_response_info_proxy.h"
6 6
7 #include "ppapi/c/ppb_url_response_info.h" 7 #include "ppapi/c/ppb_url_response_info.h"
8 #include "ppapi/proxy/enter_proxy.h" 8 #include "ppapi/proxy/enter_proxy.h"
9 #include "ppapi/proxy/host_dispatcher.h" 9 #include "ppapi/proxy/host_dispatcher.h"
10 #include "ppapi/proxy/plugin_dispatcher.h" 10 #include "ppapi/proxy/plugin_dispatcher.h"
11 #include "ppapi/proxy/ppapi_messages.h" 11 #include "ppapi/proxy/ppapi_messages.h"
12 #include "ppapi/proxy/ppb_file_ref_proxy.h" 12 #include "ppapi/proxy/ppb_file_ref_proxy.h"
13 #include "ppapi/proxy/serialized_var.h" 13 #include "ppapi/proxy/serialized_var.h"
14 #include "ppapi/shared_impl/resource.h" 14 #include "ppapi/shared_impl/resource.h"
15 #include "ppapi/thunk/ppb_url_response_info_api.h" 15 #include "ppapi/thunk/ppb_url_response_info_api.h"
16 #include "ppapi/thunk/thunk.h" 16 #include "ppapi/thunk/thunk.h"
17 17
18 using ppapi::thunk::PPB_URLResponseInfo_API; 18 using ppapi::thunk::PPB_URLResponseInfo_API;
19 19
20 namespace ppapi { 20 namespace ppapi {
21 namespace proxy { 21 namespace proxy {
22 22
23 namespace {
24
25 InterfaceProxy* CreateURLResponseInfoProxy(Dispatcher* dispatcher,
26 const void* target_interface) {
27 return new PPB_URLResponseInfo_Proxy(dispatcher, target_interface);
28 }
29
30 } // namespace
31
23 // URLResponseInfo ------------------------------------------------------------- 32 // URLResponseInfo -------------------------------------------------------------
24 33
25 class URLResponseInfo : public Resource, public PPB_URLResponseInfo_API { 34 class URLResponseInfo : public Resource, public PPB_URLResponseInfo_API {
26 public: 35 public:
27 URLResponseInfo(const HostResource& resource); 36 URLResponseInfo(const HostResource& resource);
28 virtual ~URLResponseInfo(); 37 virtual ~URLResponseInfo();
29 38
30 // Resource override. 39 // Resource override.
31 virtual PPB_URLResponseInfo_API* AsPPB_URLResponseInfo_API() OVERRIDE; 40 virtual PPB_URLResponseInfo_API* AsPPB_URLResponseInfo_API() OVERRIDE;
32 41
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // IPC here. 73 // IPC here.
65 PPB_FileRef_CreateInfo create_info; 74 PPB_FileRef_CreateInfo create_info;
66 PluginDispatcher::GetForResource(this)->Send( 75 PluginDispatcher::GetForResource(this)->Send(
67 new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef( 76 new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef(
68 INTERFACE_ID_PPB_URL_RESPONSE_INFO, host_resource(), &create_info)); 77 INTERFACE_ID_PPB_URL_RESPONSE_INFO, host_resource(), &create_info));
69 return PPB_FileRef_Proxy::DeserializeFileRef(create_info); 78 return PPB_FileRef_Proxy::DeserializeFileRef(create_info);
70 } 79 }
71 80
72 // PPB_URLResponseInfo_Proxy --------------------------------------------------- 81 // PPB_URLResponseInfo_Proxy ---------------------------------------------------
73 82
74 PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy(Dispatcher* dispatcher) 83 PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy(
75 : InterfaceProxy(dispatcher) { 84 Dispatcher* dispatcher,
85 const void* target_interface)
86 : InterfaceProxy(dispatcher, target_interface) {
76 } 87 }
77 88
78 PPB_URLResponseInfo_Proxy::~PPB_URLResponseInfo_Proxy() { 89 PPB_URLResponseInfo_Proxy::~PPB_URLResponseInfo_Proxy() {
79 } 90 }
80 91
81 // static 92 // static
93 const InterfaceProxy::Info* PPB_URLResponseInfo_Proxy::GetInfo() {
94 static const Info info = {
95 ppapi::thunk::GetPPB_URLResponseInfo_Thunk(),
96 PPB_URLRESPONSEINFO_INTERFACE,
97 INTERFACE_ID_PPB_URL_RESPONSE_INFO,
98 false,
99 &CreateURLResponseInfoProxy,
100 };
101 return &info;
102 }
103
104 // static
82 PP_Resource PPB_URLResponseInfo_Proxy::CreateResponseForResource( 105 PP_Resource PPB_URLResponseInfo_Proxy::CreateResponseForResource(
83 const HostResource& resource) { 106 const HostResource& resource) {
84 return (new URLResponseInfo(resource))->GetReference(); 107 return (new URLResponseInfo(resource))->GetReference();
85 } 108 }
86 109
87 bool PPB_URLResponseInfo_Proxy::OnMessageReceived(const IPC::Message& msg) { 110 bool PPB_URLResponseInfo_Proxy::OnMessageReceived(const IPC::Message& msg) {
88 bool handled = true; 111 bool handled = true;
89 IPC_BEGIN_MESSAGE_MAP(PPB_URLResponseInfo_Proxy, msg) 112 IPC_BEGIN_MESSAGE_MAP(PPB_URLResponseInfo_Proxy, msg)
90 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetProperty, 113 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetProperty,
91 OnMsgGetProperty) 114 OnMsgGetProperty)
(...skipping 20 matching lines...) Expand all
112 135
113 void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef( 136 void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef(
114 const HostResource& response, 137 const HostResource& response,
115 PPB_FileRef_CreateInfo* result) { 138 PPB_FileRef_CreateInfo* result) {
116 EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response); 139 EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response);
117 PP_Resource file_ref = 0; 140 PP_Resource file_ref = 0;
118 if (enter.succeeded()) 141 if (enter.succeeded())
119 file_ref = enter.object()->GetBodyAsFileRef(); 142 file_ref = enter.object()->GetBodyAsFileRef();
120 143
121 // Use the FileRef proxy to serialize. 144 // Use the FileRef proxy to serialize.
145 DCHECK(!dispatcher()->IsPlugin());
146 HostDispatcher* host_disp = static_cast<HostDispatcher*>(dispatcher());
122 PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>( 147 PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>(
123 dispatcher()->GetInterfaceProxy(INTERFACE_ID_PPB_FILE_REF)); 148 host_disp->GetOrCreatePPBInterfaceProxy(INTERFACE_ID_PPB_FILE_REF));
124 file_ref_proxy->SerializeFileRef(file_ref, result); 149 file_ref_proxy->SerializeFileRef(file_ref, result);
125 } 150 }
126 151
127 } // namespace proxy 152 } // namespace proxy
128 } // namespace ppapi 153 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_url_response_info_proxy.h ('k') | ppapi/proxy/ppb_url_util_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698