diff options
Diffstat (limited to 'WebCore/platform/FileChooser.cpp')
-rw-r--r-- | WebCore/platform/FileChooser.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/WebCore/platform/FileChooser.cpp b/WebCore/platform/FileChooser.cpp index 9fad392..a2d4770 100644 --- a/WebCore/platform/FileChooser.cpp +++ b/WebCore/platform/FileChooser.cpp @@ -39,9 +39,9 @@ FileChooserClient::~FileChooserClient() inline FileChooser::FileChooser(FileChooserClient* client, const Vector<String>& initialFilenames) : m_client(client) - , m_icon(Icon::createIconForFiles(initialFilenames)) { m_filenames = initialFilenames; + loadIcon(); } PassRefPtr<FileChooser> FileChooser::create(FileChooserClient* client, const Vector<String>& initialFilenames) @@ -71,9 +71,24 @@ void FileChooser::chooseFiles(const Vector<String>& filenames) if (m_filenames == filenames) return; m_filenames = filenames; - m_icon = Icon::createIconForFiles(filenames); + loadIcon(); if (m_client) m_client->valueChanged(); } +void FileChooser::loadIcon() +{ + m_icon = Icon::createIconForFiles(m_filenames); + // If synchronous icon loading failed, try asynchronous loading. + if (!m_icon && m_filenames.size() && m_client) + m_client->iconForFiles(m_filenames); +} + +void FileChooser::iconLoaded(PassRefPtr<Icon> icon) +{ + m_icon = icon; + if (m_icon && m_client) + m_client->repaint(); +} + } |