Commit ecdfbdba authored by Daniel Vogelheim's avatar Daniel Vogelheim Committed by Commit Bot

Add convenience constructor for common SubstituteData use.

This should make the code slightly more readable and avoid creating + copying
objects with default values.

(This is a follow-up to https://chromium-review.googlesource.com/c/552131/4 )

R=tyoshino@chromium.org

Bug: 
Change-Id: I6f0f16bc9da26e0e81f87efc22124658edf00a22
Reviewed-on: https://chromium-review.googlesource.com/559336Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarTakeshi Yoshino <tyoshino@chromium.org>
Commit-Queue: Daniel Vogelheim <vogelheim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485250}
parent a59f2b51
......@@ -321,8 +321,7 @@ bool WebPagePopupImpl::InitializePage() {
frame->SetPageZoomFactor(popup_client_->ZoomFactor());
frame->Loader().Load(
FrameLoadRequest(0, ResourceRequest(BlankURL()),
SubstituteData(data, "text/html", "UTF-8", NullURL(),
kForceSynchronousLoad)));
SubstituteData(data, kForceSynchronousLoad)));
return true;
}
......
......@@ -27,8 +27,7 @@ class FrameTest : public ::testing::Test {
void Navigate(const String& destinationUrl) {
const KURL& url = KURL(NullURL(), destinationUrl);
FrameLoadRequest request(nullptr, ResourceRequest(url),
SubstituteData(SharedBuffer::Create(), "text/html",
"UTF-8", NullURL()));
SubstituteData(SharedBuffer::Create()));
GetDocument().GetFrame()->Loader().Load(request);
blink::testing::RunPendingTasks();
ASSERT_EQ(url.GetString(), GetDocument().Url().GetString());
......
......@@ -844,8 +844,7 @@ Page* InspectorOverlayAgent::OverlayPage() {
Platform::Current()->GetDataResource("InspectorOverlayPage.html");
loader.Load(FrameLoadRequest(
0, ResourceRequest(BlankURL()),
SubstituteData(overlay_page_html_resource, "text/html", "UTF-8",
NullURL(), kForceSynchronousLoad)));
SubstituteData(overlay_page_html_resource, kForceSynchronousLoad)));
v8::Isolate* isolate = ToIsolate(frame);
ScriptState* script_state = ToScriptStateForMainWorld(frame);
DCHECK(script_state);
......
......@@ -48,8 +48,7 @@ class PingLoaderTest : public ::testing::Test {
void SetDocumentURL(const KURL& url) {
FrameLoadRequest request(nullptr, ResourceRequest(url),
SubstituteData(SharedBuffer::Create(), "text/html",
"UTF-8", NullURL()));
SubstituteData(SharedBuffer::Create()));
page_holder_->GetFrame().Loader().Load(request);
blink::testing::RunPendingTasks();
ASSERT_EQ(url.GetString(), page_holder_->GetDocument().Url().GetString());
......
......@@ -318,9 +318,9 @@ void WebEmbeddedWorkerImpl::LoadShadowPage() {
RefPtr<SharedBuffer> buffer(
SharedBuffer::Create(content.data(), content.length()));
loading_shadow_page_ = true;
main_frame_->GetFrame()->Loader().Load(FrameLoadRequest(
0, ResourceRequest(worker_start_data_.script_url),
SubstituteData(buffer, "text/html", "UTF-8", NullURL())));
main_frame_->GetFrame()->Loader().Load(
FrameLoadRequest(0, ResourceRequest(worker_start_data_.script_url),
SubstituteData(buffer)));
}
void WebEmbeddedWorkerImpl::FrameDetached(WebLocalFrame* frame,
......
......@@ -41,6 +41,15 @@ class SubstituteData {
public:
SubstituteData() : substitute_data_load_policy_(kLoadNormally) {}
SubstituteData(
RefPtr<SharedBuffer> content,
SubstituteDataLoadPolicy substitute_data_load_policy = kLoadNormally)
: SubstituteData(content,
"text/html",
"UTF-8",
KURL(),
substitute_data_load_policy) {}
SubstituteData(
RefPtr<SharedBuffer> content,
const AtomicString& mime_type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment