| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ref_counted.h" |
| 11 #include "chrome/browser/profiles/profile.h" |
| 10 #include "net/base/network_delegate.h" | 12 #include "net/base/network_delegate.h" |
| 11 | 13 |
| 12 class ExtensionIOEventRouter; | 14 class ExtensionEventRouterForwarder; |
| 13 | 15 |
| 14 // ChromeNetworkDelegate is the central point from within the chrome code to | 16 // ChromeNetworkDelegate is the central point from within the chrome code to |
| 15 // add hooks into the network stack. | 17 // add hooks into the network stack. |
| 16 class ChromeNetworkDelegate : public net::NetworkDelegate { | 18 class ChromeNetworkDelegate : public net::NetworkDelegate { |
| 17 public: | 19 public: |
| 20 // If |profile| is NULL, events will be broadcasted to all profiles, |
| 21 // otherwise, they will be only send to the specified profile. |
| 18 explicit ChromeNetworkDelegate( | 22 explicit ChromeNetworkDelegate( |
| 19 ExtensionIOEventRouter* extension_io_event_router); | 23 ExtensionEventRouterForwarder* event_router, |
| 20 ~ChromeNetworkDelegate(); | 24 ProfileId profile_id); |
| 25 virtual ~ChromeNetworkDelegate(); |
| 21 | 26 |
| 22 private: | 27 private: |
| 23 // NetworkDelegate methods: | 28 // NetworkDelegate methods: |
| 24 virtual void OnBeforeURLRequest(net::URLRequest* request); | 29 virtual void OnBeforeURLRequest(net::URLRequest* request); |
| 25 virtual void OnSendHttpRequest(net::HttpRequestHeaders* headers); | 30 virtual void OnSendHttpRequest(net::HttpRequestHeaders* headers); |
| 26 virtual void OnResponseStarted(net::URLRequest* request); | 31 virtual void OnResponseStarted(net::URLRequest* request); |
| 27 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); | 32 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); |
| 28 | 33 |
| 29 ExtensionIOEventRouter* const extension_io_event_router_; | 34 scoped_refptr<ExtensionEventRouterForwarder> event_router_; |
| 35 const ProfileId profile_id_; |
| 30 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 36 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
| 31 }; | 37 }; |
| 32 | 38 |
| 33 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 39 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| OLD | NEW |