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

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: review 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
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | 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) 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.
23 explicit ChromeNetworkDelegate( 26 // |enable_referrers| should be initialized on the UI thread (see below)
27 // beforehand. This object's owner is responsible for cleaning it up
28 // at shutdown.
29 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
36 // Binds |enable_referrers| to |pref_service| and moves it to the IO thread.
37 // This method should be called on the UI thread.
38 static void InitializeReferrersEnabled(BooleanPrefMember* enable_referrers,
39 PrefService* pref_service);
29 private: 40 private:
30 // NetworkDelegate methods: 41 // NetworkDelegate methods:
31 virtual int OnBeforeURLRequest(net::URLRequest* request, 42 virtual int OnBeforeURLRequest(net::URLRequest* request,
32 net::CompletionCallback* callback); 43 net::CompletionCallback* callback);
33 virtual int OnBeforeSendHeaders(uint64 request_id, 44 virtual int OnBeforeSendHeaders(uint64 request_id,
34 net::HttpRequestHeaders* headers, 45 net::HttpRequestHeaders* headers,
35 net::CompletionCallback* callback); 46 net::CompletionCallback* callback);
36 virtual void OnResponseStarted(net::URLRequest* request); 47 virtual void OnResponseStarted(net::URLRequest* request);
37 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); 48 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read);
38 virtual void OnURLRequestDestroyed(net::URLRequest* request); 49 virtual void OnURLRequestDestroyed(net::URLRequest* request);
39 virtual net::URLRequestJob* OnMaybeCreateURLRequestJob( 50 virtual net::URLRequestJob* OnMaybeCreateURLRequestJob(
40 net::URLRequest* request); 51 net::URLRequest* request);
41 52
42 scoped_refptr<ExtensionEventRouterForwarder> event_router_; 53 scoped_refptr<ExtensionEventRouterForwarder> event_router_;
43 const ProfileId profile_id_; 54 const ProfileId profile_id_;
55
56 // Weak, owned by our owner.
57 BooleanPrefMember* enable_referrers_;
44 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; 58 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_;
45 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); 59 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate);
46 }; 60 };
47 61
48 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ 62 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698