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