| OLD | NEW |
| 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_COMMON_NET_URL_REQUEST_INTERCEPT_JOB_H_ | 5 #ifndef CHROME_COMMON_NET_URL_REQUEST_INTERCEPT_JOB_H_ |
| 6 #define CHROME_COMMON_NET_URL_REQUEST_INTERCEPT_JOB_H_ | 6 #define CHROME_COMMON_NET_URL_REQUEST_INTERCEPT_JOB_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "net/url_request/url_request_job.h" | 12 #include "net/url_request/url_request_job.h" |
| 13 #include "chrome/common/chrome_plugin_api.h" | 13 #include "chrome/common/chrome_plugin_api.h" |
| 14 #include "chrome/common/chrome_plugin_util.h" | 14 #include "chrome/common/chrome_plugin_util.h" |
| 15 #include "chrome/common/notification_registrar.h" | 15 #include "chrome/common/notification_registrar.h" |
| 16 | 16 |
| 17 namespace net { |
| 18 class URLRequest; |
| 19 } // namespace net |
| 20 |
| 17 class ChromePluginLib; | 21 class ChromePluginLib; |
| 18 class URLRequest; | |
| 19 | 22 |
| 20 // A request job that handles network requests intercepted by a Chrome plugin. | 23 // A request job that handles network requests intercepted by a Chrome plugin. |
| 21 class URLRequestInterceptJob | 24 class URLRequestInterceptJob : public net::URLRequestJob, |
| 22 : public URLRequestJob, public NotificationObserver { | 25 public NotificationObserver { |
| 23 public: | 26 public: |
| 24 static URLRequestInterceptJob* FromCPRequest(CPRequest* request) { | 27 static URLRequestInterceptJob* FromCPRequest(CPRequest* request) { |
| 25 return ScopableCPRequest::GetData<URLRequestInterceptJob*>(request); | 28 return ScopableCPRequest::GetData<URLRequestInterceptJob*>(request); |
| 26 } | 29 } |
| 27 | 30 |
| 28 URLRequestInterceptJob(URLRequest* request, ChromePluginLib* plugin, | 31 URLRequestInterceptJob(net::URLRequest* request, ChromePluginLib* plugin, |
| 29 ScopableCPRequest* cprequest); | 32 ScopableCPRequest* cprequest); |
| 30 virtual ~URLRequestInterceptJob(); | 33 virtual ~URLRequestInterceptJob(); |
| 31 | 34 |
| 32 // Plugin callbacks. | 35 // Plugin callbacks. |
| 33 void OnStartCompleted(int result); | 36 void OnStartCompleted(int result); |
| 34 void OnReadCompleted(int bytes_read); | 37 void OnReadCompleted(int bytes_read); |
| 35 | 38 |
| 36 // URLRequestJob | 39 // URLRequestJob |
| 37 virtual void Start(); | 40 virtual void Start(); |
| 38 virtual void Kill(); | 41 virtual void Kill(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 59 NotificationRegistrar registrar_; | 62 NotificationRegistrar registrar_; |
| 60 scoped_ptr<ScopableCPRequest> cprequest_; | 63 scoped_ptr<ScopableCPRequest> cprequest_; |
| 61 ChromePluginLib* plugin_; | 64 ChromePluginLib* plugin_; |
| 62 net::IOBuffer* read_buffer_; | 65 net::IOBuffer* read_buffer_; |
| 63 int read_buffer_size_; | 66 int read_buffer_size_; |
| 64 | 67 |
| 65 DISALLOW_COPY_AND_ASSIGN(URLRequestInterceptJob); | 68 DISALLOW_COPY_AND_ASSIGN(URLRequestInterceptJob); |
| 66 }; | 69 }; |
| 67 | 70 |
| 68 #endif // CHROME_COMMON_NET_URL_REQUEST_INTERCEPT_JOB_H_ | 71 #endif // CHROME_COMMON_NET_URL_REQUEST_INTERCEPT_JOB_H_ |
| OLD | NEW |