Implement forwarding of search queries for metro mode
[chromium-blink-merge.git] / chrome_frame / plugin_url_request.cc
bloba8a14c7d3df92eedec7c0ef7250beb0ab8f8eb30
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome_frame/plugin_url_request.h"
7 #include "chrome/common/automation_messages.h"
9 PluginUrlRequest::PluginUrlRequest()
10 : delegate_(NULL),
11 remote_request_id_(-1),
12 post_data_len_(0),
13 enable_frame_busting_(false),
14 resource_type_(ResourceType::MAIN_FRAME),
15 load_flags_(0),
16 is_chunked_upload_(false) {
19 PluginUrlRequest::~PluginUrlRequest() {
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,
25 net::UploadData* upload_data, ResourceType::Type resource_type,
26 bool enable_frame_busting, int load_flags) {
27 delegate_ = delegate;
28 remote_request_id_ = remote_request_id;
29 url_ = url;
30 method_ = method;
31 referrer_ = referrer;
32 extra_headers_ = extra_headers;
33 resource_type_ = resource_type;
34 load_flags_ = load_flags;
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 {
46 post_data_len_ = upload_data->GetContentLengthSync();
47 upload_stream->AddRef();
48 upload_stream->Initialize(upload_data);
49 upload_data_.Attach(upload_stream);
50 is_chunked_upload_ = upload_data->is_chunked();
54 enable_frame_busting_ = enable_frame_busting;
56 return true;