Commit 3c9177a1 authored by dglazkov@chromium.org's avatar dglazkov@chromium.org
Browse files

2011-06-20 Dimitri Glazkov <dglazkov@chromium.org>

        Reviewed by Kent Tamura.

        FileChooser should be only created when we need to choose files.
        https://bugs.webkit.org/show_bug.cgi?id=63039

        1) Introduce FileChooserSettings to decouple setting querying from
        FileChooser. It's a simple copyable settings object, which allows us
        to capture the settings atomically and treat them as discardable data.

        2) Encapsulate lifetime management of FileChooser entirely in
        FileChooserClient. It's now a "smart" client, and allows us to
        completely remove FileChooser management concerns from a FileChooserClient
        implementor.

        3) Change creation of FileChooser to be on-demand, only when we actually
        need to choose file.

        4) Rearrange calling of dispatchFormControlChangeEvent to be at the end
        of a function and remove "am-I-dead" checks that are now unnecessary.

        5) Clean up directory upload code a bit, and make use of FileChooserSettings
        to pass directory name.

        Refactoring, covered by existing tests.

        * WebCore.exp.in: Removed unneeded export.
        * loader/EmptyClients.h: Removed now-unneded param.
        (WebCore::EmptyChromeClient::enumerateChosenDirectory): Ditto.
        * page/Chrome.cpp:
        (WebCore::Chrome::enumerateChosenDirectory): Ditto.
        * page/Chrome.h: Ditto.
        * page/ChromeClient.h: Ditto.
        * platform/FileChooser.cpp:
        (WebCore::FileChooserClient::~FileChooserClient): Added discarding of chooser.
        (WebCore::FileChooserClient::newFileChooser): Added.
        (WebCore::FileChooserClient::discardChooser): Added.
        (WebCore::FileChooser::FileChooser): Changed to use FileChooserSettings.
        (WebCore::FileChooser::create): Ditto.
        (WebCore::FileChooser::~FileChooser): Removed unneeded code.
        (WebCore::FileChooser::chooseFiles): Changed to pass results to the client.
        * platform/FileChooser.h:
        (WebCore::FileChooser::settings): Added.
        * rendering/RenderFileUploadControl.cpp:
        (WebCore::filenamesFromFileList): Added a helper.
        (WebCore::RenderFileUploadControl::RenderFileUploadControl): Changed to use the helper, removed
            chooser initialization code.
        (WebCore::RenderFileUploadControl::~RenderFileUploadControl): Removed disconnection code, now
            handled in FileChooserClient.
        (WebCore::RenderFileUploadControl::filesChosen): Renamed from valueChanged, rearranged to
            fire dispatchFormControlChangeEvent last.
        (WebCore::RenderFileUploadControl::receiveDropForDirectoryUpload): Changed to use settings.
        (WebCore::RenderFileUploadControl::click): Ditto.
        (WebCore::RenderFileUploadControl::updateFromElement): Removed now-unneeded check.
        (WebCore::RenderFileUploadControl::receiveDroppedFiles): Changed to avoid using the chooser, since
            it is not necessary.
        (WebCore::RenderFileUploadControl::fileTextValue): Changed to use input data, not chooser data.
        * rendering/RenderFileUploadControl.h: Updated decls.
2011-06-20  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Kent Tamura.

        FileChooser should be only created when we need to choose files.
        https://bugs.webkit.org/show_bug.cgi?id=63039

        * src/ChromeClientImpl.cpp:
        (WebKit::ChromeClientImpl::runOpenPanel): Changed to use settings.
        (WebKit::ChromeClientImpl::enumerateChosenDirectory): Updated decls.
        * src/ChromeClientImpl.h:
2011-06-20  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Kent Tamura.

        FileChooser should be only created when we need to choose files.
        https://bugs.webkit.org/show_bug.cgi?id=63039

        * WebCoreSupport/ChromeClientEfl.cpp:
        (WebCore::ChromeClientEfl::runOpenPanel): Changed to use settings.
