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

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

Issue 6773006: Add enableReferrers and enableHyperlinkAuditing to contentSettings.misc API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forward-declare booleanprefmember Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "net/base/network_delegate.h" 12 #include "net/base/network_delegate.h"
13 13
14 class ExtensionEventRouterForwarder; 14 class ExtensionEventRouterForwarder;
15 template<class T> class PrefMember;
15 class ProtocolHandlerRegistry; 16 class ProtocolHandlerRegistry;
16 17
18 typedef PrefMember<bool> BooleanPrefMember;
19
17 // ChromeNetworkDelegate is the central point from within the chrome code to 20 // ChromeNetworkDelegate is the central point from within the chrome code to
18 // add hooks into the network stack. 21 // add hooks into the network stack.
19 class ChromeNetworkDelegate : public net::NetworkDelegate { 22 class ChromeNetworkDelegate : public net::NetworkDelegate {
20 public: 23 public:
21 // If |profile_id| is the invalid profile, events will be broadcasted to all 24 // If |profile_id| is the invalid profile, events will be broadcasted to all
22 // profiles, otherwise, they will only be sent to the specified profile. 25 // profiles, otherwise, they will only be sent to the specified profile.
26 // |enable_referrers| is a PrefMember which should be bound to the profile's
27 // PrefService and moved to the IO thread. This object's owner is responsible
28 // for cleaning it up at shutdown.
23 explicit ChromeNetworkDelegate( 29 explicit ChromeNetworkDelegate(
24 ExtensionEventRouterForwarder* event_router, 30 ExtensionEventRouterForwarder* event_router,
25 ProfileId profile_id, 31 ProfileId profile_id,
32 BooleanPrefMember* enable_referrers,
26 ProtocolHandlerRegistry* protocol_handler_registry); 33 ProtocolHandlerRegistry* protocol_handler_registry);
27 virtual ~ChromeNetworkDelegate(); 34 virtual ~ChromeNetworkDelegate();
28 35
29 private: 36 private:
30 // NetworkDelegate methods: 37 // NetworkDelegate methods:
31 virtual int OnBeforeURLRequest(net::URLRequest* request, 38 virtual int OnBeforeURLRequest(net::URLRequest* request,
32 net::CompletionCallback* callback); 39 net::CompletionCallback* callback);
33 virtual int OnBeforeSendHeaders(uint64 request_id, 40 virtual int OnBeforeSendHeaders(uint64 request_id,
34 net::HttpRequestHeaders* headers, 41 net::HttpRequestHeaders* headers,
35 net::CompletionCallback* callback); 42 net::CompletionCallback* callback);
36 virtual void OnResponseStarted(net::URLRequest* request); 43 virtual void OnResponseStarted(net::URLRequest* request);
37 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); 44 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read);
38 virtual void OnURLRequestDestroyed(net::URLRequest* request); 45 virtual void OnURLRequestDestroyed(net::URLRequest* request);
39 virtual net::URLRequestJob* OnMaybeCreateURLRequestJob( 46 virtual net::URLRequestJob* OnMaybeCreateURLRequestJob(
40 net::URLRequest* request); 47 net::URLRequest* request);
41 48
42 scoped_refptr<ExtensionEventRouterForwarder> event_router_; 49 scoped_refptr<ExtensionEventRouterForwarder> event_router_;
43 const ProfileId profile_id_; 50 const ProfileId profile_id_;
51
52 // Weak, owned by our owner.
53 BooleanPrefMember* enable_referrers_;
44 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; 54 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_;
45 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); 55 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate);
46 }; 56 };
47 57
48 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ 58 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698