aboutsummaryrefslogtreecommitdiffstats
path: root/components/net_traits/filemanager_thread.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-05-23 01:10:46 -0700
committerbors-servo <lbergstrom+bors@mozilla.com>2016-05-23 01:10:46 -0700
commit7cea4eb01ce3b84ca276ca417d933fb122005b51 (patch)
tree3b408b5ee27733159e8ce8b54dfc09838ebbfc17 /components/net_traits/filemanager_thread.rs
parentaa9fc4e0549c54fafef358a50f32f520c9014ba6 (diff)
parentdd590d088b036e06dd5775237e04ac45de3b1488 (diff)
downloadservo-7cea4eb01ce3b84ca276ca417d933fb122005b51.tar.gz
servo-7cea4eb01ce3b84ca276ca417d933fb122005b51.zip
Auto merge of #11225 - izgzhen:patch-input-element-file, r=Manishearth
Implement file related functionalities in htmlinputelement and related - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy --faster` does not report any errors - [x] These changes is related to #11131 - [x] These changes do not require tests because it is a partial implementation 1. Improve the `filemanager_thread` by adding type string and create `SelectedFile` 2. Fill several gaps in `htmlinputelement` implementation related to file type 3. Improve the `File` interface to accommodate the above changes 4. Integrate changes introduced by PR #11189 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11225) <!-- Reviewable:end -->
Diffstat (limited to 'components/net_traits/filemanager_thread.rs')
-rw-r--r--components/net_traits/filemanager_thread.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/components/net_traits/filemanager_thread.rs b/components/net_traits/filemanager_thread.rs
index dfc2d6a5615..ee4fdb291cf 100644
--- a/components/net_traits/filemanager_thread.rs
+++ b/components/net_traits/filemanager_thread.rs
@@ -7,12 +7,21 @@ use std::path::PathBuf;
use uuid::Uuid;
#[derive(Deserialize, Serialize)]
+pub struct SelectedFile {
+ pub id: Uuid,
+ pub filename: PathBuf,
+ pub modified: u64,
+ // https://w3c.github.io/FileAPI/#dfn-type
+ pub type_string: String,
+}
+
+#[derive(Deserialize, Serialize)]
pub enum FileManagerThreadMsg {
/// Select a single file, return triple (FileID, FileName, lastModified)
- SelectFile(IpcSender<FileManagerResult<(Uuid, PathBuf, u64)>>),
+ SelectFile(IpcSender<FileManagerResult<SelectedFile>>),
/// Select multiple files, return a vector of triples
- SelectFiles(IpcSender<FileManagerResult<Vec<(Uuid, PathBuf, u64)>>>),
+ SelectFiles(IpcSender<FileManagerResult<Vec<SelectedFile>>>),
/// Read file, return the bytes
ReadFile(IpcSender<FileManagerResult<Vec<u8>>>, Uuid),
@@ -23,7 +32,7 @@ pub enum FileManagerThreadMsg {
pub type FileManagerResult<T> = Result<T, FileManagerThreadError>;
-#[derive(Deserialize, Serialize)]
+#[derive(Debug, Deserialize, Serialize)]
pub enum FileManagerThreadError {
/// The selection action is invalid, nothing is selected
InvalidSelection,