2011-06-20  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Kent Tamura.

        FileChooser should be only created when we need to choose files.
        https://bugs.webkit.org/show_bug.cgi?id=63039

        * WebCoreSupport/ChromeClientGtk.cpp:
        (WebKit::ChromeClient::runOpenPanel): Changed to use settings.
2011-06-20  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Kent Tamura.

        FileChooser should be only created when we need to choose files.
        https://bugs.webkit.org/show_bug.cgi?id=63039

        * WebCoreSupport/WebChromeClient.mm:
        (WebChromeClient::runOpenPanel): Changed to use settings.
2011-06-20  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Kent Tamura.

        FileChooser should be only created when we need to choose files.
        https://bugs.webkit.org/show_bug.cgi?id=63039

        * WebCoreSupport/ChromeClientQt.cpp:
        (WebCore::ChromeClientQt::runOpenPanel): Changed to use settings.
2011-06-20  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Kent Tamura.

        FileChooser should be only created when we need to choose files.
        https://bugs.webkit.org/show_bug.cgi?id=63039

        * WebCoreSupport/WebChromeClient.cpp:
        (WebChromeClient::runOpenPanel): Changed to use settings.
2011-06-20  Dimitri Glazkov  <dglazkov@chromium.org>

        Reviewed by Kent Tamura.

        FileChooser should be only created when we need to choose files.
        https://bugs.webkit.org/show_bug.cgi?id=63039

        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
        (WebKit::WebChromeClient::runOpenPanel): Changed to use settings.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@89430 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 06cf5773
2011-06-20 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Kent Tamura.
FileChooser should be only created when we need to choose files.
https://bugs.webkit.org/show_bug.cgi?id=63039
1) Introduce FileChooserSettings to decouple setting querying from
FileChooser. It's a simple copyable settings object, which allows us
to capture the settings atomically and treat them as discardable data.
2) Encapsulate lifetime management of FileChooser entirely in
FileChooserClient. It's now a "smart" client, and allows us to
completely remove FileChooser management concerns from a FileChooserClient
implementor.
3) Change creation of FileChooser to be on-demand, only when we actually
need to choose file.
4) Rearrange calling of dispatchFormControlChangeEvent to be at the end
of a function and remove "am-I-dead" checks that are now unnecessary.
5) Clean up directory upload code a bit, and make use of FileChooserSettings
to pass directory name.
Refactoring, covered by existing tests.
* WebCore.exp.in: Removed unneeded export.
* loader/EmptyClients.h: Removed now-unneded param.
(WebCore::EmptyChromeClient::enumerateChosenDirectory): Ditto.
* page/Chrome.cpp:
(WebCore::Chrome::enumerateChosenDirectory): Ditto.
* page/Chrome.h: Ditto.
* page/ChromeClient.h: Ditto.
* platform/FileChooser.cpp:
(WebCore::FileChooserClient::~FileChooserClient): Added discarding of chooser.
(WebCore::FileChooserClient::newFileChooser): Added.
(WebCore::FileChooserClient::discardChooser): Added.
(WebCore::FileChooser::FileChooser): Changed to use FileChooserSettings.
(WebCore::FileChooser::create): Ditto.
(WebCore::FileChooser::~FileChooser): Removed unneeded code.
(WebCore::FileChooser::chooseFiles): Changed to pass results to the client.
* platform/FileChooser.h:
(WebCore::FileChooser::settings): Added.
* rendering/RenderFileUploadControl.cpp:
(WebCore::filenamesFromFileList): Added a helper.
(WebCore::RenderFileUploadControl::RenderFileUploadControl): Changed to use the helper, removed
chooser initialization code.
(WebCore::RenderFileUploadControl::~RenderFileUploadControl): Removed disconnection code, now
handled in FileChooserClient.
(WebCore::RenderFileUploadControl::filesChosen): Renamed from valueChanged, rearranged to
fire dispatchFormControlChangeEvent last.
(WebCore::RenderFileUploadControl::receiveDropForDirectoryUpload): Changed to use settings.
(WebCore::RenderFileUploadControl::click): Ditto.
(WebCore::RenderFileUploadControl::updateFromElement): Removed now-unneeded check.
(WebCore::RenderFileUploadControl::receiveDroppedFiles): Changed to avoid using the chooser, since
it is not necessary.
(WebCore::RenderFileUploadControl::fileTextValue): Changed to use input data, not chooser data.
* rendering/RenderFileUploadControl.h: Updated decls.
2011-06-22 Pavel Feldman <pfeldman@google.com>
 
