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

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: Add a SafeSearch preference, policy and implementation. Created 8 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 | 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 <set>
9 #include <string>
10
8 #include "base/basictypes.h" 11 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
11 #include "net/base/network_delegate.h" 14 #include "net/base/network_delegate.h"
15 #include "net/url_request/url_request.h"
12 16
13 class CookieSettings; 17 class CookieSettings;
14 class ExtensionInfoMap; 18 class ExtensionInfoMap;
15 class ManagedModeURLFilter; 19 class ManagedModeURLFilter;
16 class PrefService; 20 class PrefService;
17 template<class T> class PrefMember; 21 template<class T> class PrefMember;
18 22
19 typedef PrefMember<bool> BooleanPrefMember; 23 typedef PrefMember<bool> BooleanPrefMember;
20 24
21 namespace chrome_browser_net { 25 namespace chrome_browser_net {
(...skipping 21 matching lines...) Expand all
43 // settings are enforced on all observed network requests. 47 // settings are enforced on all observed network requests.
44 ChromeNetworkDelegate( 48 ChromeNetworkDelegate(
45 extensions::EventRouterForwarder* event_router, 49 extensions::EventRouterForwarder* event_router,
46 ExtensionInfoMap* extension_info_map, 50 ExtensionInfoMap* extension_info_map,
47 const policy::URLBlacklistManager* url_blacklist_manager, 51 const policy::URLBlacklistManager* url_blacklist_manager,
48 const ManagedModeURLFilter* managed_mode_url_filter, 52 const ManagedModeURLFilter* managed_mode_url_filter,
49 void* profile, 53 void* profile,
50 CookieSettings* cookie_settings, 54 CookieSettings* cookie_settings,
51 BooleanPrefMember* enable_referrers, 55 BooleanPrefMember* enable_referrers,
52 BooleanPrefMember* enable_do_not_track, 56 BooleanPrefMember* enable_do_not_track,
57 BooleanPrefMember* enable_safesearch,
Pam (message me for reviews) 2012/10/17 11:37:37 As above, "force" (or "require", etc.) rather than
Sergiu 2012/10/17 14:48:58 Done.
53 chrome_browser_net::LoadTimeStats* load_time_stats); 58 chrome_browser_net::LoadTimeStats* load_time_stats);
54 virtual ~ChromeNetworkDelegate(); 59 virtual ~ChromeNetworkDelegate();
55 60
56 // Causes |OnCanThrottleRequest| to always return false, for all 61 // Causes |OnCanThrottleRequest| to always return false, for all
57 // instances of this object. 62 // instances of this object.
58 static void NeverThrottleRequests(); 63 static void NeverThrottleRequests();
59 64
60 // Binds the pref members to |pref_service| and moves them to the IO thread. 65 // Binds the pref members to |pref_service| and moves them to the IO thread.
61 // |enable_do_not_track| can be NULL. 66 // |enable_do_not_track| can be NULL.
62 // This method should be called on the UI thread. 67 // This method should be called on the UI thread.
63 static void InitializePrefsOnUIThread(BooleanPrefMember* enable_referrers, 68 static void InitializePrefsOnUIThread(BooleanPrefMember* enable_referrers,
64 BooleanPrefMember* enable_do_not_track, 69 BooleanPrefMember* enable_do_not_track,
70 BooleanPrefMember* enable_safesearch,
65 PrefService* pref_service); 71 PrefService* pref_service);
66 72
67 // When called, all file:// URLs will now be accessible. If this is not 73 // When called, all file:// URLs will now be accessible. If this is not
68 // called, then some platforms restrict access to file:// paths. 74 // called, then some platforms restrict access to file:// paths.
69 static void AllowAccessToAllFiles(); 75 static void AllowAccessToAllFiles();
70 76
71 private: 77 private:
72 friend class ChromeNetworkDelegateTest; 78 friend class ChromeNetworkDelegateTest;
73 79
74 // NetworkDelegate implementation. 80 // NetworkDelegate implementation.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 123
118 scoped_refptr<extensions::EventRouterForwarder> event_router_; 124 scoped_refptr<extensions::EventRouterForwarder> event_router_;
119 void* profile_; 125 void* profile_;
120 scoped_refptr<CookieSettings> cookie_settings_; 126 scoped_refptr<CookieSettings> cookie_settings_;
121 127
122 scoped_refptr<ExtensionInfoMap> extension_info_map_; 128 scoped_refptr<ExtensionInfoMap> extension_info_map_;
123 129
124 // Weak, owned by our owner. 130 // Weak, owned by our owner.
125 BooleanPrefMember* enable_referrers_; 131 BooleanPrefMember* enable_referrers_;
126 BooleanPrefMember* enable_do_not_track_; 132 BooleanPrefMember* enable_do_not_track_;
133 BooleanPrefMember* enable_safesearch_;
battre 2012/10/16 16:05:49 how about renaming this to enforce_google_safesear
Sergiu 2012/10/17 14:48:58 Done.
127 134
128 // Weak, owned by our owner. 135 // Weak, owned by our owner.
129 const policy::URLBlacklistManager* url_blacklist_manager_; 136 const policy::URLBlacklistManager* url_blacklist_manager_;
130 137
131 // Weak pointer. The owner of this object needs to make sure that the 138 // Weak pointer. The owner of this object needs to make sure that the
132 // |managed_mode_url_filter_| outlives it. 139 // |managed_mode_url_filter_| outlives it.
133 const ManagedModeURLFilter* managed_mode_url_filter_; 140 const ManagedModeURLFilter* managed_mode_url_filter_;
134 141
135 // When true, allow access to all file:// URLs. 142 // When true, allow access to all file:// URLs.
136 static bool g_allow_file_access_; 143 static bool g_allow_file_access_;
137 144
145 // Set of requests modified by the managed mode which can not be
146 // altered by extensions.
147 std::set<net::URLRequest*> mod_by_managed_mode_;
battre 2012/10/16 16:05:49 I think we should rename this to "modified_by_mana
Joao da Silva 2012/10/16 16:26:46 Use a more descriptive name: modified_by_managed_
Bernhard Bauer 2012/10/16 16:37:33 What is this "managed mode" you speak of? ;-) The
Pam (message me for reviews) 2012/10/17 11:37:37 So "modified_by_policy_", with a comment to match.
Sergiu 2012/10/17 14:48:58 Done.
Sergiu 2012/10/17 14:48:58 Done.
Sergiu 2012/10/17 14:48:58 Done.
148
138 // True if OnCanThrottleRequest should always return false. 149 // True if OnCanThrottleRequest should always return false.
139 // 150 //
140 // Note: This needs to be static as the instance of 151 // Note: This needs to be static as the instance of
141 // ChromeNetworkDelegate used may change over time, and we need to 152 // ChromeNetworkDelegate used may change over time, and we need to
142 // set this variable once at start-up time. It is effectively 153 // set this variable once at start-up time. It is effectively
143 // static anyway since it is based on a command-line flag. 154 // static anyway since it is based on a command-line flag.
144 static bool g_never_throttle_requests_; 155 static bool g_never_throttle_requests_;
145 156
146 // Pointer to IOThread global, should outlive ChromeNetworkDelegate. 157 // Pointer to IOThread global, should outlive ChromeNetworkDelegate.
147 chrome_browser_net::LoadTimeStats* load_time_stats_; 158 chrome_browser_net::LoadTimeStats* load_time_stats_;
148 159
149 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); 160 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate);
150 }; 161 };
151 162
152 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ 163 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698