| 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 CONTENT_BROWSER_RESOLVE_PROXY_MSG_HELPER_H_ | 5 #ifndef CONTENT_BROWSER_RESOLVE_PROXY_MSG_HELPER_H_ |
| 6 #define CONTENT_BROWSER_RESOLVE_PROXY_MSG_HELPER_H_ | 6 #define CONTENT_BROWSER_RESOLVE_PROXY_MSG_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // the stored IPC::Message pointers for pending requests. | 30 // the stored IPC::Message pointers for pending requests. |
| 31 // | 31 // |
| 32 // This object is expected to live on the IO thread. | 32 // This object is expected to live on the IO thread. |
| 33 class CONTENT_EXPORT ResolveProxyMsgHelper | 33 class CONTENT_EXPORT ResolveProxyMsgHelper |
| 34 : public content::BrowserMessageFilter { | 34 : public content::BrowserMessageFilter { |
| 35 public: | 35 public: |
| 36 explicit ResolveProxyMsgHelper(net::URLRequestContextGetter* getter); | 36 explicit ResolveProxyMsgHelper(net::URLRequestContextGetter* getter); |
| 37 // Constructor used by unittests. | 37 // Constructor used by unittests. |
| 38 explicit ResolveProxyMsgHelper(net::ProxyService* proxy_service); | 38 explicit ResolveProxyMsgHelper(net::ProxyService* proxy_service); |
| 39 | 39 |
| 40 // Destruction cancels the current outstanding request, and clears the | |
| 41 // pending queue. | |
| 42 virtual ~ResolveProxyMsgHelper(); | |
| 43 | |
| 44 // content::BrowserMessageFilter implementation | 40 // content::BrowserMessageFilter implementation |
| 45 virtual bool OnMessageReceived(const IPC::Message& message, | 41 virtual bool OnMessageReceived(const IPC::Message& message, |
| 46 bool* message_was_ok) OVERRIDE; | 42 bool* message_was_ok) OVERRIDE; |
| 47 | 43 |
| 48 void OnResolveProxy(const GURL& url, IPC::Message* reply_msg); | 44 void OnResolveProxy(const GURL& url, IPC::Message* reply_msg); |
| 49 | 45 |
| 46 protected: |
| 47 // Destruction cancels the current outstanding request, and clears the |
| 48 // pending queue. |
| 49 virtual ~ResolveProxyMsgHelper(); |
| 50 |
| 50 private: | 51 private: |
| 51 // Callback for the ProxyService (bound to |callback_|). | 52 // Callback for the ProxyService (bound to |callback_|). |
| 52 void OnResolveProxyCompleted(int result); | 53 void OnResolveProxyCompleted(int result); |
| 53 | 54 |
| 54 // Starts the first pending request. | 55 // Starts the first pending request. |
| 55 void StartPendingRequest(); | 56 void StartPendingRequest(); |
| 56 | 57 |
| 57 // A PendingRequest is a resolve request that is in progress, or queued. | 58 // A PendingRequest is a resolve request that is in progress, or queued. |
| 58 struct PendingRequest { | 59 struct PendingRequest { |
| 59 public: | 60 public: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 75 | 76 |
| 76 // FIFO queue of pending requests. The first entry is always the current one. | 77 // FIFO queue of pending requests. The first entry is always the current one. |
| 77 typedef std::deque<PendingRequest> PendingRequestList; | 78 typedef std::deque<PendingRequest> PendingRequestList; |
| 78 PendingRequestList pending_requests_; | 79 PendingRequestList pending_requests_; |
| 79 | 80 |
| 80 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 81 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
| 81 net::ProxyService* proxy_service_; | 82 net::ProxyService* proxy_service_; |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 #endif // CONTENT_BROWSER_RESOLVE_PROXY_MSG_HELPER_H_ | 85 #endif // CONTENT_BROWSER_RESOLVE_PROXY_MSG_HELPER_H_ |
| OLD | NEW |