OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "platform/FileMetadata.h" | 33 #include "platform/FileMetadata.h" |
34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
35 #include "platform/weborigin/KURL.h" | 35 #include "platform/weborigin/KURL.h" |
36 #include "platform/wtf/Allocator.h" | 36 #include "platform/wtf/Allocator.h" |
37 #include "platform/wtf/RefCounted.h" | 37 #include "platform/wtf/RefCounted.h" |
38 #include "platform/wtf/Vector.h" | 38 #include "platform/wtf/Vector.h" |
39 #include "platform/wtf/text/WTFString.h" | 39 #include "platform/wtf/text/WTFString.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
| 43 // https://w3c.github.io/html-media-capture/#dom-capturefacingmode |
| 44 enum CaptureFacingMode { CaptureFacingModeUser, CaptureFacingModeEnvironment }; |
| 45 |
43 class FileChooser; | 46 class FileChooser; |
44 | 47 |
45 struct FileChooserFileInfo { | 48 struct FileChooserFileInfo { |
46 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 49 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
47 FileChooserFileInfo(const String& path, const String& display_name = String()) | 50 FileChooserFileInfo(const String& path, const String& display_name = String()) |
48 : path(path), display_name(display_name) {} | 51 : path(path), display_name(display_name) {} |
49 | 52 |
50 FileChooserFileInfo(const KURL& file_system_url, const FileMetadata metadata) | 53 FileChooserFileInfo(const KURL& file_system_url, const FileMetadata metadata) |
51 : file_system_url(file_system_url), metadata(metadata) {} | 54 : file_system_url(file_system_url), metadata(metadata) {} |
52 | 55 |
53 // Members for native files. | 56 // Members for native files. |
54 const String path; | 57 const String path; |
55 const String display_name; | 58 const String display_name; |
56 | 59 |
57 // Members for file system API files. | 60 // Members for file system API files. |
58 const KURL file_system_url; | 61 const KURL file_system_url; |
59 const FileMetadata metadata; | 62 const FileMetadata metadata; |
60 }; | 63 }; |
61 | 64 |
62 struct FileChooserSettings { | 65 struct FileChooserSettings { |
63 DISALLOW_NEW(); | 66 DISALLOW_NEW(); |
64 bool allows_multiple_files; | 67 bool allows_multiple_files; |
65 bool allows_directory_upload; | 68 bool allows_directory_upload; |
66 Vector<String> accept_mime_types; | 69 Vector<String> accept_mime_types; |
67 Vector<String> accept_file_extensions; | 70 Vector<String> accept_file_extensions; |
68 Vector<String> selected_files; | 71 Vector<String> selected_files; |
69 bool use_media_capture; | 72 bool use_media_capture; |
| 73 CaptureFacingMode capture; |
70 | 74 |
71 // Returns a combined vector of acceptMIMETypes and acceptFileExtensions. | 75 // Returns a combined vector of acceptMIMETypes and acceptFileExtensions. |
72 Vector<String> PLATFORM_EXPORT AcceptTypes() const; | 76 Vector<String> PLATFORM_EXPORT AcceptTypes() const; |
73 }; | 77 }; |
74 | 78 |
75 class PLATFORM_EXPORT FileChooserClient { | 79 class PLATFORM_EXPORT FileChooserClient { |
76 public: | 80 public: |
77 virtual void FilesChosen(const Vector<FileChooserFileInfo>&) = 0; | 81 virtual void FilesChosen(const Vector<FileChooserFileInfo>&) = 0; |
78 virtual ~FileChooserClient(); | 82 virtual ~FileChooserClient(); |
79 | 83 |
(...skipping 23 matching lines...) Expand all Loading... |
103 private: | 107 private: |
104 FileChooser(FileChooserClient*, const FileChooserSettings&); | 108 FileChooser(FileChooserClient*, const FileChooserSettings&); |
105 | 109 |
106 FileChooserClient* client_; | 110 FileChooserClient* client_; |
107 FileChooserSettings settings_; | 111 FileChooserSettings settings_; |
108 }; | 112 }; |
109 | 113 |
110 } // namespace blink | 114 } // namespace blink |
111 | 115 |
112 #endif // FileChooser_h | 116 #endif // FileChooser_h |
OLD | NEW |