| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/child/npapi/plugin_url_fetcher.h" | 5 #include "content/child/npapi/plugin_url_fetcher.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "content/child/child_thread.h" | 8 #include "content/child/child_thread.h" |
| 9 #include "content/child/multipart_response_delegate.h" | 9 #include "content/child/multipart_response_delegate.h" |
| 10 #include "content/child/npapi/plugin_host.h" | 10 #include "content/child/npapi/plugin_host.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 277 } |
| 278 | 278 |
| 279 // If the length comes in as -1, then it indicates that it was not | 279 // If the length comes in as -1, then it indicates that it was not |
| 280 // read off the HTTP headers. We replicate Safari webkit behavior here, | 280 // read off the HTTP headers. We replicate Safari webkit behavior here, |
| 281 // which is to set it to 0. | 281 // which is to set it to 0. |
| 282 int expected_length = std::max(static_cast<int>(info.content_length), 0); | 282 int expected_length = std::max(static_cast<int>(info.content_length), 0); |
| 283 | 283 |
| 284 base::Time temp; | 284 base::Time temp; |
| 285 uint32 last_modified = 0; | 285 uint32 last_modified = 0; |
| 286 std::string headers; | 286 std::string headers; |
| 287 if (info.headers) { // NULL for data: urls. | 287 if (info.headers.get()) { // NULL for data: urls. |
| 288 if (info.headers->GetLastModifiedValue(&temp)) | 288 if (info.headers->GetLastModifiedValue(&temp)) |
| 289 last_modified = static_cast<uint32>(temp.ToDoubleT()); | 289 last_modified = static_cast<uint32>(temp.ToDoubleT()); |
| 290 | 290 |
| 291 // TODO(darin): Shouldn't we also report HTTP version numbers? | 291 // TODO(darin): Shouldn't we also report HTTP version numbers? |
| 292 int response_code = info.headers->response_code(); | 292 int response_code = info.headers->response_code(); |
| 293 headers = base::StringPrintf("HTTP %d ", response_code); | 293 headers = base::StringPrintf("HTTP %d ", response_code); |
| 294 headers += info.headers->GetStatusText(); | 294 headers += info.headers->GetStatusText(); |
| 295 headers += "\n"; | 295 headers += "\n"; |
| 296 | 296 |
| 297 void* iter = NULL; | 297 void* iter = NULL; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 } | 366 } |
| 367 | 367 |
| 368 if (error_code == net::OK) { | 368 if (error_code == net::OK) { |
| 369 plugin_stream_->DidFinishLoading(resource_id_); | 369 plugin_stream_->DidFinishLoading(resource_id_); |
| 370 } else { | 370 } else { |
| 371 plugin_stream_->DidFail(resource_id_); | 371 plugin_stream_->DidFail(resource_id_); |
| 372 } | 372 } |
| 373 } | 373 } |
| 374 | 374 |
| 375 } // namespace content | 375 } // namespace content |
| OLD | NEW |