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

Side by Side Diff: content/browser/resolve_proxy_msg_helper.h

Issue 8912009: Move BrowserMessageFilter to public, and into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR. Created 9 years 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 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>
11 11
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "content/browser/browser_message_filter.h"
14 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/public/browser/browser_message_filter.h"
15 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
16 #include "net/base/completion_callback.h" 16 #include "net/base/completion_callback.h"
17 #include "net/proxy/proxy_service.h" 17 #include "net/proxy/proxy_service.h"
18 18
19 namespace net { 19 namespace net {
20 class URLRequestContextGetter; 20 class URLRequestContextGetter;
21 } 21 }
22 22
23 // Responds to ChildProcessHostMsg_ResolveProxy, kicking off a ProxyResolve 23 // Responds to ChildProcessHostMsg_ResolveProxy, kicking off a ProxyResolve
24 // request on the IO thread using the specified proxy service. Completion is 24 // request on the IO thread using the specified proxy service. Completion is
25 // notified through the delegate. If multiple requests are started at the same 25 // notified through the delegate. If multiple requests are started at the same
26 // time, they will run in FIFO order, with only 1 being outstanding at a time. 26 // time, they will run in FIFO order, with only 1 being outstanding at a time.
27 // 27 //
28 // When an instance of ResolveProxyMsgHelper is destroyed, it cancels any 28 // When an instance of ResolveProxyMsgHelper is destroyed, it cancels any
29 // outstanding proxy resolve requests with the proxy service. It also deletes 29 // outstanding proxy resolve requests with the proxy service. It also deletes
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 : public BrowserMessageFilter { 33 class CONTENT_EXPORT ResolveProxyMsgHelper
34 : public content::BrowserMessageFilter {
34 public: 35 public:
35 explicit ResolveProxyMsgHelper(net::URLRequestContextGetter* getter); 36 explicit ResolveProxyMsgHelper(net::URLRequestContextGetter* getter);
36 // Constructor used by unittests. 37 // Constructor used by unittests.
37 explicit ResolveProxyMsgHelper(net::ProxyService* proxy_service); 38 explicit ResolveProxyMsgHelper(net::ProxyService* proxy_service);
38 39
39 // Destruction cancels the current outstanding request, and clears the 40 // Destruction cancels the current outstanding request, and clears the
40 // pending queue. 41 // pending queue.
41 virtual ~ResolveProxyMsgHelper(); 42 virtual ~ResolveProxyMsgHelper();
42 43
43 // BrowserMessageFilter implementation 44 // content::BrowserMessageFilter implementation
44 virtual bool OnMessageReceived(const IPC::Message& message, 45 virtual bool OnMessageReceived(const IPC::Message& message,
45 bool* message_was_ok) OVERRIDE; 46 bool* message_was_ok) OVERRIDE;
46 47
47 void OnResolveProxy(const GURL& url, IPC::Message* reply_msg); 48 void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);
48 49
49 private: 50 private:
50 // Callback for the ProxyService (bound to |callback_|). 51 // Callback for the ProxyService (bound to |callback_|).
51 void OnResolveProxyCompleted(int result); 52 void OnResolveProxyCompleted(int result);
52 53
53 // Starts the first pending request. 54 // Starts the first pending request.
(...skipping 21 matching lines...) Expand all
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698