Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(996)

Side by Side Diff: chrome/browser/net/chrome_network_delegate.h

Issue 2401743003: Recommit and fix of "Added a ForceYouTubeRestrict policy and deprecated the old ForceYouTubeSafetyM… (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <string> 11 #include <string>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "chrome/browser/net/safe_search_util.h"
19 #include "components/data_use_measurement/content/data_use_measurement.h" 20 #include "components/data_use_measurement/content/data_use_measurement.h"
20 #include "components/metrics/data_use_tracker.h" 21 #include "components/metrics/data_use_tracker.h"
21 #include "components/prefs/pref_member.h" 22 #include "components/prefs/pref_member.h"
22 #include "net/base/network_delegate_impl.h" 23 #include "net/base/network_delegate_impl.h"
23 24
24 class ChromeExtensionsNetworkDelegate; 25 class ChromeExtensionsNetworkDelegate;
25 class PrefService; 26 class PrefService;
26 27
27 template<class T> class PrefMember; 28 template<class T> class PrefMember;
28 29
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 ~ChromeNetworkDelegate() override; 72 ~ChromeNetworkDelegate() override;
72 73
73 // Pass through to ChromeExtensionsNetworkDelegate::set_extension_info_map(). 74 // Pass through to ChromeExtensionsNetworkDelegate::set_extension_info_map().
74 void set_extension_info_map(extensions::InfoMap* extension_info_map); 75 void set_extension_info_map(extensions::InfoMap* extension_info_map);
75 76
76 void set_url_blacklist_manager( 77 void set_url_blacklist_manager(
77 const policy::URLBlacklistManager* url_blacklist_manager) { 78 const policy::URLBlacklistManager* url_blacklist_manager) {
78 url_blacklist_manager_ = url_blacklist_manager; 79 url_blacklist_manager_ = url_blacklist_manager;
79 } 80 }
80 81
81 // If |profile| is NULL or not set, events will be broadcast to all profiles, 82 // If |profile| is nullptr or not set, events will be broadcast to all
82 // otherwise they will only be sent to the specified profile. 83 // profiles, otherwise they will only be sent to the specified profile.
83 // Also pass through to ChromeExtensionsNetworkDelegate::set_profile(). 84 // Also pass through to ChromeExtensionsNetworkDelegate::set_profile().
84 void set_profile(void* profile); 85 void set_profile(void* profile);
85 86
86 // |profile_path| is used to locate the "Downloads" folder on Chrome OS. If it 87 // |profile_path| is used to locate the "Downloads" folder on Chrome OS. If it
87 // is set, the location of the Downloads folder for the profile is added to 88 // is set, the location of the Downloads folder for the profile is added to
88 // the whitelist for accesses via file: scheme. 89 // the whitelist for accesses via file: scheme.
89 void set_profile_path(const base::FilePath& profile_path) { 90 void set_profile_path(const base::FilePath& profile_path) {
90 profile_path_ = profile_path; 91 profile_path_ = profile_path;
91 } 92 }
92 93
93 // If |cookie_settings| is NULL or not set, all cookies are enabled, 94 // If |cookie_settings| is nullptr or not set, all cookies are enabled,
94 // otherwise the settings are enforced on all observed network requests. 95 // otherwise the settings are enforced on all observed network requests.
95 // Not inlined because we assign a scoped_refptr, which requires us to include 96 // Not inlined because we assign a scoped_refptr, which requires us to include
96 // the header file. Here we just forward-declare it. 97 // the header file. Here we just forward-declare it.
97 void set_cookie_settings(content_settings::CookieSettings* cookie_settings); 98 void set_cookie_settings(content_settings::CookieSettings* cookie_settings);
98 99
99 void set_enable_do_not_track(BooleanPrefMember* enable_do_not_track) { 100 void set_enable_do_not_track(BooleanPrefMember* enable_do_not_track) {
100 enable_do_not_track_ = enable_do_not_track; 101 enable_do_not_track_ = enable_do_not_track;
101 } 102 }
102 103
103 void set_force_google_safe_search( 104 void set_force_google_safe_search(
104 BooleanPrefMember* force_google_safe_search) { 105 BooleanPrefMember* force_google_safe_search) {
105 force_google_safe_search_ = force_google_safe_search; 106 force_google_safe_search_ = force_google_safe_search;
106 } 107 }
107 108
108 void set_force_youtube_safety_mode( 109 void set_force_youtube_restrict(
109 BooleanPrefMember* force_youtube_safety_mode) { 110 IntegerPrefMember* force_youtube_restrict) {
110 force_youtube_safety_mode_ = force_youtube_safety_mode; 111 force_youtube_restrict_ = force_youtube_restrict;
111 } 112 }
112 113
113 void set_allowed_domains_for_apps( 114 void set_allowed_domains_for_apps(
114 StringPrefMember* allowed_domains_for_apps) { 115 StringPrefMember* allowed_domains_for_apps) {
115 allowed_domains_for_apps_ = allowed_domains_for_apps; 116 allowed_domains_for_apps_ = allowed_domains_for_apps;
116 } 117 }
117 118
118 void set_domain_reliability_monitor( 119 void set_domain_reliability_monitor(
119 domain_reliability::DomainReliabilityMonitor* monitor) { 120 domain_reliability::DomainReliabilityMonitor* monitor) {
120 domain_reliability_monitor_ = monitor; 121 domain_reliability_monitor_ = monitor;
121 } 122 }
122 123
123 void set_data_use_aggregator( 124 void set_data_use_aggregator(
124 data_usage::DataUseAggregator* data_use_aggregator, 125 data_usage::DataUseAggregator* data_use_aggregator,
125 bool is_data_usage_off_the_record); 126 bool is_data_usage_off_the_record);
126 127
127 // Binds the pref members to |pref_service| and moves them to the IO thread. 128 // Binds the pref members to |pref_service| and moves them to the IO thread.
128 // |enable_referrers| cannot be NULL, the others can. 129 // |enable_referrers| cannot be nullptr, the others can.
129 // This method should be called on the UI thread. 130 // This method should be called on the UI thread.
130 static void InitializePrefsOnUIThread( 131 static void InitializePrefsOnUIThread(
131 BooleanPrefMember* enable_referrers, 132 BooleanPrefMember* enable_referrers,
132 BooleanPrefMember* enable_do_not_track, 133 BooleanPrefMember* enable_do_not_track,
133 BooleanPrefMember* force_google_safe_search, 134 BooleanPrefMember* force_google_safe_search,
134 BooleanPrefMember* force_youtube_safety_mode, 135 IntegerPrefMember* force_youtube_restrict,
135 StringPrefMember* allowed_domains_for_apps, 136 StringPrefMember* allowed_domains_for_apps,
136 PrefService* pref_service); 137 PrefService* pref_service);
137 138
138 // When called, all file:// URLs will now be accessible. If this is not 139 // When called, all file:// URLs will now be accessible. If this is not
139 // called, then some platforms restrict access to file:// paths. 140 // called, then some platforms restrict access to file:// paths.
140 static void AllowAccessToAllFiles(); 141 static void AllowAccessToAllFiles();
141 142
142 private: 143 private:
143 // NetworkDelegate implementation. 144 // NetworkDelegate implementation.
144 int OnBeforeURLRequest(net::URLRequest* request, 145 int OnBeforeURLRequest(net::URLRequest* request,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 std::unique_ptr<ChromeExtensionsNetworkDelegate> extensions_delegate_; 199 std::unique_ptr<ChromeExtensionsNetworkDelegate> extensions_delegate_;
199 200
200 void* profile_; 201 void* profile_;
201 base::FilePath profile_path_; 202 base::FilePath profile_path_;
202 scoped_refptr<content_settings::CookieSettings> cookie_settings_; 203 scoped_refptr<content_settings::CookieSettings> cookie_settings_;
203 204
204 // Weak, owned by our owner. 205 // Weak, owned by our owner.
205 BooleanPrefMember* enable_referrers_; 206 BooleanPrefMember* enable_referrers_;
206 BooleanPrefMember* enable_do_not_track_; 207 BooleanPrefMember* enable_do_not_track_;
207 BooleanPrefMember* force_google_safe_search_; 208 BooleanPrefMember* force_google_safe_search_;
208 BooleanPrefMember* force_youtube_safety_mode_; 209 IntegerPrefMember* force_youtube_restrict_;
209 StringPrefMember* allowed_domains_for_apps_; 210 StringPrefMember* allowed_domains_for_apps_;
210 211
211 // Weak, owned by our owner. 212 // Weak, owned by our owner.
212 const policy::URLBlacklistManager* url_blacklist_manager_; 213 const policy::URLBlacklistManager* url_blacklist_manager_;
213 domain_reliability::DomainReliabilityMonitor* domain_reliability_monitor_; 214 domain_reliability::DomainReliabilityMonitor* domain_reliability_monitor_;
214 215
215 // When true, allow access to all file:// URLs. 216 // When true, allow access to all file:// URLs.
216 static bool g_allow_file_access_; 217 static bool g_allow_file_access_;
217 218
218 // Component to measure data use. 219 // Component to measure data use.
219 data_use_measurement::DataUseMeasurement data_use_measurement_; 220 data_use_measurement::DataUseMeasurement data_use_measurement_;
220 221
221 bool experimental_web_platform_features_enabled_; 222 bool experimental_web_platform_features_enabled_;
222 223
223 // Aggregates and reports network usage. 224 // Aggregates and reports network usage.
224 data_usage::DataUseAggregator* data_use_aggregator_; 225 data_usage::DataUseAggregator* data_use_aggregator_;
225 // Controls whether network usage is reported as being off the record. 226 // Controls whether network usage is reported as being off the record.
226 bool is_data_usage_off_the_record_; 227 bool is_data_usage_off_the_record_;
227 228
228 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); 229 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate);
229 }; 230 };
230 231
231 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ 232 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698