| 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 #ifndef CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 void set_url_blacklist_manager( | 70 void set_url_blacklist_manager( |
| 71 const policy::URLBlacklistManager* url_blacklist_manager) { | 71 const policy::URLBlacklistManager* url_blacklist_manager) { |
| 72 url_blacklist_manager_ = url_blacklist_manager; | 72 url_blacklist_manager_ = url_blacklist_manager; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // If |profile| is nullptr or not set, events will be broadcast to all | 75 // If |profile| is nullptr or not set, events will be broadcast to all |
| 76 // profiles, otherwise they will only be sent to the specified profile. | 76 // profiles, otherwise they will only be sent to the specified profile. |
| 77 // Also pass through to ChromeExtensionsNetworkDelegate::set_profile(). | 77 // Also pass through to ChromeExtensionsNetworkDelegate::set_profile(). |
| 78 void set_profile(void* profile); | 78 void set_profile(void* profile); |
| 79 | 79 |
| 80 // |profile_path| is used to locate the "Downloads" folder on Chrome OS. If it | 80 // |profile_path| is used to locate profile specific paths such as the |
| 81 // is set, the location of the Downloads folder for the profile is added to | 81 // "Downloads" folder on Chrome OS. If it is set, folders like Downloads |
| 82 // the whitelist for accesses via file: scheme. | 82 // for the profile are added to the whitelist for accesses via file: scheme. |
| 83 void set_profile_path(const base::FilePath& profile_path) { | 83 void set_profile_path(const base::FilePath& profile_path) { |
| 84 profile_path_ = profile_path; | 84 profile_path_ = profile_path; |
| 85 } | 85 } |
| 86 | 86 |
| 87 // If |cookie_settings| is nullptr or not set, all cookies are enabled, | 87 // If |cookie_settings| is nullptr or not set, all cookies are enabled, |
| 88 // otherwise the settings are enforced on all observed network requests. | 88 // otherwise the settings are enforced on all observed network requests. |
| 89 // Not inlined because we assign a scoped_refptr, which requires us to include | 89 // Not inlined because we assign a scoped_refptr, which requires us to include |
| 90 // the header file. Here we just forward-declare it. | 90 // the header file. Here we just forward-declare it. |
| 91 void set_cookie_settings(content_settings::CookieSettings* cookie_settings); | 91 void set_cookie_settings(content_settings::CookieSettings* cookie_settings); |
| 92 | 92 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 122 // |enable_referrers| cannot be nullptr, the others can. | 122 // |enable_referrers| cannot be nullptr, the others can. |
| 123 // This method should be called on the UI thread. | 123 // This method should be called on the UI thread. |
| 124 static void InitializePrefsOnUIThread( | 124 static void InitializePrefsOnUIThread( |
| 125 BooleanPrefMember* enable_referrers, | 125 BooleanPrefMember* enable_referrers, |
| 126 BooleanPrefMember* enable_do_not_track, | 126 BooleanPrefMember* enable_do_not_track, |
| 127 BooleanPrefMember* force_google_safe_search, | 127 BooleanPrefMember* force_google_safe_search, |
| 128 IntegerPrefMember* force_youtube_restrict, | 128 IntegerPrefMember* force_youtube_restrict, |
| 129 StringPrefMember* allowed_domains_for_apps, | 129 StringPrefMember* allowed_domains_for_apps, |
| 130 PrefService* pref_service); | 130 PrefService* pref_service); |
| 131 | 131 |
| 132 // Returns true if access to |path| is allowed. |profile_path| is used to |
| 133 // locate certain paths on Chrome OS. See set_profile_path() for details. |
| 134 static bool IsAccessAllowed(const base::FilePath& path, |
| 135 const base::FilePath& profile_path); |
| 136 |
| 132 private: | 137 private: |
| 133 // NetworkDelegate implementation. | 138 // NetworkDelegate implementation. |
| 134 int OnBeforeURLRequest(net::URLRequest* request, | 139 int OnBeforeURLRequest(net::URLRequest* request, |
| 135 const net::CompletionCallback& callback, | 140 const net::CompletionCallback& callback, |
| 136 GURL* new_url) override; | 141 GURL* new_url) override; |
| 137 int OnBeforeStartTransaction(net::URLRequest* request, | 142 int OnBeforeStartTransaction(net::URLRequest* request, |
| 138 const net::CompletionCallback& callback, | 143 const net::CompletionCallback& callback, |
| 139 net::HttpRequestHeaders* headers) override; | 144 net::HttpRequestHeaders* headers) override; |
| 140 void OnStartTransaction(net::URLRequest* request, | 145 void OnStartTransaction(net::URLRequest* request, |
| 141 const net::HttpRequestHeaders& headers) override; | 146 const net::HttpRequestHeaders& headers) override; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 212 |
| 208 // Aggregates and reports network usage. | 213 // Aggregates and reports network usage. |
| 209 data_usage::DataUseAggregator* data_use_aggregator_; | 214 data_usage::DataUseAggregator* data_use_aggregator_; |
| 210 // Controls whether network usage is reported as being off the record. | 215 // Controls whether network usage is reported as being off the record. |
| 211 bool is_data_usage_off_the_record_; | 216 bool is_data_usage_off_the_record_; |
| 212 | 217 |
| 213 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 218 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
| 214 }; | 219 }; |
| 215 | 220 |
| 216 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 221 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| OLD | NEW |