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

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

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