Reviewed by Yury Semikhatsky.
......
......@@ -1327,7 +1327,6 @@ __ZNK7WebCore9PageCache21autoreleasedPageCountEv
__ZTVN7WebCore12ChromeClientE
__ZTVN7WebCore12JSDOMWrapperE
__ZTVN7WebCore16IconDatabaseBaseE
__ZTVN7WebCore17FileChooserClientE
__ZTVN7WebCore17FrameLoaderClientE
__ZTVN7WebCore18PlatformStrategiesE
__ZTVN7WebCore25HistoryPropertyListWriterE
......
......@@ -193,7 +193,7 @@ public:
#endif
#if ENABLE(DIRECTORY_UPLOAD)
virtual void enumerateChosenDirectory(const String&, FileChooser*) { }
virtual void enumerateChosenDirectory(FileChooser*) { }
#endif
virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>) { }
......
......@@ -453,9 +453,9 @@ void Chrome::cancelGeolocationPermissionRequestForFrame(Frame* frame, Geolocatio
}
#if ENABLE(DIRECTORY_UPLOAD)
void Chrome::enumerateChosenDirectory(const String& path, FileChooser* fileChooser)
void Chrome::enumerateChosenDirectory(FileChooser* fileChooser)
{
m_client->enumerateChosenDirectory(path, fileChooser);
m_client->enumerateChosenDirectory(fileChooser);
}
#endif
......
......@@ -155,7 +155,7 @@ namespace WebCore {
void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
void loadIconForFiles(const Vector<String>&, FileIconLoader*);
#if ENABLE(DIRECTORY_UPLOAD)
void enumerateChosenDirectory(const String&, FileChooser*);
void enumerateChosenDirectory(FileChooser*);
#endif
void dispatchViewportDataDidChange(const ViewportArguments&) const;
......
......@@ -231,7 +231,7 @@ namespace WebCore {
#if ENABLE(DIRECTORY_UPLOAD)
// Asychronous request to enumerate all files in a directory chosen by the user.
virtual void enumerateChosenDirectory(const String&, FileChooser*) = 0;
virtual void enumerateChosenDirectory(FileChooser*) = 0;
#endif
// Notification that the given form element has changed. This function
......
......@@ -33,26 +33,36 @@ namespace WebCore {
FileChooserClient::~FileChooserClient()
{
discardChooser();
}
inline FileChooser::FileChooser(FileChooserClient* client, const Vector<String>& initialFilenames)
: m_client(client)
FileChooser* FileChooserClient::newFileChooser(const FileChooserSettings& settings)
{
m_filenames = initialFilenames;
discardChooser();
m_chooser = FileChooser::create(this, settings);
return m_chooser.get();
}
PassRefPtr<FileChooser> FileChooser::create(FileChooserClient* client, const Vector<String>& initialFilenames)
void FileChooserClient::discardChooser()
{
return adoptRef(new FileChooser(client, initialFilenames));
if (m_chooser)
m_chooser->disconnectClient();
}
FileChooser::~FileChooser()
inline FileChooser::FileChooser(FileChooserClient* client, const FileChooserSettings& settings)
: m_client(client)
, m_settings(settings)
{
}
void FileChooser::clear()
PassRefPtr<FileChooser> FileChooser::create(FileChooserClient* client, const FileChooserSettings& settings)
{
return adoptRef(new FileChooser(client, settings));
}
FileChooser::~FileChooser()
{
m_filenames.clear();
}
void FileChooser::chooseFile(const String& filename)
......@@ -64,11 +74,12 @@ void FileChooser::chooseFile(const String& filename)
void FileChooser::chooseFiles(const Vector<String>& filenames)
{
if (m_filenames == filenames)
// FIXME: This is inelegant. We should not be looking at settings here.
if (m_settings.selectedFiles == filenames)
return;
m_filenames = filenames;
if (m_client)
m_client->valueChanged();
m_client->filesChosen(filenames);
}
}
......@@ -37,44 +37,46 @@ namespace WebCore {
class FileChooser;
class FileChooserClient {
public:
virtual void valueChanged() = 0;
virtual bool allowsMultipleFiles() = 0;
struct FileChooserSettings {
bool allowsMultipleFiles;
#if ENABLE(DIRECTORY_UPLOAD)
virtual bool allowsDirectoryUpload() = 0;
bool allowsDirectoryUpload;
#endif
virtual String acceptTypes() = 0;
String acceptTypes;
Vector<String> selectedFiles;
};
class FileChooserClient {
public:
virtual void filesChosen(const Vector<String>&) = 0;
virtual ~FileChooserClient();
protected:
FileChooser* newFileChooser(const FileChooserSettings&);
private:
void discardChooser();
RefPtr<FileChooser> m_chooser;
};
class FileChooser : public RefCounted<FileChooser> {
public:
static PassRefPtr<FileChooser> create(FileChooserClient*, const Vector<String>& initialFilenames);
static PassRefPtr<FileChooser> create(FileChooserClient*, const FileChooserSettings&);
~FileChooser();
void disconnectClient() { m_client = 0; }
bool disconnected() { return !m_client; }
const Vector<String>& filenames() const { return m_filenames; }
void clear(); // for use by client; does not call valueChanged
void chooseFile(const String& path);
void chooseFiles(const Vector<String>& paths);
bool allowsMultipleFiles() const { return m_client ? m_client->allowsMultipleFiles() : false; }
#if ENABLE(DIRECTORY_UPLOAD)
bool allowsDirectoryUpload() const { return m_client ? m_client->allowsDirectoryUpload() : false; }
#endif
// Acceptable MIME types. It's an 'accept' attribute value of the corresponding INPUT element.
String acceptTypes() const { return m_client ? m_client->acceptTypes() : String(); }
const FileChooserSettings& settings() const { return m_settings; }
private:
FileChooser(FileChooserClient*, const Vector<String>& initialFilenames);
FileChooser(FileChooserClient*, const FileChooserSettings&);
FileChooserClient* m_client;
Vector<String> m_filenames;
FileChooserSettings m_settings;
};
} // namespace WebCore
......
......@@ -54,23 +54,25 @@ const int iconFilenameSpacing = 2;
const int defaultWidthNumChars = 34;
const int buttonShadowHeight = 2;
static void filenamesFromFileList(const FileList* list, Vector<String>& filenames)
{
unsigned length = list ? list->length() : 0;
for (unsigned i = 0; i < length; ++i)
filenames.append(list->item(i)->path());
}
RenderFileUploadControl::RenderFileUploadControl(HTMLInputElement* input)
: RenderBlock(input)
, m_iconLoader(FileIconLoader::create(this))
{
FileList* list = input->files();
Vector<String> filenames;
unsigned length = list ? list->length() : 0;
for (unsigned i = 0; i < length; ++i)
filenames.append(list->item(i)->path());
m_fileChooser = FileChooser::create(this, filenames);
filenamesFromFileList(input->files(), filenames);
requestIcon(filenames);
}
RenderFileUploadControl::~RenderFileUploadControl()
{
m_iconLoader->disconnectClient();
m_fileChooser->disconnectClient();
}
void RenderFileUploadControl::requestIcon(const Vector<String>& filenames) const
......@@ -82,50 +84,30 @@ void RenderFileUploadControl::requestIcon(const Vector<String>& filenames) const
chrome->loadIconForFiles(filenames, m_iconLoader.get());
}
void RenderFileUploadControl::valueChanged()
void RenderFileUploadControl::filesChosen(const Vector<String>& filenames)
{
// dispatchFormControlChangeEvent may destroy this renderer
RefPtr<FileChooser> fileChooser = m_fileChooser;
HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(node());
inputElement->setFileListFromRenderer(fileChooser->filenames());
inputElement->dispatchFormControlChangeEvent();
if (fileChooser->disconnected())
return;
inputElement->setFileListFromRenderer(filenames);
requestIcon(filenames);
requestIcon(fileChooser->filenames());
repaint();
}
bool RenderFileUploadControl::allowsMultipleFiles()
{
#if ENABLE(DIRECTORY_UPLOAD)
if (allowsDirectoryUpload())
return true;
#endif
HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
return input->fastHasAttribute(multipleAttr);
// This call may cause destruction of this instance and thus must always be last in the function.
inputElement->dispatchFormControlChangeEvent();
}
#if ENABLE(DIRECTORY_UPLOAD)
bool RenderFileUploadControl::allowsDirectoryUpload()
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
return input->fastHasAttribute(webkitdirectoryAttr);
}
void RenderFileUploadControl::receiveDropForDirectoryUpload(const Vector<String>& paths)
{
if (Chrome* chrome = this->chrome())
chrome->enumerateChosenDirectory(paths[0], m_fileChooser.get());
if (Chrome* chrome = this->chrome()) {
FileChooserSettings settings;
settings.allowsDirectoryUpload = true;
settings.allowsMultipleFiles = true;
settings.selectedFiles.append(paths[0]);
chrome->enumerateChosenDirectory(newFileChooser(settings));
}
}
#endif
String RenderFileUploadControl::acceptTypes()
{
return static_cast<HTMLInputElement*>(node())->accept();
}
void RenderFileUploadControl::updateRendering(PassRefPtr<Icon> icon)
{
......@@ -140,8 +122,20 @@ void RenderFileUploadControl::click()
{
if (!ScriptController::processingUserGesture())
return;
if (Chrome* chrome = this->chrome())
chrome->runOpenPanel(frame(), m_fileChooser);
if (Chrome* chrome = this->chrome()) {
FileChooserSettings settings;
HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
#if ENABLE(DIRECTORY_UPLOAD)
settings.allowsDirectoryUpload = input->fastHasAttribute(webkitdirectoryAttr);
settings.allowsMultipleFiles = settings.allowsDirectoryUpload || input->fastHasAttribute(multipleAttr);
#else
settings.allowsMultipleFiles = input->fastHasAttribute(multipleAttr);
#endif
settings.acceptTypes = input->accept();
filenamesFromFileList(input->files(), settings.selectedFiles);
chrome->runOpenPanel(frame(), newFileChooser(settings));
}
}
Chrome* RenderFileUploadControl::chrome() const
......@@ -168,8 +162,7 @@ void RenderFileUploadControl::updateFromElement()
// security reasons that's the only change the DOM is allowed to make.
FileList* files = inputElement->files();
ASSERT(files);
if (files && files->isEmpty() && !m_fileChooser->filenames().isEmpty()) {
m_fileChooser->clear();
if (files && files->isEmpty() && m_icon) {
m_icon = 0;
repaint();
}
......@@ -308,17 +301,21 @@ HTMLInputElement* RenderFileUploadControl::uploadButton() const
void RenderFileUploadControl::receiveDroppedFiles(const Vector<String>& paths)
{
HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
#if ENABLE(DIRECTORY_UPLOAD)
if (allowsDirectoryUpload()) {
if (input->fastHasAttribute(webkitdirectoryAttr)) {
receiveDropForDirectoryUpload(paths);
return;
}
#endif
if (allowsMultipleFiles())
m_fileChooser->chooseFiles(paths);
else
m_fileChooser->chooseFile(paths[0]);
if (input->fastHasAttribute(multipleAttr))
filesChosen(paths);
else {
Vector<String> firstPathOnly;
firstPathOnly.append(paths[0]);
filesChosen(firstPathOnly);
}
}
String RenderFileUploadControl::buttonValue()
......@@ -331,8 +328,9 @@ String RenderFileUploadControl::buttonValue()
String RenderFileUploadControl::fileTextValue() const
{
ASSERT(m_fileChooser);
return theme()->fileListNameForWidth(m_fileChooser->filenames(), style()->font(), maxFilenameWidth());
Vector<String> filenames;
filenamesFromFileList(static_cast<HTMLInputElement*>(node())->files(), filenames);
return theme()->fileListNameForWidth(filenames, style()->font(), maxFilenameWidth());
}
} // namespace WebCore
......@@ -57,18 +57,16 @@ private:
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
// FileChooserClient functions.
virtual void valueChanged();
virtual bool allowsMultipleFiles();
#if ENABLE(DIRECTORY_UPLOAD)
virtual bool allowsDirectoryUpload();
virtual void receiveDropForDirectoryUpload(const Vector<String>&);
#endif
virtual String acceptTypes();
// FileChooserClient implementation.
virtual void filesChosen(const Vector<String>&);
// FileIconLoaderClient functions.
// FileIconLoaderClient implementation.
virtual void updateRendering(PassRefPtr<Icon>);
#if ENABLE(DIRECTORY_UPLOAD)
void receiveDropForDirectoryUpload(const Vector<String>&);
#endif
Chrome* chrome() const;
int maxFilenameWidth() const;
......@@ -77,7 +75,6 @@ private:
HTMLInputElement* uploadButton() const;
void requestIcon(const Vector<String>&) const;
RefPtr<FileChooser> m_fileChooser;
RefPtr<FileIconLoader> m_iconLoader;
RefPtr<Icon> m_icon;
};
......
2011-06-20 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Kent Tamura.
FileChooser should be only created when we need to choose files.
https://bugs.webkit.org/show_bug.cgi?id=63039
* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::runOpenPanel): Changed to use settings.
(WebKit::ChromeClientImpl::enumerateChosenDirectory): Updated decls.
* src/ChromeClientImpl.h:
2011-06-21 Tony Chang <tony@chromium.org>
Reviewed by Eric Seidel.
......
......@@ -668,14 +668,14 @@ void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh
return;
WebFileChooserParams params;
params.multiSelect = fileChooser->allowsMultipleFiles();
params.multiSelect = fileChooser->settings().allowsMultipleFiles;
#if ENABLE(DIRECTORY_UPLOAD)
params.directory = fileChooser->allowsDirectoryUpload();
params.directory = fileChooser->settings().allowsDirectoryUpload;
#else
params.directory = false;
#endif
params.acceptTypes = fileChooser->acceptTypes();
params.selectedFiles = fileChooser->filenames();
params.acceptTypes = fileChooser->settings().acceptTypes;
params.selectedFiles = fileChooser->settings().selectedFiles;
if (params.selectedFiles.size() > 0)
params.initialValue = params.selectedFiles[0];
WebFileChooserCompletionImpl* chooserCompletion =
......@@ -698,7 +698,7 @@ void ChromeClientImpl::loadIconForFiles(const Vector<String>& filenames, FileIco
}
#if ENABLE(DIRECTORY_UPLOAD)
void ChromeClientImpl::enumerateChosenDirectory(const String& path, FileChooser* fileChooser)
void ChromeClientImpl::enumerateChosenDirectory(FileChooser* fileChooser)
{
WebViewClient* client = m_webView->client();
if (!client)
......@@ -707,8 +707,10 @@ void ChromeClientImpl::enumerateChosenDirectory(const String& path, FileChooser*
WebFileChooserCompletionImpl* chooserCompletion =
new WebFileChooserCompletionImpl(fileChooser);
ASSERT(fileChooser && fileChooser->settings().selectedFiles.size());
// If the enumeration can't happen, call the callback with an empty list.
if (!client->enumerateChosenDirectory(path, chooserCompletion))
if (!client->enumerateChosenDirectory(fileChooser->settings().selectedFiles[0], chooserCompletion))
chooserCompletion->didChooseFile(WebVector<WebString>());
}
#endif
......
......@@ -141,7 +141,7 @@ public:
virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*);
#if ENABLE(DIRECTORY_UPLOAD)
virtual void enumerateChosenDirectory(const WTF::String&, WebCore::FileChooser*);
virtual void enumerateChosenDirectory(WebCore::FileChooser*);
#endif
virtual void setCursor(const WebCore::Cursor&);
virtual void formStateDidChange(const WebCore::Node*);
......
2011-06-20 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Kent Tamura.
FileChooser should be only created when we need to choose files.
https://bugs.webkit.org/show_bug.cgi?id=63039
* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::runOpenPanel): Changed to use settings.
2011-06-20 Gyuyoung Kim <gyuyoung.kim@samsung.com>
Unreviewed. Fix style error.
......
......@@ -426,13 +426,13 @@ void ChromeClientEfl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFile
void* filename;
Vector<String> filenames;
for (unsigned i = 0; i < chooser->filenames().size(); i++) {
CString str = chooser->filenames()[i].utf8();
for (unsigned i = 0; i < chooser->settings().selectedFiles.size(); i++) {
CString str = chooser->settings().selectedFiles[i].utf8();
filename = strdup(str.data());
suggestedFilenames = eina_list_append(suggestedFilenames, filename);
}
confirm = ewk_view_run_open_panel(m_view, kit(frame), chooser->allowsMultipleFiles(), suggestedFilenames, &selectedFilenames);
confirm = ewk_view_run_open_panel(m_view, kit(frame), chooser->settings().allowsMultipleFiles, suggestedFilenames, &selectedFilenames);
EINA_LIST_FREE(suggestedFilenames, filename)
free(filename);
......@@ -444,7 +444,7 @@ void ChromeClientEfl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFile
free(filename);
}
if (chooser->allowsMultipleFiles())
if (chooser->settings().allowsMultipleFiles)
chooser->chooseFiles(filenames);
else
chooser->chooseFile(filenames[0]);
......
2011-06-20 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Kent Tamura.
FileChooser should be only created when we need to choose files.
https://bugs.webkit.org/show_bug.cgi?id=63039
* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::runOpenPanel): Changed to use settings.
2011-06-22 Carlos Garcia Campos <cgarcia@igalia.com>
 
Reviewed by Xan Lopez.
......
......@@ -619,7 +619,7 @@ void ChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser)
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), chooser->allowsMultipleFiles());
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), chooser->settings().allowsMultipleFiles);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
if (gtk_file_chooser_get_select_multiple(GTK_FILE_CHOOSER(dialog))) {
......
2011-06-20 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Kent Tamura.
FileChooser should be only created when we need to choose files.
https://bugs.webkit.org/show_bug.cgi?id=63039
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::runOpenPanel): Changed to use settings.
2011-06-21 MORITA Hajime <morrita@google.com>
Unreviewed, rolling out r89401 and r89403.
......
......@@ -774,7 +774,7 @@ void WebChromeClient::paintCustomHighlight(Node* node, const AtomicString& type,
void WebChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> chooser)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
BOOL allowMultipleFiles = chooser->allowsMultipleFiles();