|
Lines 29-36
a/Source/WebCore/platform/FileChooser.cpp_sec1
|
| 29 |
#include "config.h" |
29 |
#include "config.h" |
| 30 |
#include "FileChooser.h" |
30 |
#include "FileChooser.h" |
| 31 |
|
31 |
|
|
|
32 |
#include "HTMLNames.h" |
| 33 |
#include "MIMETypeRegistry.h" |
| 34 |
|
| 32 |
namespace WebCore { |
35 |
namespace WebCore { |
| 33 |
|
36 |
|
|
|
37 |
using namespace HTMLNames; |
| 38 |
|
| 34 |
FileChooserClient::~FileChooserClient() |
39 |
FileChooserClient::~FileChooserClient() |
| 35 |
{ |
40 |
{ |
| 36 |
discardChooser(); |
41 |
discardChooser(); |
|
Lines 50-60
void FileChooserClient::discardChooser()
a/Source/WebCore/platform/FileChooser.cpp_sec2
|
| 50 |
m_chooser->disconnectClient(); |
55 |
m_chooser->disconnectClient(); |
| 51 |
} |
56 |
} |
| 52 |
|
57 |
|
| 53 |
inline FileChooser::FileChooser(FileChooserClient* client, const FileChooserSettings& settings) |
58 |
#if ENABLE(HTML_MEDIA_CAPTURE) |
| 54 |
: m_client(client) |
59 |
MediaCaptureChooser* FileChooserClient::newMediaCaptureChooser(const FileChooserSettings& settings, MediaCaptureType device) |
| 55 |
, m_settings(settings) |
60 |
{ |
|
|
61 |
discardChooser(); |
| 62 |
|
| 63 |
m_chooser = MediaCaptureChooser::create(this, settings, device); |
| 64 |
return static_cast<MediaCaptureChooser*>(m_chooser.get()); |
| 65 |
} |
| 66 |
|
| 67 |
MediaCaptureType FileChooserClient::determineCaptureType(HTMLInputElement* input) |
| 56 |
{ |
68 |
{ |
|
|
69 |
if (!input) |
| 70 |
return FileSystem; |
| 71 |
|
| 72 |
if (equalIgnoringCase(input->capture(), MediaCaptureNames::camera())) { |
| 73 |
for (Vector<String>::const_iterator iterator = input->acceptMIMETypes().begin(); iterator != input->acceptMIMETypes().end(); ++iterator) |
| 74 |
if ((*iterator).startsWith("image/") && MIMETypeRegistry::isSupportedCaptureMIMEType(*iterator)) |
| 75 |
return Camera; |
| 76 |
} else if (equalIgnoringCase(input->capture(), MediaCaptureNames::camcorder())) { |
| 77 |
for (Vector<String>::const_iterator iterator = input->acceptMIMETypes().begin(); iterator != input->acceptMIMETypes().end(); ++iterator) |
| 78 |
if ((*iterator).startsWith("video/") && MIMETypeRegistry::isSupportedCaptureMIMEType(*iterator)) |
| 79 |
return Camcorder; |
| 80 |
} else if (equalIgnoringCase(input->capture(), MediaCaptureNames::microphone())) { |
| 81 |
for (Vector<String>::const_iterator iterator = input->acceptMIMETypes().begin(); iterator != input->acceptMIMETypes().end(); ++iterator) |
| 82 |
if ((*iterator).startsWith("audio/") && MIMETypeRegistry::isSupportedCaptureMIMEType(*iterator)) |
| 83 |
return Microphone; |
| 84 |
} |
| 85 |
return FileSystem; |
| 57 |
} |
86 |
} |
|
|
87 |
#endif |
| 58 |
|
88 |
|
| 59 |
PassRefPtr<FileChooser> FileChooser::create(FileChooserClient* client, const FileChooserSettings& settings) |
89 |
PassRefPtr<FileChooser> FileChooser::create(FileChooserClient* client, const FileChooserSettings& settings) |
| 60 |
{ |
90 |
{ |
|
Lines 82-85
void FileChooser::chooseFiles(const Vector<String>& filenames)
a/Source/WebCore/platform/FileChooser.cpp_sec3
|
| 82 |
m_client->filesChosen(filenames); |
112 |
m_client->filesChosen(filenames); |
| 83 |
} |
113 |
} |
| 84 |
|
114 |
|
|
|
115 |
#if ENABLE(HTML_MEDIA_CAPTURE) |
| 116 |
|
| 117 |
PassRefPtr<MediaCaptureChooser> MediaCaptureChooser::create(FileChooserClient* client, const FileChooserSettings& settings, MediaCaptureType type) |
| 118 |
{ |
| 119 |
return adoptRef(new MediaCaptureChooser(client, settings, type)); |
| 120 |
} |
| 121 |
|
| 122 |
MediaCaptureChooser::~MediaCaptureChooser() |
| 123 |
{ |
| 124 |
} |
| 125 |
|
| 126 |
namespace MediaCaptureNames { |
| 127 |
|
| 128 |
const AtomicString& camera() |
| 129 |
{ |
| 130 |
DEFINE_STATIC_LOCAL(AtomicString, name, ("camera")); |
| 131 |
return name; |
| 132 |
} |
| 133 |
|
| 134 |
const AtomicString& camcorder() |
| 135 |
{ |
| 136 |
DEFINE_STATIC_LOCAL(AtomicString, name, ("camcorder")); |
| 137 |
return name; |
| 138 |
} |
| 139 |
|
| 140 |
const AtomicString& microphone() |
| 141 |
{ |
| 142 |
DEFINE_STATIC_LOCAL(AtomicString, name, ("microphone")); |
| 143 |
return name; |
| 144 |
} |
| 145 |
|
| 146 |
const AtomicString& filesystem() |
| 147 |
{ |
| 148 |
DEFINE_STATIC_LOCAL(AtomicString, name, ("filesystem")); |
| 149 |
return name; |
| 150 |
} |
| 151 |
|
| 152 |
} // namespace WebCore::MediaCaptureNames |
| 153 |
|
| 154 |
#endif |
| 155 |
|
| 85 |
} |
156 |
} |