| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser/net/chrome_url_request_context.h" | 5 #include "chrome/browser/net/chrome_url_request_context.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 std::string ChromeURLRequestContext::GetDefaultLocaleForExtension( | 791 std::string ChromeURLRequestContext::GetDefaultLocaleForExtension( |
| 792 const std::string& id) { | 792 const std::string& id) { |
| 793 ExtensionInfoMap::iterator iter = extension_info_.find(id); | 793 ExtensionInfoMap::iterator iter = extension_info_.find(id); |
| 794 std::string result; | 794 std::string result; |
| 795 if (iter != extension_info_.end()) | 795 if (iter != extension_info_.end()) |
| 796 result = iter->second->default_locale; | 796 result = iter->second->default_locale; |
| 797 | 797 |
| 798 return result; | 798 return result; |
| 799 } | 799 } |
| 800 | 800 |
| 801 ExtensionExtent | |
| 802 ChromeURLRequestContext::GetEffectiveHostPermissionsForExtension( | |
| 803 const std::string& id) { | |
| 804 ExtensionInfoMap::iterator iter = extension_info_.find(id); | |
| 805 ExtensionExtent result; | |
| 806 if (iter != extension_info_.end()) | |
| 807 result = iter->second->effective_host_permissions; | |
| 808 | |
| 809 return result; | |
| 810 } | |
| 811 | |
| 812 bool ChromeURLRequestContext::CheckURLAccessToExtensionPermission( | 801 bool ChromeURLRequestContext::CheckURLAccessToExtensionPermission( |
| 813 const GURL& url, | 802 const GURL& url, |
| 814 const char* permission_name) { | 803 const char* permission_name) { |
| 815 ExtensionInfoMap::iterator info; | 804 ExtensionInfoMap::iterator info; |
| 816 if (url.SchemeIs(chrome::kExtensionScheme)) { | 805 if (url.SchemeIs(chrome::kExtensionScheme)) { |
| 817 // If the url is an extension scheme, we just look it up by extension id. | 806 // If the url is an extension scheme, we just look it up by extension id. |
| 818 std::string id = url.host(); | 807 std::string id = url.host(); |
| 819 info = extension_info_.find(id); | 808 info = extension_info_.find(id); |
| 820 } else { | 809 } else { |
| 821 // Otherwise, we scan for a matching extent. Overlapping extents are | 810 // Otherwise, we scan for a matching extent. Overlapping extents are |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 profile->GetExtensionsService()->extensions(); | 955 profile->GetExtensionsService()->extensions(); |
| 967 for (ExtensionList::const_iterator iter = extensions->begin(); | 956 for (ExtensionList::const_iterator iter = extensions->begin(); |
| 968 iter != extensions->end(); ++iter) { | 957 iter != extensions->end(); ++iter) { |
| 969 extension_info_[(*iter)->id()] = | 958 extension_info_[(*iter)->id()] = |
| 970 linked_ptr<ChromeURLRequestContext::ExtensionInfo>( | 959 linked_ptr<ChromeURLRequestContext::ExtensionInfo>( |
| 971 new ChromeURLRequestContext::ExtensionInfo( | 960 new ChromeURLRequestContext::ExtensionInfo( |
| 972 (*iter)->name(), | 961 (*iter)->name(), |
| 973 (*iter)->path(), | 962 (*iter)->path(), |
| 974 (*iter)->default_locale(), | 963 (*iter)->default_locale(), |
| 975 (*iter)->web_extent(), | 964 (*iter)->web_extent(), |
| 976 (*iter)->GetEffectiveHostPermissions(), | |
| 977 (*iter)->api_permissions())); | 965 (*iter)->api_permissions())); |
| 978 } | 966 } |
| 979 } | 967 } |
| 980 | 968 |
| 981 if (profile->GetUserScriptMaster()) | 969 if (profile->GetUserScriptMaster()) |
| 982 user_script_dir_path_ = profile->GetUserScriptMaster()->user_script_dir(); | 970 user_script_dir_path_ = profile->GetUserScriptMaster()->user_script_dir(); |
| 983 | 971 |
| 984 ssl_config_service_ = profile->GetSSLConfigService(); | 972 ssl_config_service_ = profile->GetSSLConfigService(); |
| 985 | 973 |
| 986 profile_dir_path_ = profile->GetPath(); | 974 profile_dir_path_ = profile->GetPath(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 prefs::kProxyAutoDetect)); | 1046 prefs::kProxyAutoDetect)); |
| 1059 | 1047 |
| 1060 if (pref_service->HasPrefPath(prefs::kProxyBypassList)) { | 1048 if (pref_service->HasPrefPath(prefs::kProxyBypassList)) { |
| 1061 std::string proxy_bypass = | 1049 std::string proxy_bypass = |
| 1062 pref_service->GetString(prefs::kProxyBypassList); | 1050 pref_service->GetString(prefs::kProxyBypassList); |
| 1063 proxy_config->proxy_rules().bypass_rules.ParseFromString(proxy_bypass); | 1051 proxy_config->proxy_rules().bypass_rules.ParseFromString(proxy_bypass); |
| 1064 } | 1052 } |
| 1065 | 1053 |
| 1066 return proxy_config; | 1054 return proxy_config; |
| 1067 } | 1055 } |
| OLD | NEW |