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

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

Issue 9572001: Do cookie checks in NetworkDelegate instead of the URLRequest::Delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix Created 8 years, 9 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 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "net/base/network_delegate.h" 12 #include "net/base/network_delegate.h"
13 13
14 class CookieSettings;
14 class ExtensionEventRouterForwarder; 15 class ExtensionEventRouterForwarder;
15 class ExtensionInfoMap; 16 class ExtensionInfoMap;
16 class PrefService; 17 class PrefService;
17 template<class T> class PrefMember; 18 template<class T> class PrefMember;
18 19
19 typedef PrefMember<bool> BooleanPrefMember; 20 typedef PrefMember<bool> BooleanPrefMember;
20 21
21 namespace policy { 22 namespace policy {
22 class URLBlacklistManager; 23 class URLBlacklistManager;
23 } 24 }
24 25
25 // ChromeNetworkDelegate is the central point from within the chrome code to 26 // ChromeNetworkDelegate is the central point from within the chrome code to
26 // add hooks into the network stack. 27 // add hooks into the network stack.
27 class ChromeNetworkDelegate : public net::NetworkDelegate { 28 class ChromeNetworkDelegate : public net::NetworkDelegate {
28 public: 29 public:
29 // If |profile| is NULL, events will be broadcasted to all profiles, otherwise 30 // If |profile| is NULL, events will be broadcasted to all profiles,
30 // they will only be sent to the specified profile. 31 // otherwise they will only be sent to the specified profile.
31 // |enable_referrers| should be initialized on the UI thread (see below) 32 // |enable_referrers| should be initialized on the UI thread (see below)
32 // beforehand. This object's owner is responsible for cleaning it up 33 // beforehand. This object's owner is responsible for cleaning it up at
33 // at shutdown. 34 // shutdown. If |cookie_settings| is NULL, all cookies are enabled,
35 // otherwise, the settings are enforced on all observed network requests.
34 ChromeNetworkDelegate( 36 ChromeNetworkDelegate(
35 ExtensionEventRouterForwarder* event_router, 37 ExtensionEventRouterForwarder* event_router,
36 ExtensionInfoMap* extension_info_map, 38 ExtensionInfoMap* extension_info_map,
37 const policy::URLBlacklistManager* url_blacklist_manager, 39 const policy::URLBlacklistManager* url_blacklist_manager,
38 void* profile, 40 void* profile,
41 CookieSettings* cookie_settings,
39 BooleanPrefMember* enable_referrers); 42 BooleanPrefMember* enable_referrers);
40 virtual ~ChromeNetworkDelegate(); 43 virtual ~ChromeNetworkDelegate();
41 44
42 // Binds |enable_referrers| to |pref_service| and moves it to the IO thread. 45 // Binds |enable_referrers| to |pref_service| and moves it to the IO thread.
43 // This method should be called on the UI thread. 46 // This method should be called on the UI thread.
44 static void InitializeReferrersEnabled(BooleanPrefMember* enable_referrers, 47 static void InitializeReferrersEnabled(BooleanPrefMember* enable_referrers,
45 PrefService* pref_service); 48 PrefService* pref_service);
46 49
47 private: 50 private:
48 // NetworkDelegate implementation. 51 // NetworkDelegate implementation.
(...skipping 18 matching lines...) Expand all
67 int bytes_read) OVERRIDE; 70 int bytes_read) OVERRIDE;
68 virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE; 71 virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE;
69 virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE; 72 virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE;
70 virtual void OnPACScriptError(int line_number, 73 virtual void OnPACScriptError(int line_number,
71 const string16& error) OVERRIDE; 74 const string16& error) OVERRIDE;
72 virtual net::NetworkDelegate::AuthRequiredResponse OnAuthRequired( 75 virtual net::NetworkDelegate::AuthRequiredResponse OnAuthRequired(
73 net::URLRequest* request, 76 net::URLRequest* request,
74 const net::AuthChallengeInfo& auth_info, 77 const net::AuthChallengeInfo& auth_info,
75 const AuthCallback& callback, 78 const AuthCallback& callback,
76 net::AuthCredentials* credentials) OVERRIDE; 79 net::AuthCredentials* credentials) OVERRIDE;
80 virtual bool OnReadingCookies(const net::URLRequest* request,
81 const net::CookieList& cookie_list) OVERRIDE;
82 virtual bool OnSettingCookie(const net::URLRequest* request,
83 const std::string& cookie_line,
84 net::CookieOptions* options) OVERRIDE;
77 85
78 scoped_refptr<ExtensionEventRouterForwarder> event_router_; 86 scoped_refptr<ExtensionEventRouterForwarder> event_router_;
79 void* profile_; 87 void* profile_;
88 scoped_refptr<CookieSettings> cookie_settings_;
80 89
81 scoped_refptr<ExtensionInfoMap> extension_info_map_; 90 scoped_refptr<ExtensionInfoMap> extension_info_map_;
82 91
83 // Weak, owned by our owner. 92 // Weak, owned by our owner.
84 BooleanPrefMember* enable_referrers_; 93 BooleanPrefMember* enable_referrers_;
85 94
86 // Weak, owned by our owner. 95 // Weak, owned by our owner.
87 const policy::URLBlacklistManager* url_blacklist_manager_; 96 const policy::URLBlacklistManager* url_blacklist_manager_;
88 97
89 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); 98 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate);
90 }; 99 };
91 100
92 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ 101 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698