blob: cfc798b712556074e4dffb45319ad62d52610b03 [file] [log] [blame]
[email protected]1dce7082012-02-10 07:39:111// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]f7817822009-09-24 05:11:582// 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]a8ba6362010-11-10 20:02:257#include "chrome/common/automation_messages.h"
[email protected]f7817822009-09-24 05:11:588
9PluginUrlRequest::PluginUrlRequest()
[email protected]3eb07da2010-02-01 19:48:3610 : delegate_(NULL),
[email protected]fc6fb7fb2009-11-07 02:35:0411 remote_request_id_(-1),
12 post_data_len_(0),
[email protected]60633402010-10-01 16:33:3713 enable_frame_busting_(false),
[email protected]d9ffd552010-10-21 18:45:3314 resource_type_(ResourceType::MAIN_FRAME),
[email protected]8f170162011-01-26 23:42:4215 load_flags_(0),
[email protected]4736610c2011-03-04 06:43:3516 is_chunked_upload_(false) {
[email protected]f7817822009-09-24 05:11:5817}
18
19PluginUrlRequest::~PluginUrlRequest() {
20}
21
[email protected]3eb07da2010-02-01 19:48:3622bool 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]60633402010-10-01 16:33:3725 net::UploadData* upload_data, ResourceType::Type resource_type,
[email protected]d9ffd552010-10-21 18:45:3326 bool enable_frame_busting, int load_flags) {
[email protected]3eb07da2010-02-01 19:48:3627 delegate_ = delegate;
[email protected]f7817822009-09-24 05:11:5828 remote_request_id_ = remote_request_id;
29 url_ = url;
30 method_ = method;
31 referrer_ = referrer;
32 extra_headers_ = extra_headers;
[email protected]60633402010-10-01 16:33:3733 resource_type_ = resource_type;
[email protected]d9ffd552010-10-21 18:45:3334 load_flags_ = load_flags;
[email protected]c5a83282009-10-29 03:57:2335
[email protected]4736610c2011-03-04 06:43:3536 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]4736610c2011-03-04 06:43:3546 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]ad91dc52012-09-01 03:46:0650 STATSTG stat;
51 upload_stream->Stat(&stat, STATFLAG_NONAME);
52 post_data_len_ = stat.cbSize.QuadPart;
[email protected]c5a83282009-10-29 03:57:2353 }
54 }
[email protected]4736610c2011-03-04 06:43:3555
[email protected]3eb07da2010-02-01 19:48:3656 enable_frame_busting_ = enable_frame_busting;
[email protected]4736610c2011-03-04 06:43:3557
[email protected]f7817822009-09-24 05:11:5858 return true;
59}