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

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

Issue 11186002: Add a SafeSearch preference, policy and implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased with the latest tree version Created 8 years, 1 month 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 | Annotate | Revision Log
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 <string>
9
8 #include "base/basictypes.h" 10 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
11 #include "base/values.h" 13 #include "base/values.h"
12 #include "net/base/network_delegate.h" 14 #include "net/base/network_delegate.h"
13 15
14 class CookieSettings; 16 class CookieSettings;
15 class ExtensionInfoMap; 17 class ExtensionInfoMap;
16 class ManagedModeURLFilter; 18 class ManagedModeURLFilter;
17 class PrefService; 19 class PrefService;
18 template<class T> class PrefMember; 20 template<class T> class PrefMember;
19 21
20 typedef PrefMember<bool> BooleanPrefMember; 22 typedef PrefMember<bool> BooleanPrefMember;
21 23
22 namespace base { 24 namespace base {
23 class Value; 25 class Value;
24 } 26 }
25 27
26 namespace chrome_browser_net { 28 namespace chrome_browser_net {
27 class LoadTimeStats; 29 class LoadTimeStats;
28 } 30 }
29 31
30 namespace extensions { 32 namespace extensions {
31 class EventRouterForwarder; 33 class EventRouterForwarder;
32 } 34 }
33 35
36 namespace net {
37 class URLRequest;
38 }
39
34 namespace policy { 40 namespace policy {
35 class URLBlacklistManager; 41 class URLBlacklistManager;
36 } 42 }
37 43
38 // ChromeNetworkDelegate is the central point from within the chrome code to 44 // ChromeNetworkDelegate is the central point from within the chrome code to
39 // add hooks into the network stack. 45 // add hooks into the network stack.
40 class ChromeNetworkDelegate : public net::NetworkDelegate { 46 class ChromeNetworkDelegate : public net::NetworkDelegate {
41 public: 47 public:
42 // If |profile| is NULL, events will be broadcasted to all profiles, 48 // If |profile| is NULL, events will be broadcasted to all profiles,
43 // otherwise they will only be sent to the specified profile. 49 // otherwise they will only be sent to the specified profile.
44 // |enable_referrers| and |enable_do_not_track| should be initialized on the 50 // |enable_referrers| and |enable_do_not_track| should be initialized on the
45 // UI thread (see below) beforehand. This object's owner is responsible for 51 // UI thread (see below) beforehand. This object's owner is responsible for
46 // cleaning it up at shutdown. |enable_do_not_track| can be NULL. 52 // cleaning it up at shutdown. |enable_do_not_track| can be NULL.
47 // If |cookie_settings| is NULL, all cookies are enabled, otherwise, the 53 // If |cookie_settings| is NULL, all cookies are enabled, otherwise, the
48 // settings are enforced on all observed network requests. 54 // settings are enforced on all observed network requests.
49 ChromeNetworkDelegate( 55 ChromeNetworkDelegate(
50 extensions::EventRouterForwarder* event_router, 56 extensions::EventRouterForwarder* event_router,
51 ExtensionInfoMap* extension_info_map, 57 ExtensionInfoMap* extension_info_map,
52 const policy::URLBlacklistManager* url_blacklist_manager, 58 const policy::URLBlacklistManager* url_blacklist_manager,
53 const ManagedModeURLFilter* managed_mode_url_filter, 59 const ManagedModeURLFilter* managed_mode_url_filter,
54 void* profile, 60 void* profile,
55 CookieSettings* cookie_settings, 61 CookieSettings* cookie_settings,
56 BooleanPrefMember* enable_referrers, 62 BooleanPrefMember* enable_referrers,
57 BooleanPrefMember* enable_do_not_track, 63 BooleanPrefMember* enable_do_not_track,
64 BooleanPrefMember* force_google_safe_search,
58 chrome_browser_net::LoadTimeStats* load_time_stats); 65 chrome_browser_net::LoadTimeStats* load_time_stats);
59 virtual ~ChromeNetworkDelegate(); 66 virtual ~ChromeNetworkDelegate();
60 67
61 // Causes |OnCanThrottleRequest| to always return false, for all 68 // Causes |OnCanThrottleRequest| to always return false, for all
62 // instances of this object. 69 // instances of this object.
63 static void NeverThrottleRequests(); 70 static void NeverThrottleRequests();
64 71
65 // Binds the pref members to |pref_service| and moves them to the IO thread. 72 // Binds the pref members to |pref_service| and moves them to the IO thread.
66 // |enable_do_not_track| can be NULL. 73 // |enable_do_not_track| can be NULL.
67 // This method should be called on the UI thread. 74 // This method should be called on the UI thread.
68 static void InitializePrefsOnUIThread(BooleanPrefMember* enable_referrers, 75 static void InitializePrefsOnUIThread(
69 BooleanPrefMember* enable_do_not_track, 76 BooleanPrefMember* enable_referrers,
70 PrefService* pref_service); 77 BooleanPrefMember* enable_do_not_track,
78 BooleanPrefMember* force_google_safe_search,
79 PrefService* pref_service);
71 80
72 // When called, all file:// URLs will now be accessible. If this is not 81 // When called, all file:// URLs will now be accessible. If this is not
73 // called, then some platforms restrict access to file:// paths. 82 // called, then some platforms restrict access to file:// paths.
74 static void AllowAccessToAllFiles(); 83 static void AllowAccessToAllFiles();
75 84
76 // Creates a Value summary of the persistent state of the network session. 85 // Creates a Value summary of the persistent state of the network session.
77 // The caller is responsible for deleting the returned value. 86 // The caller is responsible for deleting the returned value.
78 // Must be called on the UI thread. 87 // Must be called on the UI thread.
79 static Value* HistoricNetworkStatsInfoToValue(); 88 static Value* HistoricNetworkStatsInfoToValue();
80 89
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 143
135 scoped_refptr<extensions::EventRouterForwarder> event_router_; 144 scoped_refptr<extensions::EventRouterForwarder> event_router_;
136 void* profile_; 145 void* profile_;
137 scoped_refptr<CookieSettings> cookie_settings_; 146 scoped_refptr<CookieSettings> cookie_settings_;
138 147
139 scoped_refptr<ExtensionInfoMap> extension_info_map_; 148 scoped_refptr<ExtensionInfoMap> extension_info_map_;
140 149
141 // Weak, owned by our owner. 150 // Weak, owned by our owner.
142 BooleanPrefMember* enable_referrers_; 151 BooleanPrefMember* enable_referrers_;
143 BooleanPrefMember* enable_do_not_track_; 152 BooleanPrefMember* enable_do_not_track_;
153 BooleanPrefMember* force_google_safe_search_;
144 154
145 // Weak, owned by our owner. 155 // Weak, owned by our owner.
146 const policy::URLBlacklistManager* url_blacklist_manager_; 156 const policy::URLBlacklistManager* url_blacklist_manager_;
147 157
148 // Weak pointer. The owner of this object needs to make sure that the 158 // Weak pointer. The owner of this object needs to make sure that the
149 // |managed_mode_url_filter_| outlives it. 159 // |managed_mode_url_filter_| outlives it.
150 const ManagedModeURLFilter* managed_mode_url_filter_; 160 const ManagedModeURLFilter* managed_mode_url_filter_;
151 161
152 // When true, allow access to all file:// URLs. 162 // When true, allow access to all file:// URLs.
153 static bool g_allow_file_access_; 163 static bool g_allow_file_access_;
(...skipping 13 matching lines...) Expand all
167 // over the network. 177 // over the network.
168 int64 received_content_length_; 178 int64 received_content_length_;
169 179
170 // Total original size of all content before it was transferred. 180 // Total original size of all content before it was transferred.
171 int64 original_content_length_; 181 int64 original_content_length_;
172 182
173 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); 183 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate);
174 }; 184 };
175 185
176 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ 186 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698