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 #ifndef CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 6 #define CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include <map> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/file_path.h" | 13 #include "base/file_path.h" |
13 #include "base/linked_ptr.h" | 14 #include "base/linked_ptr.h" |
14 #include "net/base/cookie_monster.h" | 15 #include "net/base/cookie_monster.h" |
15 #include "net/base/cookie_policy.h" | 16 #include "net/base/cookie_policy.h" |
16 #include "chrome/browser/appcache/chrome_appcache_service.h" | 17 #include "chrome/browser/appcache/chrome_appcache_service.h" |
17 #include "chrome/browser/host_content_settings_map.h" | 18 #include "chrome/browser/host_content_settings_map.h" |
18 #include "chrome/browser/host_zoom_map.h" | 19 #include "chrome/browser/host_zoom_map.h" |
(...skipping 26 matching lines...) Expand all Loading... |
45 class ChromeURLRequestContext : public URLRequestContext { | 46 class ChromeURLRequestContext : public URLRequestContext { |
46 public: | 47 public: |
47 // Maintains some extension-related state we need on the IO thread. | 48 // Maintains some extension-related state we need on the IO thread. |
48 // TODO(aa): It would be cool if the Extension objects in ExtensionsService | 49 // TODO(aa): It would be cool if the Extension objects in ExtensionsService |
49 // could be immutable and ref-counted so that we could use them directly from | 50 // could be immutable and ref-counted so that we could use them directly from |
50 // both threads. There is only a small amount of mutable state in Extension. | 51 // both threads. There is only a small amount of mutable state in Extension. |
51 struct ExtensionInfo { | 52 struct ExtensionInfo { |
52 ExtensionInfo(const std::string& name, const FilePath& path, | 53 ExtensionInfo(const std::string& name, const FilePath& path, |
53 const std::string& default_locale, | 54 const std::string& default_locale, |
54 const ExtensionExtent& extent, | 55 const ExtensionExtent& extent, |
| 56 const ExtensionExtent& effective_host_permissions, |
55 const std::vector<std::string>& api_permissions) | 57 const std::vector<std::string>& api_permissions) |
56 : name(name), path(path), default_locale(default_locale), | 58 : name(name), path(path), default_locale(default_locale), |
57 extent(extent), api_permissions(api_permissions) { | 59 extent(extent), |
| 60 effective_host_permissions(effective_host_permissions), |
| 61 api_permissions(api_permissions) { |
58 } | 62 } |
59 const std::string name; | 63 const std::string name; |
60 FilePath path; | 64 const FilePath path; |
61 std::string default_locale; | 65 const std::string default_locale; |
62 ExtensionExtent extent; | 66 const ExtensionExtent extent; |
| 67 const ExtensionExtent effective_host_permissions; |
63 std::vector<std::string> api_permissions; | 68 std::vector<std::string> api_permissions; |
64 }; | 69 }; |
65 | 70 |
66 // Map of extension info by extension id. | 71 // Map of extension info by extension id. |
67 typedef std::map<std::string, linked_ptr<ExtensionInfo> > ExtensionInfoMap; | 72 typedef std::map<std::string, linked_ptr<ExtensionInfo> > ExtensionInfoMap; |
68 | 73 |
69 ChromeURLRequestContext(); | 74 ChromeURLRequestContext(); |
70 | 75 |
71 // Gets the name for the specified extension. | 76 // Gets the name for the specified extension. |
72 std::string GetNameForExtension(const std::string& id); | 77 std::string GetNameForExtension(const std::string& id); |
73 | 78 |
74 // Gets the path to the directory for the specified extension. | 79 // Gets the path to the directory for the specified extension. |
75 FilePath GetPathForExtension(const std::string& id); | 80 FilePath GetPathForExtension(const std::string& id); |
76 | 81 |
77 // Returns an empty string if the extension with |id| doesn't have a default | 82 // Returns an empty string if the extension with |id| doesn't have a default |
78 // locale. | 83 // locale. |
79 std::string GetDefaultLocaleForExtension(const std::string& id); | 84 std::string GetDefaultLocaleForExtension(const std::string& id); |
80 | 85 |
| 86 // Gets the effective host permissions for the extension with |id|. |
| 87 ExtensionExtent |
| 88 GetEffectiveHostPermissionsForExtension(const std::string& id); |
| 89 |
81 // Determine whether a URL has access to the specified extension permission. | 90 // Determine whether a URL has access to the specified extension permission. |
82 bool CheckURLAccessToExtensionPermission(const GURL& url, | 91 bool CheckURLAccessToExtensionPermission(const GURL& url, |
83 const char* permission_name); | 92 const char* permission_name); |
84 | 93 |
85 // Gets the path to the directory user scripts are stored in. | 94 // Gets the path to the directory user scripts are stored in. |
86 FilePath user_script_dir_path() const { | 95 FilePath user_script_dir_path() const { |
87 return user_script_dir_path_; | 96 return user_script_dir_path_; |
88 } | 97 } |
89 | 98 |
90 // Gets the appcache service to be used for requests in this context. | 99 // Gets the appcache service to be used for requests in this context. |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 406 |
398 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextFactory); | 407 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextFactory); |
399 }; | 408 }; |
400 | 409 |
401 // Creates a proxy configuration from proxy-related preferences fetched | 410 // Creates a proxy configuration from proxy-related preferences fetched |
402 // from |pref_service|. The relevant preferences in |pref_service| are | 411 // from |pref_service|. The relevant preferences in |pref_service| are |
403 // initialized from the process' command line or by applicable proxy policies. | 412 // initialized from the process' command line or by applicable proxy policies. |
404 net::ProxyConfig* CreateProxyConfig(const PrefService* pref_service); | 413 net::ProxyConfig* CreateProxyConfig(const PrefService* pref_service); |
405 | 414 |
406 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ | 415 #endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |