summaryrefslogtreecommitdiffstats
path: root/chrome_frame/plugin_url_request.cc
diff options
context:
space:
mode:
authorslightlyoff@chromium.org <slightlyoff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 05:11:58 +0000
committerslightlyoff@chromium.org <slightlyoff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 05:11:58 +0000
commitf781782dd67077478e117c61dca4ea5eefce3544 (patch)
tree4801f724123cfdcbb69c4e7fe40a565b331723ae /chrome_frame/plugin_url_request.cc
parent63cf4759efa2373e33436fb5df6849f930081226 (diff)
downloadchromium_src-f781782dd67077478e117c61dca4ea5eefce3544.zip
chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.tar.gz
chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.tar.bz2
Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming in a separate CL.
BUG=None TEST=None Review URL: http://codereview.chromium.org/218019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/plugin_url_request.cc')
-rw-r--r--chrome_frame/plugin_url_request.cc65
1 files changed, 65 insertions, 0 deletions
diff --git a/chrome_frame/plugin_url_request.cc b/chrome_frame/plugin_url_request.cc
new file mode 100644
index 0000000..1d34b0c
--- /dev/null
+++ b/chrome_frame/plugin_url_request.cc
@@ -0,0 +1,65 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome_frame/plugin_url_request.h"
+
+#include "chrome/test/automation/automation_messages.h"
+#include "chrome_frame/np_browser_functions.h"
+
+PluginUrlRequest::PluginUrlRequest()
+ : request_handler_(NULL), tab_(0), remote_request_id_(0),
+ status_(URLRequestStatus::IO_PENDING),
+ frame_busting_enabled_(false) {
+}
+
+PluginUrlRequest::~PluginUrlRequest() {
+}
+
+bool PluginUrlRequest::Initialize(PluginRequestHandler* request_handler,
+ int tab, int remote_request_id, const std::string& url,
+ const std::string& method, const std::string& referrer,
+ const std::string& extra_headers, net::UploadData* upload_data,
+ bool enable_frame_busting) {
+ request_handler_ = request_handler;
+ tab_ = tab;
+ remote_request_id_ = remote_request_id;
+ url_ = url;
+ method_ = method;
+ referrer_ = referrer;
+ extra_headers_ = extra_headers;
+ upload_data_ = upload_data;
+ frame_busting_enabled_ = enable_frame_busting;
+ return true;
+}
+
+void PluginUrlRequest::OnResponseStarted(const char* mime_type,
+ const char* headers, int size, base::Time last_modified,
+ const std::string& persistent_cookies,
+ const std::string& redirect_url, int redirect_status) {
+ const IPC::AutomationURLResponse response = {
+ mime_type,
+ headers ? headers : "",
+ size,
+ last_modified,
+ persistent_cookies,
+ redirect_url,
+ redirect_status
+ };
+ request_handler_->Send(new AutomationMsg_RequestStarted(0, tab_,
+ remote_request_id_, response));
+}
+
+void PluginUrlRequest::OnResponseEnd(const URLRequestStatus& status) {
+ DCHECK(!status.is_io_pending());
+ DCHECK(status.is_success() || status.os_error());
+ request_handler_->Send(new AutomationMsg_RequestEnd(0, tab_,
+ remote_request_id_, status));
+}
+
+void PluginUrlRequest::OnReadComplete(const void* buffer, int len) {
+ std::string data(reinterpret_cast<const char*>(buffer), len);
+ request_handler_->Send(new AutomationMsg_RequestData(0, tab_,
+ remote_request_id_, data));
+}
+