[email protected] | 1dce708 | 2012-02-10 07:39:11 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome_frame/plugin_url_request.h" |
| 6 | |
[email protected] | a8ba636 | 2010-11-10 20:02:25 | [diff] [blame] | 7 | #include "chrome/common/automation_messages.h" |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 8 | |
| 9 | PluginUrlRequest::PluginUrlRequest() |
[email protected] | 3eb07da | 2010-02-01 19:48:36 | [diff] [blame] | 10 | : delegate_(NULL), |
[email protected] | fc6fb7fb | 2009-11-07 02:35:04 | [diff] [blame] | 11 | remote_request_id_(-1), |
| 12 | post_data_len_(0), |
[email protected] | 6063340 | 2010-10-01 16:33:37 | [diff] [blame] | 13 | enable_frame_busting_(false), |
[email protected] | d9ffd55 | 2010-10-21 18:45:33 | [diff] [blame] | 14 | resource_type_(ResourceType::MAIN_FRAME), |
[email protected] | 8f17016 | 2011-01-26 23:42:42 | [diff] [blame] | 15 | load_flags_(0), |
[email protected] | 4736610c | 2011-03-04 06:43:35 | [diff] [blame] | 16 | is_chunked_upload_(false) { |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 17 | } |
| 18 | |
| 19 | PluginUrlRequest::~PluginUrlRequest() { |
| 20 | } |
| 21 | |
[email protected] | 3eb07da | 2010-02-01 19:48:36 | [diff] [blame] | 22 | bool PluginUrlRequest::Initialize(PluginUrlRequestDelegate* delegate, |
| 23 | int remote_request_id, const std::string& url, const std::string& method, |
| 24 | const std::string& referrer, const std::string& extra_headers, |
[email protected] | 6063340 | 2010-10-01 16:33:37 | [diff] [blame] | 25 | net::UploadData* upload_data, ResourceType::Type resource_type, |
[email protected] | d9ffd55 | 2010-10-21 18:45:33 | [diff] [blame] | 26 | bool enable_frame_busting, int load_flags) { |
[email protected] | 3eb07da | 2010-02-01 19:48:36 | [diff] [blame] | 27 | delegate_ = delegate; |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 28 | remote_request_id_ = remote_request_id; |
| 29 | url_ = url; |
| 30 | method_ = method; |
| 31 | referrer_ = referrer; |
| 32 | extra_headers_ = extra_headers; |
[email protected] | 6063340 | 2010-10-01 16:33:37 | [diff] [blame] | 33 | resource_type_ = resource_type; |
[email protected] | d9ffd55 | 2010-10-21 18:45:33 | [diff] [blame] | 34 | load_flags_ = load_flags; |
[email protected] | c5a8328 | 2009-10-29 03:57:23 | [diff] [blame] | 35 | |
[email protected] | 4736610c | 2011-03-04 06:43:35 | [diff] [blame] | 36 | if (upload_data) { |
| 37 | // We store a pointer to UrlmonUploadDataStream and not net::UploadData |
| 38 | // since UrlmonUploadDataStream implements thread safe ref counting and |
| 39 | // UploadData does not. |
| 40 | CComObject<UrlmonUploadDataStream>* upload_stream = NULL; |
| 41 | HRESULT hr = CComObject<UrlmonUploadDataStream>::CreateInstance( |
| 42 | &upload_stream); |
| 43 | if (FAILED(hr)) { |
| 44 | NOTREACHED(); |
| 45 | } else { |
[email protected] | 4736610c | 2011-03-04 06:43:35 | [diff] [blame] | 46 | upload_stream->AddRef(); |
| 47 | upload_stream->Initialize(upload_data); |
| 48 | upload_data_.Attach(upload_stream); |
| 49 | is_chunked_upload_ = upload_data->is_chunked(); |
[email protected] | ad91dc5 | 2012-09-01 03:46:06 | [diff] [blame] | 50 | STATSTG stat; |
| 51 | upload_stream->Stat(&stat, STATFLAG_NONAME); |
| 52 | post_data_len_ = stat.cbSize.QuadPart; |
[email protected] | c5a8328 | 2009-10-29 03:57:23 | [diff] [blame] | 53 | } |
| 54 | } |
[email protected] | 4736610c | 2011-03-04 06:43:35 | [diff] [blame] | 55 | |
[email protected] | 3eb07da | 2010-02-01 19:48:36 | [diff] [blame] | 56 | enable_frame_busting_ = enable_frame_busting; |
[email protected] | 4736610c | 2011-03-04 06:43:35 | [diff] [blame] | 57 | |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 58 | return true; |
| 59 | } |