| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/renderer/ppb_nacl_private_impl.h" | 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "net/base/data_url.h" | 33 #include "net/base/data_url.h" |
| 34 #include "net/base/net_errors.h" | 34 #include "net/base/net_errors.h" |
| 35 #include "net/http/http_util.h" | 35 #include "net/http/http_util.h" |
| 36 #include "ppapi/c/pp_bool.h" | 36 #include "ppapi/c/pp_bool.h" |
| 37 #include "ppapi/c/private/pp_file_handle.h" | 37 #include "ppapi/c/private/pp_file_handle.h" |
| 38 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" | 38 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" |
| 39 #include "ppapi/shared_impl/ppapi_globals.h" | 39 #include "ppapi/shared_impl/ppapi_globals.h" |
| 40 #include "ppapi/shared_impl/ppapi_permissions.h" | 40 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 41 #include "ppapi/shared_impl/ppapi_preferences.h" | 41 #include "ppapi/shared_impl/ppapi_preferences.h" |
| 42 #include "ppapi/shared_impl/var.h" | 42 #include "ppapi/shared_impl/var.h" |
| 43 #include "ppapi/shared_impl/var_tracker.h" |
| 43 #include "ppapi/thunk/enter.h" | 44 #include "ppapi/thunk/enter.h" |
| 44 #include "third_party/WebKit/public/platform/WebURLLoader.h" | 45 #include "third_party/WebKit/public/platform/WebURLLoader.h" |
| 45 #include "third_party/WebKit/public/web/WebDocument.h" | 46 #include "third_party/WebKit/public/web/WebDocument.h" |
| 46 #include "third_party/WebKit/public/web/WebElement.h" | 47 #include "third_party/WebKit/public/web/WebElement.h" |
| 47 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 48 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 48 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 49 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 49 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 50 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| 50 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h" | 51 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h" |
| 51 #include "third_party/jsoncpp/source/include/json/reader.h" | 52 #include "third_party/jsoncpp/source/include/json/reader.h" |
| 52 #include "third_party/jsoncpp/source/include/json/value.h" | 53 #include "third_party/jsoncpp/source/include/json/value.h" |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 if (json_data.isMember("pnacl-ld-name")) { | 1171 if (json_data.isMember("pnacl-ld-name")) { |
| 1171 Json::Value json_name = json_data["pnacl-ld-name"]; | 1172 Json::Value json_name = json_data["pnacl-ld-name"]; |
| 1172 if (json_name.isString()) { | 1173 if (json_name.isString()) { |
| 1173 std::string ld_tool_name_str = json_name.asString(); | 1174 std::string ld_tool_name_str = json_name.asString(); |
| 1174 *ld_tool_name = ppapi::StringVar::StringToPPVar(ld_tool_name_str); | 1175 *ld_tool_name = ppapi::StringVar::StringToPPVar(ld_tool_name_str); |
| 1175 } | 1176 } |
| 1176 } | 1177 } |
| 1177 return PP_TRUE; | 1178 return PP_TRUE; |
| 1178 } | 1179 } |
| 1179 | 1180 |
| 1181 void PostMessageToJavaScriptMainThread(PP_Instance instance, |
| 1182 const std::string& message) { |
| 1183 content::PepperPluginInstance* plugin_instance = |
| 1184 content::PepperPluginInstance::Get(instance); |
| 1185 if (plugin_instance) { |
| 1186 PP_Var message_var = ppapi::StringVar::StringToPPVar(message); |
| 1187 plugin_instance->PostMessageToJavaScript(message_var); |
| 1188 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(message_var); |
| 1189 } |
| 1190 } |
| 1191 |
| 1192 void PostMessageToJavaScript(PP_Instance instance, const char* message) { |
| 1193 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 1194 FROM_HERE, |
| 1195 base::Bind(&PostMessageToJavaScriptMainThread, instance, message)); |
| 1196 } |
| 1197 |
| 1180 const PPB_NaCl_Private nacl_interface = { | 1198 const PPB_NaCl_Private nacl_interface = { |
| 1181 &LaunchSelLdr, | 1199 &LaunchSelLdr, |
| 1182 &StartPpapiProxy, | 1200 &StartPpapiProxy, |
| 1183 &UrandomFD, | 1201 &UrandomFD, |
| 1184 &Are3DInterfacesDisabled, | 1202 &Are3DInterfacesDisabled, |
| 1185 &BrokerDuplicateHandle, | 1203 &BrokerDuplicateHandle, |
| 1186 &GetReadonlyPnaclFD, | 1204 &GetReadonlyPnaclFD, |
| 1187 &CreateTemporaryFile, | 1205 &CreateTemporaryFile, |
| 1188 &GetNumberOfProcessors, | 1206 &GetNumberOfProcessors, |
| 1189 &IsNonSFIModeEnabled, | 1207 &IsNonSFIModeEnabled, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 &GetPNaClResourceInfo | 1243 &GetPNaClResourceInfo |
| 1226 }; | 1244 }; |
| 1227 | 1245 |
| 1228 } // namespace | 1246 } // namespace |
| 1229 | 1247 |
| 1230 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1248 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1231 return &nacl_interface; | 1249 return &nacl_interface; |
| 1232 } | 1250 } |
| 1233 | 1251 |
| 1234 } // namespace nacl | 1252 } // namespace nacl |
| OLD | NEW |