Move LoadData to script_traits.

This commit is contained in:
Ms2ger 2016-10-18 15:12:44 +02:00
parent bb271ef4af
commit e97f06800e
16 changed files with 67 additions and 66 deletions

View file

@ -17,6 +17,7 @@ extern crate devtools_traits;
extern crate euclid;
extern crate gfx_traits;
extern crate heapsize;
extern crate hyper;
extern crate hyper_serde;
extern crate ipc_channel;
extern crate libc;
@ -46,9 +47,11 @@ use gfx_traits::DevicePixel;
use gfx_traits::Epoch;
use gfx_traits::StackingContextId;
use heapsize::HeapSizeOf;
use hyper::header::Headers;
use hyper::method::Method;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::c_void;
use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState};
use msg::constellation_msg::{PipelineId, PipelineNamespaceId, ReferrerPolicy};
use msg::constellation_msg::{TraversalDirection, WindowSizeType};
use net_traits::{LoadOrigin, ResourceThreads};
@ -119,6 +122,43 @@ pub enum LayoutControlMsg {
GetWebFontLoadState(IpcSender<bool>),
}
/// Similar to net::resource_thread::LoadData
/// can be passed to LoadUrl to load a page with GET/POST
/// parameters or headers
#[derive(Clone, Deserialize, Serialize)]
pub struct LoadData {
/// The URL.
pub url: Url,
/// The method.
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
pub method: Method,
/// The headers.
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
pub headers: Headers,
/// The data.
pub data: Option<Vec<u8>>,
/// The referrer policy.
pub referrer_policy: Option<ReferrerPolicy>,
/// The referrer URL.
pub referrer_url: Option<Url>,
}
impl LoadData {
/// Create a new `LoadData` object.
pub fn new(url: Url, referrer_policy: Option<ReferrerPolicy>, referrer_url: Option<Url>) -> LoadData {
LoadData {
url: url,
method: Method::Get,
headers: Headers::new(),
data: None,
referrer_policy: referrer_policy,
referrer_url: referrer_url,
}
}
}
/// The initial data associated with a newly-created framed pipeline.
#[derive(Deserialize, Serialize)]
pub struct NewLayoutInfo {