| 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 <numeric> | 7 #include <numeric> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "net/base/data_url.h" | 38 #include "net/base/data_url.h" |
| 39 #include "net/base/net_errors.h" | 39 #include "net/base/net_errors.h" |
| 40 #include "net/http/http_util.h" | 40 #include "net/http/http_util.h" |
| 41 #include "ppapi/c/pp_bool.h" | 41 #include "ppapi/c/pp_bool.h" |
| 42 #include "ppapi/c/private/pp_file_handle.h" | 42 #include "ppapi/c/private/pp_file_handle.h" |
| 43 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" | 43 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" |
| 44 #include "ppapi/shared_impl/ppapi_globals.h" | 44 #include "ppapi/shared_impl/ppapi_globals.h" |
| 45 #include "ppapi/shared_impl/ppapi_permissions.h" | 45 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 46 #include "ppapi/shared_impl/ppapi_preferences.h" | 46 #include "ppapi/shared_impl/ppapi_preferences.h" |
| 47 #include "ppapi/shared_impl/var.h" | 47 #include "ppapi/shared_impl/var.h" |
| 48 #include "ppapi/shared_impl/var_tracker.h" |
| 48 #include "ppapi/thunk/enter.h" | 49 #include "ppapi/thunk/enter.h" |
| 49 #include "third_party/WebKit/public/platform/WebURLLoader.h" | 50 #include "third_party/WebKit/public/platform/WebURLLoader.h" |
| 50 #include "third_party/WebKit/public/web/WebDocument.h" | 51 #include "third_party/WebKit/public/web/WebDocument.h" |
| 51 #include "third_party/WebKit/public/web/WebElement.h" | 52 #include "third_party/WebKit/public/web/WebElement.h" |
| 52 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 53 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 53 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 54 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 54 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 55 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| 55 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h" | 56 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h" |
| 56 #include "third_party/jsoncpp/source/include/json/reader.h" | 57 #include "third_party/jsoncpp/source/include/json/reader.h" |
| 57 #include "third_party/jsoncpp/source/include/json/value.h" | 58 #include "third_party/jsoncpp/source/include/json/value.h" |
| (...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 else if (cpu.has_ssse3()) attrs.push_back("+ssse3"); | 1226 else if (cpu.has_ssse3()) attrs.push_back("+ssse3"); |
| 1226 // TODO: SSE 3 | 1227 // TODO: SSE 3 |
| 1227 else if (cpu.has_sse2()) attrs.push_back("+sse2"); | 1228 else if (cpu.has_sse2()) attrs.push_back("+sse2"); |
| 1228 | 1229 |
| 1229 // TODO: AES, POPCNT, LZCNT, ... | 1230 // TODO: AES, POPCNT, LZCNT, ... |
| 1230 | 1231 |
| 1231 return ppapi::StringVar::StringToPPVar(std::accumulate( | 1232 return ppapi::StringVar::StringToPPVar(std::accumulate( |
| 1232 attrs.begin(), attrs.end(), std::string(), CommaAccumulator)); | 1233 attrs.begin(), attrs.end(), std::string(), CommaAccumulator)); |
| 1233 } | 1234 } |
| 1234 | 1235 |
| 1236 void PostMessageToJavaScriptMainThread(PP_Instance instance, |
| 1237 const std::string& message) { |
| 1238 content::PepperPluginInstance* plugin_instance = |
| 1239 content::PepperPluginInstance::Get(instance); |
| 1240 if (plugin_instance) { |
| 1241 PP_Var message_var = ppapi::StringVar::StringToPPVar(message); |
| 1242 plugin_instance->PostMessageToJavaScript(message_var); |
| 1243 ppapi::PpapiGlobals::Get()->GetVarTracker()->ReleaseVar(message_var); |
| 1244 } |
| 1245 } |
| 1246 |
| 1247 void PostMessageToJavaScript(PP_Instance instance, const char* message) { |
| 1248 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 1249 FROM_HERE, |
| 1250 base::Bind(&PostMessageToJavaScriptMainThread, |
| 1251 instance, |
| 1252 std::string(message))); |
| 1253 } |
| 1254 |
| 1235 const PPB_NaCl_Private nacl_interface = { | 1255 const PPB_NaCl_Private nacl_interface = { |
| 1236 &LaunchSelLdr, | 1256 &LaunchSelLdr, |
| 1237 &StartPpapiProxy, | 1257 &StartPpapiProxy, |
| 1238 &UrandomFD, | 1258 &UrandomFD, |
| 1239 &Are3DInterfacesDisabled, | 1259 &Are3DInterfacesDisabled, |
| 1240 &BrokerDuplicateHandle, | 1260 &BrokerDuplicateHandle, |
| 1241 &GetReadonlyPnaclFD, | 1261 &GetReadonlyPnaclFD, |
| 1242 &CreateTemporaryFile, | 1262 &CreateTemporaryFile, |
| 1243 &GetNumberOfProcessors, | 1263 &GetNumberOfProcessors, |
| 1244 &IsNonSFIModeEnabled, | 1264 &IsNonSFIModeEnabled, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1271 &GetManifestURLArgument, | 1291 &GetManifestURLArgument, |
| 1272 &IsPNaCl, | 1292 &IsPNaCl, |
| 1273 &DevInterfacesEnabled, | 1293 &DevInterfacesEnabled, |
| 1274 &DownloadManifestToBuffer, | 1294 &DownloadManifestToBuffer, |
| 1275 &CreatePNaClManifest, | 1295 &CreatePNaClManifest, |
| 1276 &CreateJsonManifest, | 1296 &CreateJsonManifest, |
| 1277 &DestroyManifest, | 1297 &DestroyManifest, |
| 1278 &ManifestGetProgramURL, | 1298 &ManifestGetProgramURL, |
| 1279 &ManifestResolveKey, | 1299 &ManifestResolveKey, |
| 1280 &GetPNaClResourceInfo, | 1300 &GetPNaClResourceInfo, |
| 1281 &GetCpuFeatureAttrs | 1301 &GetCpuFeatureAttrs, |
| 1302 &PostMessageToJavaScript |
| 1282 }; | 1303 }; |
| 1283 | 1304 |
| 1284 } // namespace | 1305 } // namespace |
| 1285 | 1306 |
| 1286 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1307 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1287 return &nacl_interface; | 1308 return &nacl_interface; |
| 1288 } | 1309 } |
| 1289 | 1310 |
| 1290 } // namespace nacl | 1311 } // namespace nacl |
| OLD | NEW |