| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/extension_process_bindings.h" | 5 #include "chrome/renderer/extensions/extension_process_bindings.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 } | 630 } |
| 631 | 631 |
| 632 // static | 632 // static |
| 633 void ExtensionProcessBindings::SetHostPermissions( | 633 void ExtensionProcessBindings::SetHostPermissions( |
| 634 const GURL& extension_url, | 634 const GURL& extension_url, |
| 635 const std::vector<URLPattern>& permissions) { | 635 const std::vector<URLPattern>& permissions) { |
| 636 for (size_t i = 0; i < permissions.size(); ++i) { | 636 for (size_t i = 0; i < permissions.size(); ++i) { |
| 637 const char* schemes[] = { | 637 const char* schemes[] = { |
| 638 chrome::kHttpScheme, | 638 chrome::kHttpScheme, |
| 639 chrome::kHttpsScheme, | 639 chrome::kHttpsScheme, |
| 640 chrome::kHttpsvScheme, |
| 640 chrome::kFileScheme, | 641 chrome::kFileScheme, |
| 641 chrome::kChromeUIScheme, | 642 chrome::kChromeUIScheme, |
| 642 }; | 643 }; |
| 643 for (size_t j = 0; j < arraysize(schemes); ++j) { | 644 for (size_t j = 0; j < arraysize(schemes); ++j) { |
| 644 if (permissions[i].MatchesScheme(schemes[j])) { | 645 if (permissions[i].MatchesScheme(schemes[j])) { |
| 645 WebSecurityPolicy::addOriginAccessWhitelistEntry( | 646 WebSecurityPolicy::addOriginAccessWhitelistEntry( |
| 646 extension_url, | 647 extension_url, |
| 647 WebKit::WebString::fromUTF8(schemes[j]), | 648 WebKit::WebString::fromUTF8(schemes[j]), |
| 648 WebKit::WebString::fromUTF8(permissions[i].host()), | 649 WebKit::WebString::fromUTF8(permissions[i].host()), |
| 649 permissions[i].match_subdomains()); | 650 permissions[i].match_subdomains()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 671 ExtensionProcessBindings::ThrowPermissionDeniedException( | 672 ExtensionProcessBindings::ThrowPermissionDeniedException( |
| 672 const std::string& function_name) { | 673 const std::string& function_name) { |
| 673 static const char kMessage[] = | 674 static const char kMessage[] = |
| 674 "You do not have permission to use '%s'. Be sure to declare" | 675 "You do not have permission to use '%s'. Be sure to declare" |
| 675 " in your manifest what permissions you need."; | 676 " in your manifest what permissions you need."; |
| 676 std::string error_msg = StringPrintf(kMessage, function_name.c_str()); | 677 std::string error_msg = StringPrintf(kMessage, function_name.c_str()); |
| 677 | 678 |
| 678 return v8::ThrowException(v8::Exception::Error( | 679 return v8::ThrowException(v8::Exception::Error( |
| 679 v8::String::New(error_msg.c_str()))); | 680 v8::String::New(error_msg.c_str()))); |
| 680 } | 681 } |
| OLD | NEW |