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

Side by Side Diff: chrome/browser/chrome_plugin_host.cc

Issue 5607004: net: Remove typedef net::URLRequestJob URLRequestJob; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 2 Created 10 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) 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 #include "chrome/browser/chrome_plugin_host.h" 5 #include "chrome/browser/chrome_plugin_host.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 using base::TimeDelta; 50 using base::TimeDelta;
51 51
52 // This class manages the interception of network requests. It queries the 52 // This class manages the interception of network requests. It queries the
53 // plugin on every request, and creates an intercept job if the plugin can 53 // plugin on every request, and creates an intercept job if the plugin can
54 // intercept the request. 54 // intercept the request.
55 // NOTE: All methods must be called on the IO thread. 55 // NOTE: All methods must be called on the IO thread.
56 class PluginRequestInterceptor 56 class PluginRequestInterceptor
57 : public PluginHelper, public net::URLRequest::Interceptor { 57 : public PluginHelper, public net::URLRequest::Interceptor {
58 public: 58 public:
59 static URLRequestJob* UninterceptedProtocolHandler( 59 static net::URLRequestJob* UninterceptedProtocolHandler(
60 net::URLRequest* request, const std::string& scheme) { 60 net::URLRequest* request, const std::string& scheme) {
61 // This will get called if a plugin failed to intercept a request for a 61 // This will get called if a plugin failed to intercept a request for a
62 // protocol it has registered. In that case, we return NULL and the request 62 // protocol it has registered. In that case, we return NULL and the request
63 // will result in an error. 63 // will result in an error.
64 return new URLRequestErrorJob(request, net::ERR_FILE_NOT_FOUND); 64 return new URLRequestErrorJob(request, net::ERR_FILE_NOT_FOUND);
65 } 65 }
66 66
67 explicit PluginRequestInterceptor(ChromePluginLib* plugin) 67 explicit PluginRequestInterceptor(ChromePluginLib* plugin)
68 : PluginHelper(plugin) { 68 : PluginHelper(plugin) {
69 net::URLRequest::RegisterRequestInterceptor(this); 69 net::URLRequest::RegisterRequestInterceptor(this);
(...skipping 20 matching lines...) Expand all
90 // Only add a protocol factory if the net::URLRequest doesn't already handle 90 // Only add a protocol factory if the net::URLRequest doesn't already handle
91 // it. If we fail to intercept, the request will be treated as an error. 91 // it. If we fail to intercept, the request will be treated as an error.
92 if (!net::URLRequest::IsHandledProtocol(lower_scheme)) { 92 if (!net::URLRequest::IsHandledProtocol(lower_scheme)) {
93 registered_protocols_.insert(lower_scheme); 93 registered_protocols_.insert(lower_scheme);
94 net::URLRequest::RegisterProtocolFactory(lower_scheme, 94 net::URLRequest::RegisterProtocolFactory(lower_scheme,
95 &UninterceptedProtocolHandler); 95 &UninterceptedProtocolHandler);
96 } 96 }
97 } 97 }
98 98
99 // net::URLRequest::Interceptor 99 // net::URLRequest::Interceptor
100 virtual URLRequestJob* MaybeIntercept(net::URLRequest* request) { 100 virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) {
101 // TODO(darin): This DCHECK fails in the unit tests because our interceptor 101 // TODO(darin): This DCHECK fails in the unit tests because our interceptor
102 // is being persisted across unit tests. As a result, each time we get 102 // is being persisted across unit tests. As a result, each time we get
103 // poked on a different thread, but never from more than one thread at a 103 // poked on a different thread, but never from more than one thread at a
104 // time. We need a way to have the URLRequestJobManager get reset between 104 // time. We need a way to have the URLRequestJobManager get reset between
105 // unit tests. 105 // unit tests.
106 // DCHECK(CalledOnValidThread()); 106 // DCHECK(CalledOnValidThread());
107 107
108 if (!IsHandledProtocol(request->url().scheme())) 108 if (!IsHandledProtocol(request->url().scheme()))
109 return NULL; 109 return NULL;
110 110
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 CPBrowsingContext context) { 825 CPBrowsingContext context) {
826 // Sadly if we try and pass context through, we seem to break cl's little 826 // Sadly if we try and pass context through, we seem to break cl's little
827 // brain trying to compile the Tuple3 ctor. This cast works. 827 // brain trying to compile the Tuple3 ctor. This cast works.
828 int32 context_as_int32 = static_cast<int32>(context); 828 int32 context_as_int32 = static_cast<int32>(context);
829 // Plugins can only be accessed on the IO thread. 829 // Plugins can only be accessed on the IO thread.
830 BrowserThread::PostTask( 830 BrowserThread::PostTask(
831 BrowserThread::IO, FROM_HERE, 831 BrowserThread::IO, FROM_HERE,
832 NewRunnableFunction(PluginCommandHandler::HandleCommand, 832 NewRunnableFunction(PluginCommandHandler::HandleCommand,
833 command, data, context_as_int32)); 833 command, data, context_as_int32));
834 } 834 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/url_request_automation_job.cc ('k') | chrome/browser/chromeos/gview_request_interceptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698