summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/exported/web_navigation_params.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/exported/web_navigation_params.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/exported/web_navigation_params.cc56
1 files changed, 56 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/core/exported/web_navigation_params.cc b/chromium/third_party/blink/renderer/core/exported/web_navigation_params.cc
new file mode 100644
index 00000000000..db8fa31dcb0
--- /dev/null
+++ b/chromium/third_party/blink/renderer/core/exported/web_navigation_params.cc
@@ -0,0 +1,56 @@
+// Copyright 2018 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 "third_party/blink/public/web/web_navigation_params.h"
+#include "third_party/blink/renderer/platform/shared_buffer.h"
+
+namespace blink {
+
+WebNavigationParams::WebNavigationParams()
+ : devtools_navigation_token(base::UnguessableToken::Create()) {}
+
+WebNavigationParams::~WebNavigationParams() = default;
+
+WebNavigationParams::WebNavigationParams(
+ const base::UnguessableToken& devtools_navigation_token)
+ : devtools_navigation_token(devtools_navigation_token) {}
+
+// static
+std::unique_ptr<WebNavigationParams> WebNavigationParams::CreateFromInfo(
+ const WebNavigationInfo& info) {
+ auto result = std::make_unique<WebNavigationParams>();
+ result->request = info.url_request;
+ result->frame_load_type = info.frame_load_type;
+ result->is_client_redirect = info.is_client_redirect;
+ result->navigation_timings.input_start = info.input_start;
+ return result;
+};
+
+// static
+std::unique_ptr<WebNavigationParams> WebNavigationParams::CreateWithHTMLString(
+ base::span<const char> html,
+ const WebURL& base_url) {
+ auto result = std::make_unique<WebNavigationParams>();
+ result->request = WebURLRequest(base_url);
+ result->data = WebData(html.data(), html.size());
+ result->mime_type = "text/html";
+ result->text_encoding = "UTF-8";
+ return result;
+}
+
+#if INSIDE_BLINK
+// static
+std::unique_ptr<WebNavigationParams> WebNavigationParams::CreateWithHTMLBuffer(
+ scoped_refptr<SharedBuffer> buffer,
+ const KURL& base_url) {
+ auto result = std::make_unique<WebNavigationParams>();
+ result->request = WebURLRequest(base_url);
+ result->data = WebData(std::move(buffer));
+ result->mime_type = "text/html";
+ result->text_encoding = "UTF-8";
+ return result;
+}
+#endif
+
+} // namespace blink