OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // From dev/ppb_url_util_dev.idl modified Wed Oct 16 11:11:48 2013. |
| 6 |
| 7 #include "ppapi/c/dev/ppb_url_util_dev.h" |
| 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/shared_impl/ppb_url_util_shared.h" |
| 10 #include "ppapi/shared_impl/tracked_callback.h" |
| 11 #include "ppapi/thunk/enter.h" |
| 12 #include "ppapi/thunk/ppb_instance_api.h" |
| 13 #include "ppapi/thunk/resource_creation_api.h" |
| 14 #include "ppapi/thunk/thunk.h" |
| 15 |
| 16 namespace ppapi { |
| 17 namespace thunk { |
| 18 |
| 19 namespace { |
| 20 |
| 21 struct PP_Var Canonicalize(struct PP_Var url, |
| 22 struct PP_URLComponents_Dev* components) { |
| 23 VLOG(4) << "PPB_URLUtil_Dev::Canonicalize()"; |
| 24 return PPB_URLUtil_Shared::Canonicalize(url, components); |
| 25 } |
| 26 |
| 27 struct PP_Var ResolveRelativeToURL(struct PP_Var base_url, |
| 28 struct PP_Var relative_string, |
| 29 struct PP_URLComponents_Dev* components) { |
| 30 VLOG(4) << "PPB_URLUtil_Dev::ResolveRelativeToURL()"; |
| 31 return PPB_URLUtil_Shared::ResolveRelativeToURL(base_url, |
| 32 relative_string, |
| 33 components); |
| 34 } |
| 35 |
| 36 struct PP_Var ResolveRelativeToDocument( |
| 37 PP_Instance instance, |
| 38 struct PP_Var relative_string, |
| 39 struct PP_URLComponents_Dev* components) { |
| 40 VLOG(4) << "PPB_URLUtil_Dev::ResolveRelativeToDocument()"; |
| 41 EnterInstance enter(instance); |
| 42 if (enter.failed()) |
| 43 return PP_MakeUndefined(); |
| 44 return enter.functions()->ResolveRelativeToDocument(instance, |
| 45 relative_string, |
| 46 components); |
| 47 } |
| 48 |
| 49 PP_Bool IsSameSecurityOrigin(struct PP_Var url_a, struct PP_Var url_b) { |
| 50 VLOG(4) << "PPB_URLUtil_Dev::IsSameSecurityOrigin()"; |
| 51 return PPB_URLUtil_Shared::IsSameSecurityOrigin(url_a, url_b); |
| 52 } |
| 53 |
| 54 PP_Bool DocumentCanRequest(PP_Instance instance, struct PP_Var url) { |
| 55 VLOG(4) << "PPB_URLUtil_Dev::DocumentCanRequest()"; |
| 56 EnterInstance enter(instance); |
| 57 if (enter.failed()) |
| 58 return PP_FALSE; |
| 59 return enter.functions()->DocumentCanRequest(instance, url); |
| 60 } |
| 61 |
| 62 PP_Bool DocumentCanAccessDocument(PP_Instance active, PP_Instance target) { |
| 63 VLOG(4) << "PPB_URLUtil_Dev::DocumentCanAccessDocument()"; |
| 64 EnterInstance enter(active); |
| 65 if (enter.failed()) |
| 66 return PP_FALSE; |
| 67 return enter.functions()->DocumentCanAccessDocument(active, target); |
| 68 } |
| 69 |
| 70 struct PP_Var GetDocumentURL(PP_Instance instance, |
| 71 struct PP_URLComponents_Dev* components) { |
| 72 VLOG(4) << "PPB_URLUtil_Dev::GetDocumentURL()"; |
| 73 EnterInstance enter(instance); |
| 74 if (enter.failed()) |
| 75 return PP_MakeUndefined(); |
| 76 return enter.functions()->GetDocumentURL(instance, components); |
| 77 } |
| 78 |
| 79 struct PP_Var GetPluginInstanceURL(PP_Instance instance, |
| 80 struct PP_URLComponents_Dev* components) { |
| 81 VLOG(4) << "PPB_URLUtil_Dev::GetPluginInstanceURL()"; |
| 82 EnterInstance enter(instance); |
| 83 if (enter.failed()) |
| 84 return PP_MakeUndefined(); |
| 85 return enter.functions()->GetPluginInstanceURL(instance, components); |
| 86 } |
| 87 |
| 88 struct PP_Var GetPluginReferrerURL(PP_Instance instance, |
| 89 struct PP_URLComponents_Dev* components) { |
| 90 VLOG(4) << "PPB_URLUtil_Dev::GetPluginReferrerURL()"; |
| 91 EnterInstance enter(instance); |
| 92 if (enter.failed()) |
| 93 return PP_MakeUndefined(); |
| 94 return enter.functions()->GetPluginReferrerURL(instance, components); |
| 95 } |
| 96 |
| 97 const PPB_URLUtil_Dev_0_6 g_ppb_urlutil_dev_thunk_0_6 = { |
| 98 &Canonicalize, |
| 99 &ResolveRelativeToURL, |
| 100 &ResolveRelativeToDocument, |
| 101 &IsSameSecurityOrigin, |
| 102 &DocumentCanRequest, |
| 103 &DocumentCanAccessDocument, |
| 104 &GetDocumentURL, |
| 105 &GetPluginInstanceURL |
| 106 }; |
| 107 |
| 108 const PPB_URLUtil_Dev_0_7 g_ppb_urlutil_dev_thunk_0_7 = { |
| 109 &Canonicalize, |
| 110 &ResolveRelativeToURL, |
| 111 &ResolveRelativeToDocument, |
| 112 &IsSameSecurityOrigin, |
| 113 &DocumentCanRequest, |
| 114 &DocumentCanAccessDocument, |
| 115 &GetDocumentURL, |
| 116 &GetPluginInstanceURL, |
| 117 &GetPluginReferrerURL |
| 118 }; |
| 119 |
| 120 } // namespace |
| 121 |
| 122 const PPB_URLUtil_Dev_0_6* GetPPB_URLUtil_Dev_0_6_Thunk() { |
| 123 return &g_ppb_urlutil_dev_thunk_0_6; |
| 124 } |
| 125 |
| 126 const PPB_URLUtil_Dev_0_7* GetPPB_URLUtil_Dev_0_7_Thunk() { |
| 127 return &g_ppb_urlutil_dev_thunk_0_7; |
| 128 } |
| 129 |
| 130 } // namespace thunk |
| 131 } // namespace ppapi |
OLD | NEW |