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