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

Side by Side Diff: chrome/browser/renderer_host/resource_message_filter.h

Issue 6338002: net: Remove typedef net::URLRequestContext URLRequestContext; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for real Created 9 years, 11 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
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_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_
6 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_
7 7
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "chrome/browser/browser_message_filter.h" 9 #include "chrome/browser/browser_message_filter.h"
10 #include "chrome/common/child_process_info.h" 10 #include "chrome/common/child_process_info.h"
11 #include "webkit/glue/resource_type.h" 11 #include "webkit/glue/resource_type.h"
12 12
13 class ChromeURLRequestContext; 13 class ChromeURLRequestContext;
14 class ResourceDispatcherHost; 14 class ResourceDispatcherHost;
15 15
16 namespace net { 16 namespace net {
17 class URLRequestContext; 17 class URLRequestContext;
18 } // namespace net 18 } // namespace net
19 19
20 // This class filters out incoming IPC messages for network requests and 20 // This class filters out incoming IPC messages for network requests and
21 // processes them on the IPC thread. As a result, network requests are not 21 // processes them on the IPC thread. As a result, network requests are not
22 // delayed by costly UI processing that may be occuring on the main thread of 22 // delayed by costly UI processing that may be occuring on the main thread of
23 // the browser. It also means that any hangs in starting a network request 23 // the browser. It also means that any hangs in starting a network request
24 // will not interfere with browser UI. 24 // will not interfere with browser UI.
25 class ResourceMessageFilter : public BrowserMessageFilter { 25 class ResourceMessageFilter : public BrowserMessageFilter {
26 public: 26 public:
27 // Allows overriding the URLRequestContext used to service requests. 27 // Allows overriding the net::URLRequestContext used to service requests.
28 class URLRequestContextOverride 28 class URLRequestContextOverride
29 : public base::RefCountedThreadSafe<URLRequestContextOverride> { 29 : public base::RefCountedThreadSafe<URLRequestContextOverride> {
30 public: 30 public:
31 URLRequestContextOverride() {} 31 URLRequestContextOverride() {}
32 32
33 virtual net::URLRequestContext* GetRequestContext( 33 virtual net::URLRequestContext* GetRequestContext(
34 uint32 request_id, ResourceType::Type resource_type) = 0; 34 uint32 request_id, ResourceType::Type resource_type) = 0;
35 35
36 protected: 36 protected:
37 friend class base::RefCountedThreadSafe<URLRequestContextOverride>; 37 friend class base::RefCountedThreadSafe<URLRequestContextOverride>;
38 virtual ~URLRequestContextOverride() {} 38 virtual ~URLRequestContextOverride() {}
39 39
40 DISALLOW_COPY_AND_ASSIGN(URLRequestContextOverride); 40 DISALLOW_COPY_AND_ASSIGN(URLRequestContextOverride);
41 }; 41 };
42 42
43 ResourceMessageFilter(int child_id, 43 ResourceMessageFilter(int child_id,
44 ChildProcessInfo::ProcessType process_type, 44 ChildProcessInfo::ProcessType process_type,
45 ResourceDispatcherHost* resource_dispatcher_host); 45 ResourceDispatcherHost* resource_dispatcher_host);
46 46
47 // BrowserMessageFilter implementation. 47 // BrowserMessageFilter implementation.
48 virtual void OnChannelClosing(); 48 virtual void OnChannelClosing();
49 virtual bool OnMessageReceived(const IPC::Message& message, 49 virtual bool OnMessageReceived(const IPC::Message& message,
50 bool* message_was_ok); 50 bool* message_was_ok);
51 51
52 // Returns the URLRequestContext for the given request. 52 // Returns the net::URLRequestContext for the given request.
53 ChromeURLRequestContext* GetURLRequestContext( 53 ChromeURLRequestContext* GetURLRequestContext(
54 uint32 request_id, ResourceType::Type resource_type); 54 uint32 request_id, ResourceType::Type resource_type);
55 55
56 void set_url_request_context_override(URLRequestContextOverride* u) { 56 void set_url_request_context_override(URLRequestContextOverride* u) {
57 url_request_context_override_ = u; 57 url_request_context_override_ = u;
58 } 58 }
59 59
60 int child_id() const { return child_id_; } 60 int child_id() const { return child_id_; }
61 ChildProcessInfo::ProcessType process_type() const { return process_type_; } 61 ChildProcessInfo::ProcessType process_type() const { return process_type_; }
62 62
63 protected: 63 protected:
64 // Protected destructor so that we can be overriden in tests. 64 // Protected destructor so that we can be overriden in tests.
65 virtual ~ResourceMessageFilter(); 65 virtual ~ResourceMessageFilter();
66 66
67 private: 67 private:
68 // The ID of the child process. 68 // The ID of the child process.
69 int child_id_; 69 int child_id_;
70 70
71 ChildProcessInfo::ProcessType process_type_; 71 ChildProcessInfo::ProcessType process_type_;
72 72
73 // Owned by BrowserProcess, which is guaranteed to outlive us. 73 // Owned by BrowserProcess, which is guaranteed to outlive us.
74 ResourceDispatcherHost* resource_dispatcher_host_; 74 ResourceDispatcherHost* resource_dispatcher_host_;
75 75
76 scoped_refptr<URLRequestContextOverride> url_request_context_override_; 76 scoped_refptr<URLRequestContextOverride> url_request_context_override_;
77 77
78 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceMessageFilter); 78 DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceMessageFilter);
79 }; 79 };
80 80
81 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_ 81 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_MESSAGE_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698