| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This job type handles Chrome plugin network interception. When a plugin | 5 // This job type handles Chrome plugin network interception. When a plugin |
| 6 // wants to intercept a request, a job of this type is created. The intercept | 6 // wants to intercept a request, a job of this type is created. The intercept |
| 7 // job communicates with the plugin to retrieve the response headers and data. | 7 // job communicates with the plugin to retrieve the response headers and data. |
| 8 | 8 |
| 9 #include "chrome/common/net/url_request_intercept_job.h" | 9 #include "chrome/common/net/url_request_intercept_job.h" |
| 10 | 10 |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "chrome/common/chrome_plugin_lib.h" | 13 #include "chrome/common/chrome_plugin_lib.h" |
| 14 #include "chrome/common/notification_service.h" | 14 #include "chrome/common/notification_service.h" |
| 15 #include "net/base/io_buffer.h" | 15 #include "net/base/io_buffer.h" |
| 16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 17 #include "net/base/x509_certificate.h" | 17 #include "net/base/x509_certificate.h" |
| 18 #include "net/http/http_response_headers.h" | 18 #include "net/http/http_response_headers.h" |
| 19 #include "net/url_request/url_request.h" | 19 #include "net/url_request/url_request.h" |
| 20 | 20 |
| 21 using base::Time; | 21 using base::Time; |
| 22 using base::TimeDelta; | 22 using base::TimeDelta; |
| 23 | 23 |
| 24 // | 24 // |
| 25 // URLRequestInterceptJob | 25 // URLRequestInterceptJob |
| 26 // | 26 // |
| 27 | 27 |
| 28 URLRequestInterceptJob::URLRequestInterceptJob(URLRequest* request, | 28 URLRequestInterceptJob::URLRequestInterceptJob(net::URLRequest* request, |
| 29 ChromePluginLib* plugin, | 29 ChromePluginLib* plugin, |
| 30 ScopableCPRequest* cprequest) | 30 ScopableCPRequest* cprequest) |
| 31 : URLRequestJob(request), | 31 : URLRequestJob(request), |
| 32 cprequest_(cprequest), | 32 cprequest_(cprequest), |
| 33 plugin_(plugin), | 33 plugin_(plugin), |
| 34 read_buffer_(NULL) { | 34 read_buffer_(NULL) { |
| 35 cprequest_->data = this; // see FromCPRequest(). | 35 cprequest_->data = this; // see FromCPRequest(). |
| 36 | 36 |
| 37 registrar_.Add(this, NotificationType::CHROME_PLUGIN_UNLOADED, | 37 registrar_.Add(this, NotificationType::CHROME_PLUGIN_UNLOADED, |
| 38 Source<ChromePluginLib>(plugin_)); | 38 Source<ChromePluginLib>(plugin_)); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 NotifyReadComplete(bytes_read); | 219 NotifyReadComplete(bytes_read); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void URLRequestInterceptJob::Observe(NotificationType type, | 222 void URLRequestInterceptJob::Observe(NotificationType type, |
| 223 const NotificationSource& source, | 223 const NotificationSource& source, |
| 224 const NotificationDetails& details) { | 224 const NotificationDetails& details) { |
| 225 DCHECK(type == NotificationType::CHROME_PLUGIN_UNLOADED); | 225 DCHECK(type == NotificationType::CHROME_PLUGIN_UNLOADED); |
| 226 DCHECK(plugin_ == Source<ChromePluginLib>(source).ptr()); | 226 DCHECK(plugin_ == Source<ChromePluginLib>(source).ptr()); |
| 227 DetachPlugin(); | 227 DetachPlugin(); |
| 228 } | 228 } |
| OLD | NEW |