| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 for (size_t i = 0; i < content_type.additional_param_names.size(); ++i) { | 579 for (size_t i = 0; i < content_type.additional_param_names.size(); ++i) { |
| 580 if (content_type.additional_param_names[i] == nacl_attr) | 580 if (content_type.additional_param_names[i] == nacl_attr) |
| 581 return GURL(content_type.additional_param_values[i]); | 581 return GURL(content_type.additional_param_values[i]); |
| 582 } | 582 } |
| 583 break; | 583 break; |
| 584 } | 584 } |
| 585 } | 585 } |
| 586 return GURL(); | 586 return GURL(); |
| 587 } | 587 } |
| 588 | 588 |
| 589 // TODO(dschuff): remove this when ARM ABI is stable |
| 590 #if defined(__arm__) && defined(OS_CHROMEOS) |
| 591 static bool IsWhiteListedARM(const GURL& url) { |
| 592 return |
| 593 // QuickOffice |
| 594 url.host() == "gbkeegbaiigmenfmjfclcdgdpimamgkj" || |
| 595 // ssh dev |
| 596 url.host() == "okddffdblfhhnmhodogpojmfkjmhinfp" || |
| 597 // ssh stable |
| 598 url.host() == "pnhechapfaindjhompbnflcldabbghjo"; |
| 599 } |
| 600 #endif |
| 601 |
| 589 // static | 602 // static |
| 590 bool ChromeContentRendererClient::IsNaClAllowed( | 603 bool ChromeContentRendererClient::IsNaClAllowed( |
| 591 const GURL& manifest_url, | 604 const GURL& manifest_url, |
| 592 const GURL& top_url, | 605 const GURL& top_url, |
| 593 bool is_nacl_unrestricted, | 606 bool is_nacl_unrestricted, |
| 594 bool is_extension_unrestricted, | 607 bool is_extension_unrestricted, |
| 595 bool is_extension_from_webstore, | 608 bool is_extension_from_webstore, |
| 596 WebPluginParams* params) { | 609 WebPluginParams* params) { |
| 597 // Temporarily allow these URLs to run NaCl apps. We should remove this | 610 // Temporarily allow these URLs to run NaCl apps. We should remove this |
| 598 // code when PNaCl ships. | 611 // code when PNaCl ships. |
| 599 bool is_whitelisted_url = | 612 bool is_whitelisted_url = |
| 600 ((top_url.SchemeIs("http") || top_url.SchemeIs("https")) && | 613 ((top_url.SchemeIs("http") || top_url.SchemeIs("https")) && |
| 601 (top_url.host() == "plus.google.com" || | 614 (top_url.host() == "plus.google.com" || |
| 602 top_url.host() == "plus.sandbox.google.com") && | 615 top_url.host() == "plus.sandbox.google.com") && |
| 603 top_url.path().find("/games") == 0); | 616 top_url.path().find("/games") == 0); |
| 604 | 617 |
| 605 // Allow Chrome Web Store extensions, built-in extensions, extensions | 618 // Allow Chrome Web Store extensions, built-in extensions, extensions |
| 606 // under development, invocations from whitelisted URLs, and all invocations | 619 // under development, invocations from whitelisted URLs, and all invocations |
| 607 // if --enable-nacl is set. | 620 // if --enable-nacl is set. |
| 608 bool is_nacl_allowed = | 621 bool is_nacl_allowed = |
| 609 #if defined(__arm__) | 622 #if defined(__arm__) && defined(OS_CHROMEOS) |
| 610 // The ARM ABI is not quite stable, so only allow NaCl for | 623 // The ARM ABI is not quite stable, so only allow NaCl for |
| 611 // unrestricted extensions (i.e. built-in and under development), | 624 // unrestricted extensions (i.e. built-in and under development), |
| 612 // and for the QuickOffice webstore app. | 625 // and for certain whitelisted webstore apps. |
| 613 // See http://crbug.com/145694 | 626 // See http://crbug.com/145694 |
| 614 // TODO(dschuff): remove this when the ABI is stable | 627 // TODO(dschuff): remove this when the ABI is stable |
| 615 (is_extension_from_webstore && | 628 (is_extension_from_webstore && |
| 616 manifest_url.SchemeIs("chrome-extension") && | 629 manifest_url.SchemeIs("chrome-extension") && |
| 617 manifest_url.host() == "gbkeegbaiigmenfmjfclcdgdpimamgkj") || | 630 IsWhiteListedARM(manifest_url) || |
| 618 #else | 631 #else |
| 619 is_extension_from_webstore || | 632 is_extension_from_webstore || |
| 620 is_whitelisted_url || | 633 is_whitelisted_url || |
| 621 #endif | 634 #endif |
| 622 is_extension_unrestricted || | 635 is_extension_unrestricted || |
| 623 is_nacl_unrestricted; | 636 is_nacl_unrestricted; |
| 624 if (is_nacl_allowed) { | 637 if (is_nacl_allowed) { |
| 625 bool app_can_use_dev_interfaces = | 638 bool app_can_use_dev_interfaces = |
| 626 // NaCl PDF viewer extension | 639 // NaCl PDF viewer extension |
| 627 (is_extension_from_webstore && | 640 (is_extension_from_webstore && |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { | 976 bool ChromeContentRendererClient::IsOtherExtensionWithWebRequestInstalled() { |
| 964 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); | 977 return extension_dispatcher_->IsOtherExtensionWithWebRequestInstalled(); |
| 965 } | 978 } |
| 966 | 979 |
| 967 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( | 980 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( |
| 968 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { | 981 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { |
| 969 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); | 982 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); |
| 970 } | 983 } |
| 971 | 984 |
| 972 } // namespace chrome | 985 } // namespace chrome |
| OLD | NEW |