| OLD | NEW |
| 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/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 "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "net/base/network_delegate.h" | 13 #include "net/base/network_delegate.h" |
| 14 | 14 |
| 15 class ExtensionEventRouterForwarder; | 15 class ExtensionEventRouterForwarder; |
| 16 class ExtensionInfoMap; |
| 16 template<class T> class PrefMember; | 17 template<class T> class PrefMember; |
| 17 | 18 |
| 18 typedef PrefMember<bool> BooleanPrefMember; | 19 typedef PrefMember<bool> BooleanPrefMember; |
| 19 | 20 |
| 20 // ChromeNetworkDelegate is the central point from within the chrome code to | 21 // ChromeNetworkDelegate is the central point from within the chrome code to |
| 21 // add hooks into the network stack. | 22 // add hooks into the network stack. |
| 22 class ChromeNetworkDelegate : public net::NetworkDelegate { | 23 class ChromeNetworkDelegate : public net::NetworkDelegate { |
| 23 public: | 24 public: |
| 24 // If |profile_id| is the invalid profile, events will be broadcasted to all | 25 // If |profile_id| is the invalid profile, events will be broadcasted to all |
| 25 // profiles, otherwise, they will only be sent to the specified profile. | 26 // profiles, otherwise, they will only be sent to the specified profile. |
| 26 // |enable_referrers| should be initialized on the UI thread (see below) | 27 // |enable_referrers| should be initialized on the UI thread (see below) |
| 27 // beforehand. This object's owner is responsible for cleaning it up | 28 // beforehand. This object's owner is responsible for cleaning it up |
| 28 // at shutdown. | 29 // at shutdown. |
| 29 ChromeNetworkDelegate( | 30 ChromeNetworkDelegate( |
| 30 ExtensionEventRouterForwarder* event_router, | 31 ExtensionEventRouterForwarder* event_router, |
| 32 ExtensionInfoMap* extension_info_map, |
| 31 ProfileId profile_id, | 33 ProfileId profile_id, |
| 32 BooleanPrefMember* enable_referrers); | 34 BooleanPrefMember* enable_referrers); |
| 33 virtual ~ChromeNetworkDelegate(); | 35 virtual ~ChromeNetworkDelegate(); |
| 34 | 36 |
| 35 // Binds |enable_referrers| to |pref_service| and moves it to the IO thread. | 37 // Binds |enable_referrers| to |pref_service| and moves it to the IO thread. |
| 36 // This method should be called on the UI thread. | 38 // This method should be called on the UI thread. |
| 37 static void InitializeReferrersEnabled(BooleanPrefMember* enable_referrers, | 39 static void InitializeReferrersEnabled(BooleanPrefMember* enable_referrers, |
| 38 PrefService* pref_service); | 40 PrefService* pref_service); |
| 39 | 41 |
| 40 private: | 42 private: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 53 virtual void OnResponseStarted(net::URLRequest* request); | 55 virtual void OnResponseStarted(net::URLRequest* request); |
| 54 virtual void OnRawBytesRead(const net::URLRequest& request, int bytes_read); | 56 virtual void OnRawBytesRead(const net::URLRequest& request, int bytes_read); |
| 55 virtual void OnCompleted(net::URLRequest* request); | 57 virtual void OnCompleted(net::URLRequest* request); |
| 56 virtual void OnURLRequestDestroyed(net::URLRequest* request); | 58 virtual void OnURLRequestDestroyed(net::URLRequest* request); |
| 57 virtual void OnHttpTransactionDestroyed(uint64 request_id); | 59 virtual void OnHttpTransactionDestroyed(uint64 request_id); |
| 58 virtual void OnPACScriptError(int line_number, const string16& error); | 60 virtual void OnPACScriptError(int line_number, const string16& error); |
| 59 | 61 |
| 60 scoped_refptr<ExtensionEventRouterForwarder> event_router_; | 62 scoped_refptr<ExtensionEventRouterForwarder> event_router_; |
| 61 const ProfileId profile_id_; | 63 const ProfileId profile_id_; |
| 62 | 64 |
| 65 scoped_refptr<ExtensionInfoMap> extension_info_map_; |
| 66 |
| 63 // Weak, owned by our owner. | 67 // Weak, owned by our owner. |
| 64 BooleanPrefMember* enable_referrers_; | 68 BooleanPrefMember* enable_referrers_; |
| 65 | 69 |
| 66 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 70 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
| 67 }; | 71 }; |
| 68 | 72 |
| 69 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 73 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| OLD | NEW |