| 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 #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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 net::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 net::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); |
| 70 } | 70 } |
| 71 | 71 |
| 72 virtual ~PluginRequestInterceptor() { | 72 virtual ~PluginRequestInterceptor() { |
| 73 net::URLRequest::UnregisterRequestInterceptor(this); | 73 net::URLRequest::UnregisterRequestInterceptor(this); |
| 74 | 74 |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |