| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright 2010 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 // PPAPI-based implementation of the interface to call browser functionality. | 7 // PPAPI-based implementation of the interface to call browser functionality. |
| 8 | 8 |
| 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_BROWSER_INTERFACE_PPAPI_H_ | 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_BROWSER_INTERFACE_PPAPI_H_ |
| 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_BROWSER_INTERFACE_PPAPI_H_ | 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_BROWSER_INTERFACE_PPAPI_H_ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // Convert a string to an identifier. | 35 // Convert a string to an identifier. |
| 36 virtual uintptr_t StringToIdentifier(const nacl::string& str); | 36 virtual uintptr_t StringToIdentifier(const nacl::string& str); |
| 37 // Convert an identifier to a string. | 37 // Convert an identifier to a string. |
| 38 virtual nacl::string IdentifierToString(uintptr_t ident); | 38 virtual nacl::string IdentifierToString(uintptr_t ident); |
| 39 | 39 |
| 40 // Pops up an alert box. Returns false if that failed for any reason. | 40 // Pops up an alert box. Returns false if that failed for any reason. |
| 41 virtual bool Alert(InstanceIdentifier instance_id, | 41 virtual bool Alert(InstanceIdentifier instance_id, |
| 42 const nacl::string& text); | 42 const nacl::string& text); |
| 43 | 43 |
| 44 // Evaluate a JavaScript string in the browser. | 44 // Evaluate a JavaScript string in the browser. |
| 45 virtual bool EvalString(InstanceIdentifier plugin_identifier, | 45 virtual bool EvalString(InstanceIdentifier instance_id, |
| 46 const nacl::string& handler_string); | 46 const nacl::string& handler_string); |
| 47 | 47 |
| 48 // Write to the JavaScript console. |
| 49 virtual bool AddToConsole(InstanceIdentifier instance_id, |
| 50 const nacl::string& text); |
| 51 |
| 48 // Gets the full URL of the current page. | 52 // Gets the full URL of the current page. |
| 49 virtual bool GetFullURL(InstanceIdentifier instance_id, | 53 virtual bool GetFullURL(InstanceIdentifier instance_id, |
| 50 nacl::string* full_url); | 54 nacl::string* full_url); |
| 51 | 55 |
| 52 // Creates a browser scriptable handle for a given portable handle. | 56 // Creates a browser scriptable handle for a given portable handle. |
| 53 virtual ScriptableHandle* NewScriptableHandle(PortableHandle* handle); | 57 virtual ScriptableHandle* NewScriptableHandle(PortableHandle* handle); |
| 54 | 58 |
| 55 private: | 59 private: |
| 56 NACL_DISALLOW_COPY_AND_ASSIGN(BrowserInterfacePpapi); | 60 NACL_DISALLOW_COPY_AND_ASSIGN(BrowserInterfacePpapi); |
| 57 | 61 |
| 58 // Map strings used for property and method names to unique ids and back. | 62 // Map strings used for property and method names to unique ids and back. |
| 59 typedef std::map<nacl::string, uintptr_t> StringToIdentifierMap; | 63 typedef std::map<nacl::string, uintptr_t> StringToIdentifierMap; |
| 60 typedef std::map<uintptr_t, nacl::string> IdentifierToStringMap; | 64 typedef std::map<uintptr_t, nacl::string> IdentifierToStringMap; |
| 61 StringToIdentifierMap string_to_identifier_map_; | 65 StringToIdentifierMap string_to_identifier_map_; |
| 62 IdentifierToStringMap identifier_to_string_map_; | 66 IdentifierToStringMap identifier_to_string_map_; |
| 63 }; | 67 }; |
| 64 | 68 |
| 65 // Convert from the API-independent instance identifier to the PPAPI | 69 // Convert from the API-independent instance identifier to the PPAPI |
| 66 // PP_Instance. | 70 // PP_Instance. |
| 67 pp::Instance* InstanceIdentifierToPPInstance(InstanceIdentifier id); | 71 pp::Instance* InstanceIdentifierToPPInstance(InstanceIdentifier id); |
| 68 // Convert from the PPAPI PP_Instance type to the API-independent instance | 72 // Convert from the PPAPI PP_Instance type to the API-independent instance |
| 69 // identifier. | 73 // identifier. |
| 70 InstanceIdentifier PPInstanceToInstanceIdentifier(pp::Instance* instance); | 74 InstanceIdentifier PPInstanceToInstanceIdentifier(pp::Instance* instance); |
| 71 | 75 |
| 72 } // namespace plugin | 76 } // namespace plugin |
| 73 | 77 |
| 74 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_BROWSER_INTERFACE_PPAPI_H_ | 78 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PPAPI_BROWSER_INTERFACE_PPAPI_H_ |
| OLD | NEW |