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 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 read_buffer_size_ = dest_size; | 89 read_buffer_size_ = dest_size; |
90 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); | 90 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); |
91 } else { | 91 } else { |
92 // TODO(mpcomplete): better error code | 92 // TODO(mpcomplete): better error code |
93 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, net::ERR_FAILED)); | 93 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, net::ERR_FAILED)); |
94 } | 94 } |
95 | 95 |
96 return false; | 96 return false; |
97 } | 97 } |
98 | 98 |
99 bool URLRequestInterceptJob::GetMimeType(std::string* mime_type) { | 99 bool URLRequestInterceptJob::GetMimeType(std::string* mime_type) const { |
100 return request_->response_headers()->GetMimeType(mime_type); | 100 return request_->response_headers()->GetMimeType(mime_type); |
101 } | 101 } |
102 | 102 |
103 bool URLRequestInterceptJob::GetCharset(std::string* charset) { | 103 bool URLRequestInterceptJob::GetCharset(std::string* charset) { |
104 return request_->response_headers()->GetCharset(charset); | 104 return request_->response_headers()->GetCharset(charset); |
105 } | 105 } |
106 | 106 |
107 bool URLRequestInterceptJob::GetContentEncoding(std::string* encoding_type) { | 107 bool URLRequestInterceptJob::GetContentEncoding(std::string* encoding_type) { |
108 // TODO(darin): what if there are multiple content encodings? | 108 // TODO(darin): what if there are multiple content encodings? |
109 return request_->response_headers()->EnumerateHeader(NULL, "Content-Encoding", | 109 return request_->response_headers()->EnumerateHeader(NULL, "Content-Encoding", |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 206 } |
207 | 207 |
208 void URLRequestInterceptJob::Observe(NotificationType type, | 208 void URLRequestInterceptJob::Observe(NotificationType type, |
209 const NotificationSource& source, | 209 const NotificationSource& source, |
210 const NotificationDetails& details) { | 210 const NotificationDetails& details) { |
211 DCHECK(type == NotificationType::CHROME_PLUGIN_UNLOADED); | 211 DCHECK(type == NotificationType::CHROME_PLUGIN_UNLOADED); |
212 DCHECK(plugin_ == Source<ChromePluginLib>(source).ptr()); | 212 DCHECK(plugin_ == Source<ChromePluginLib>(source).ptr()); |
213 | 213 |
214 DetachPlugin(); | 214 DetachPlugin(); |
215 } | 215 } |
OLD | NEW |