diff --git a/Cargo.lock b/Cargo.lock index d2c1c8c77bd..f8b982fcc0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1920,7 +1920,6 @@ dependencies = [ "servo_url 0.0.1", "threadpool 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", - "tinyfiledialogs 3.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/net/Cargo.toml b/components/net/Cargo.toml index 5e747577ada..7f1c402a4c0 100644 --- a/components/net/Cargo.toml +++ b/components/net/Cargo.toml @@ -49,9 +49,6 @@ url = "1.2" uuid = {version = "0.6", features = ["v4"]} webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} -[target.'cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))'.dependencies] -tinyfiledialogs = "3.0" - [[test]] name = "main" path = "tests/main.rs" diff --git a/components/net/filemanager_thread.rs b/components/net/filemanager_thread.rs index bc433895ba9..97807f3f01e 100644 --- a/components/net/filemanager_thread.rs +++ b/components/net/filemanager_thread.rs @@ -21,71 +21,9 @@ use std::sync::atomic::{self, AtomicBool, AtomicUsize, Ordering}; use std::sync::mpsc::Sender; use std::thread; #[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] -use tinyfiledialogs; use url::Url; use uuid::Uuid; -/// The provider of file-dialog UI should implement this trait. -/// It will be used to initialize a generic FileManager. -/// For example, we can choose a dummy UI for testing purpose. -pub trait UIProvider where Self: Sync { - fn open_file_dialog(&self, path: &str, patterns: Vec) -> Option; - - fn open_file_dialog_multi(&self, path: &str, patterns: Vec) -> Option>; -} - -pub struct TFDProvider; - -impl UIProvider for TFDProvider { - #[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] - fn open_file_dialog(&self, path: &str, patterns: Vec) -> Option { - if opts::get().headless { - return None; - } - - let mut filter = vec![]; - for p in patterns { - let s = "*.".to_string() + &p.0; - filter.push(s) - } - - let filter_ref = &(filter.iter().map(|s| s.as_str()).collect::>()[..]); - - let filter_opt = if filter.len() > 0 { Some((filter_ref, "")) } else { None }; - - tinyfiledialogs::open_file_dialog("Pick a file", path, filter_opt) - } - - #[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] - fn open_file_dialog_multi(&self, path: &str, patterns: Vec) -> Option> { - if opts::get().headless { - return None; - } - - let mut filter = vec![]; - for p in patterns { - let s = "*.".to_string() + &p.0; - filter.push(s) - } - - let filter_ref = &(filter.iter().map(|s| s.as_str()).collect::>()[..]); - - let filter_opt = if filter.len() > 0 { Some((filter_ref, "")) } else { None }; - - tinyfiledialogs::open_file_dialog_multi("Pick files", path, filter_opt) - } - - #[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))] - fn open_file_dialog(&self, _path: &str, _patterns: Vec) -> Option { - None - } - - #[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))] - fn open_file_dialog_multi(&self, _path: &str, _patterns: Vec) -> Option> { - None - } -} - /// FileManagerStore's entry struct FileStoreEntry { /// Origin of the entry's "creator" diff --git a/components/net/lib.rs b/components/net/lib.rs index 1e17fd0988d..6bfde683494 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -37,8 +37,6 @@ extern crate servo_arc; extern crate servo_config; extern crate servo_url; extern crate time; -#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] -extern crate tinyfiledialogs; extern crate unicase; extern crate url; extern crate uuid; diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs index fce89fd6624..6030f30dea4 100644 --- a/components/net/resource_thread.rs +++ b/components/net/resource_thread.rs @@ -11,7 +11,7 @@ use devtools_traits::DevtoolsControlMsg; use embedder_traits::resources::{self, Resource}; use fetch::cors_cache::CorsCache; use fetch::methods::{CancellationListener, FetchContext, fetch}; -use filemanager_thread::{FileManager, TFDProvider}; +use filemanager_thread::FileManager; use hsts::HstsList; use http_cache::HttpCache; use http_loader::{HttpState, http_redirect_fetch}; @@ -47,8 +47,6 @@ use std::thread; use storage_thread::StorageThreadFactory; use websocket_loader; -const TFD_PROVIDER: &'static TFDProvider = &TFDProvider; - /// Returns a tuple of (public, private) senders to the new threads. pub fn new_resource_threads(user_agent: Cow<'static, str>, devtools_chan: Option>,