OLD | NEW |
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 #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/dev/ppb_url_response_info_dev.h" | 7 #include "ppapi/c/dev/ppb_url_response_info_dev.h" |
8 #include "ppapi/proxy/plugin_dispatcher.h" | 8 #include "ppapi/proxy/plugin_dispatcher.h" |
9 #include "ppapi/proxy/plugin_resource.h" | 9 #include "ppapi/proxy/plugin_resource.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
11 #include "ppapi/proxy/serialized_var.h" | 11 #include "ppapi/proxy/serialized_var.h" |
12 | 12 |
13 namespace pp { | 13 namespace pp { |
14 namespace proxy { | 14 namespace proxy { |
15 | 15 |
16 class URLResponseInfo : public PluginResource { | 16 class URLResponseInfo : public PluginResource { |
17 public: | 17 public: |
18 URLResponseInfo() {} | 18 URLResponseInfo() {} |
19 virtual ~URLResponseInfo() {} | 19 virtual ~URLResponseInfo() {} |
20 | 20 |
21 // Resource overrides. | 21 // Resource overrides. |
22 virtual URLResponseInfo* AsURLResponseInfo() { return this; } | 22 virtual URLResponseInfo* AsURLResponseInfo() { return this; } |
23 | 23 |
24 private: | 24 private: |
25 DISALLOW_COPY_AND_ASSIGN(URLResponseInfo); | 25 DISALLOW_COPY_AND_ASSIGN(URLResponseInfo); |
26 }; | 26 }; |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 bool IsURLResponseInfo(PP_Resource resource) { | 30 PP_Bool IsURLResponseInfo(PP_Resource resource) { |
31 URLResponseInfo* object = PluginResource::GetAs<URLResponseInfo>(resource); | 31 URLResponseInfo* object = PluginResource::GetAs<URLResponseInfo>(resource); |
32 return !!object; | 32 return BoolToPPBool(!!object); |
33 } | 33 } |
34 | 34 |
35 PP_Var GetProperty(PP_Resource response, PP_URLResponseProperty_Dev property) { | 35 PP_Var GetProperty(PP_Resource response, PP_URLResponseProperty_Dev property) { |
36 Dispatcher* dispatcher = PluginDispatcher::Get(); | 36 Dispatcher* dispatcher = PluginDispatcher::Get(); |
37 ReceiveSerializedVarReturnValue result; | 37 ReceiveSerializedVarReturnValue result; |
38 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetProperty( | 38 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetProperty( |
39 INTERFACE_ID_PPB_URL_RESPONSE_INFO, response, property, &result)); | 39 INTERFACE_ID_PPB_URL_RESPONSE_INFO, response, property, &result)); |
40 return result.Return(dispatcher); | 40 return result.Return(dispatcher); |
41 } | 41 } |
42 | 42 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 response, static_cast<PP_URLResponseProperty_Dev>(property))); | 103 response, static_cast<PP_URLResponseProperty_Dev>(property))); |
104 } | 104 } |
105 | 105 |
106 void PPB_URLResponseInfo_Proxy::OnMsgGetBody(PP_Resource response, | 106 void PPB_URLResponseInfo_Proxy::OnMsgGetBody(PP_Resource response, |
107 PP_Resource* file_ref_result) { | 107 PP_Resource* file_ref_result) { |
108 *file_ref_result = ppb_url_response_info_target()->GetBody(response); | 108 *file_ref_result = ppb_url_response_info_target()->GetBody(response); |
109 } | 109 } |
110 | 110 |
111 } // namespace proxy | 111 } // namespace proxy |
112 } // namespace pp | 112 } // namespace pp |
OLD | NEW |