Repository navigation
Description
Right now the engine is responsible for making UI appear to allow the user to choose an input file:
servo/components/net/filemanager_thread.rs
Lines 39 to 67 in 34f3882
| fn open_file_dialog(&self, path: &str, patterns: Vec<FilterPattern>) -> Option<String> { | |
| 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::<Vec<&str>>()[..]); | |
| 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<FilterPattern>) -> Option<Vec<String>> { | |
| if opts::get().headless { | |
| return None; | |
| } | |
| let mut filter = vec![]; | |
| for p in patterns { | |
| let s = "*.".to_string() + &p.0; | |
| filter.push(s) | |
| } |
Instead, the network code should send a message to the constellation, which can talk to the embedder and receive the final selection to return to the network code. This means the FileManager needs to have access to a channel which can communicate with the constellation; this can come from CoreResourceManager::new via new_resource_threads. This is a good model for communicating with the embedder from the constellation.
To test this code, verify that it's possible to submit an HTML form that includes a <input type="select"> element after choosing a file.
Activity
kwonoj commentedon Mar 25, 2018
@jdm mind if I try to give a shot for this?
jdm commentedon Mar 25, 2018
Go for it!
kwonoj commentedon Mar 25, 2018
🙇♂️ @highfive assign me
highfive commentedon Mar 25, 2018
It looks like this has already been assigned to someone. I'll leave the decision to a core contributor.
Auto merge of #20480 - kwonoj:refactor-file-manager, r=paulrouget
Auto merge of #20480 - kwonoj:refactor-file-manager, r=paulrouget
Auto merge of #20480 - kwonoj:refactor-file-manager, r=paulrouget
Auto merge of #20480 - kwonoj:refactor-file-manager, r=paulrouget
Auto merge of #20480 - kwonoj:refactor-file-manager, r=paulrouget
Auto merge of #20480 - kwonoj:refactor-file-manager, r=paulrouget
Auto merge of #20480 - kwonoj:refactor-file-manager, r=paulrouget