| OLD | NEW |
| 1 // Copyright (c) 2011 The Native Client 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 // This implements the required interfaces for representing a plugin module | 5 // This implements the required interfaces for representing a plugin module |
| 6 // instance in browser interactions and provides a way to register custom | 6 // instance in browser interactions and provides a way to register custom |
| 7 // plugin interfaces. | 7 // plugin interfaces. |
| 8 // | 8 // |
| 9 | 9 |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| 11 #include <string.h> | 11 #include <string.h> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 CHECK(PPBURLRequestInfo() != NULL); | 86 CHECK(PPBURLRequestInfo() != NULL); |
| 87 CHECK(PPBURLResponseInfo() != NULL); | 87 CHECK(PPBURLResponseInfo() != NULL); |
| 88 CHECK(PPBVar() != NULL); | 88 CHECK(PPBVar() != NULL); |
| 89 | 89 |
| 90 set_pp_instance(instance); | 90 set_pp_instance(instance); |
| 91 SetupTests(); | 91 SetupTests(); |
| 92 | 92 |
| 93 return PP_TRUE; | 93 return PP_TRUE; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void DidDestroyDefault(PP_Instance /*instance*/) { |
| 97 } |
| 98 |
| 99 void DidChangeViewDefault(PP_Instance /*instance*/, |
| 100 const struct PP_Rect* /*position*/, |
| 101 const struct PP_Rect* /*clip*/) { |
| 102 } |
| 103 |
| 104 void DidChangeFocusDefault(PP_Instance /*instance*/, |
| 105 PP_Bool /*has_focus*/) { |
| 106 } |
| 107 |
| 108 PP_Bool HandleDocumentLoadDefault(PP_Instance instance, |
| 109 PP_Resource url_loader) { |
| 110 return PP_TRUE; |
| 111 } |
| 112 |
| 96 namespace { | 113 namespace { |
| 97 | 114 |
| 98 void DidDestroy(PP_Instance /*instance*/) { | |
| 99 } | |
| 100 | |
| 101 void DidChangeView(PP_Instance /*instance*/, | |
| 102 const struct PP_Rect* /*position*/, | |
| 103 const struct PP_Rect* /*clip*/) { | |
| 104 } | |
| 105 | |
| 106 void DidChangeFocus(PP_Instance /*instance*/, | |
| 107 PP_Bool /*has_focus*/) { | |
| 108 } | |
| 109 | |
| 110 PP_Bool HandleDocumentLoad(PP_Instance instance, | |
| 111 PP_Resource url_loader) { | |
| 112 return PP_TRUE; | |
| 113 } | |
| 114 | |
| 115 const PPP_Instance ppp_instance_interface = { | 115 const PPP_Instance ppp_instance_interface = { |
| 116 DidCreateDefault, | 116 DidCreateDefault, |
| 117 DidDestroy, | 117 DidDestroyDefault, |
| 118 DidChangeView, | 118 DidChangeViewDefault, |
| 119 DidChangeFocus, | 119 DidChangeFocusDefault, |
| 120 HandleDocumentLoad | 120 HandleDocumentLoadDefault |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 /////////////////////////////////////////////////////////////////////////////// | 123 /////////////////////////////////////////////////////////////////////////////// |
| 124 // PPP_Messaging implementation | 124 // PPP_Messaging implementation |
| 125 /////////////////////////////////////////////////////////////////////////////// | 125 /////////////////////////////////////////////////////////////////////////////// |
| 126 | 126 |
| 127 void HandleMessage(PP_Instance instance, PP_Var message) { | 127 void HandleMessage(PP_Instance instance, PP_Var message) { |
| 128 if (message.type != PP_VARTYPE_STRING) | 128 if (message.type != PP_VARTYPE_STRING) |
| 129 return; | 129 return; |
| 130 uint32_t len = 0; | 130 uint32_t len = 0; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // so we supply our own. | 166 // so we supply our own. |
| 167 if (0 == strncmp(PPP_MESSAGING_INTERFACE, interface_name, | 167 if (0 == strncmp(PPP_MESSAGING_INTERFACE, interface_name, |
| 168 strlen(PPP_MESSAGING_INTERFACE))) { | 168 strlen(PPP_MESSAGING_INTERFACE))) { |
| 169 CHECK(ppp == NULL); | 169 CHECK(ppp == NULL); |
| 170 return &ppp_messaging_interface; | 170 return &ppp_messaging_interface; |
| 171 } | 171 } |
| 172 // All other interfaces are to be optionally supplied by the tester, | 172 // All other interfaces are to be optionally supplied by the tester, |
| 173 // so we return whatever was added in SetupPluginInterfaces() (if anything). | 173 // so we return whatever was added in SetupPluginInterfaces() (if anything). |
| 174 return ppp; | 174 return ppp; |
| 175 } | 175 } |
| OLD | NEW |