| 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_frame/npapi_url_request.h" | 5 #include "chrome_frame/npapi_url_request.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "chrome_frame/np_browser_functions.h" | 8 #include "chrome_frame/np_browser_functions.h" |
| 9 #include "chrome_frame/np_utils.h" | 9 #include "chrome_frame/np_utils.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 | 11 |
| 12 class NPAPIUrlRequest : public PluginUrlRequest { | 12 class NPAPIUrlRequest : public PluginUrlRequest { |
| 13 public: | 13 public: |
| 14 explicit NPAPIUrlRequest(NPP instance); | 14 explicit NPAPIUrlRequest(NPP instance); |
| 15 ~NPAPIUrlRequest(); | 15 ~NPAPIUrlRequest(); |
| 16 | 16 |
| 17 virtual bool Start(); | 17 virtual bool Start(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 uint32 data_len = static_cast<uint32>(post_data_len()); | 67 uint32 data_len = static_cast<uint32>(post_data_len()); |
| 68 | 68 |
| 69 std::string buffer; | 69 std::string buffer; |
| 70 if (extra_headers().length() > 0) { | 70 if (extra_headers().length() > 0) { |
| 71 buffer += extra_headers(); | 71 buffer += extra_headers(); |
| 72 TrimWhitespace(buffer, TRIM_ALL, &buffer); | 72 TrimWhitespace(buffer, TRIM_ALL, &buffer); |
| 73 | 73 |
| 74 // Firefox looks specifically for "Content-length: \d+\r\n\r\n" | 74 // Firefox looks specifically for "Content-length: \d+\r\n\r\n" |
| 75 // to detect if extra headers are added to the message buffer. | 75 // to detect if extra headers are added to the message buffer. |
| 76 buffer += "\r\nContent-length: "; | 76 buffer += "\r\nContent-length: "; |
| 77 buffer += IntToString(data_len); | 77 buffer += base::IntToString(data_len); |
| 78 buffer += "\r\n\r\n"; | 78 buffer += "\r\n\r\n"; |
| 79 } | 79 } |
| 80 | 80 |
| 81 std::string data; | 81 std::string data; |
| 82 data.resize(data_len); | 82 data.resize(data_len); |
| 83 uint32 bytes_read; | 83 uint32 bytes_read; |
| 84 upload_data_->Read(&data[0], data_len, | 84 upload_data_->Read(&data[0], data_len, |
| 85 reinterpret_cast<ULONG*>(&bytes_read)); | 85 reinterpret_cast<ULONG*>(&bytes_read)); |
| 86 DCHECK_EQ(data_len, bytes_read); | 86 DCHECK_EQ(data_len, bytes_read); |
| 87 buffer += data; | 87 buffer += data; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 | 387 |
| 388 scoped_refptr<NPAPIUrlRequest> NPAPIUrlRequestManager::LookupRequest( | 388 scoped_refptr<NPAPIUrlRequest> NPAPIUrlRequestManager::LookupRequest( |
| 389 int request_id) { | 389 int request_id) { |
| 390 RequestMap::iterator index = request_map_.find(request_id); | 390 RequestMap::iterator index = request_map_.find(request_id); |
| 391 if (index != request_map_.end()) | 391 if (index != request_map_.end()) |
| 392 return index->second; | 392 return index->second; |
| 393 return NULL; | 393 return NULL; |
| 394 } | 394 } |
| OLD | NEW |