| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 PassRefPtr<FileChooser> FileChooser::create(FileChooserClient* client, const Fil
eChooserSettings& settings) | 59 PassRefPtr<FileChooser> FileChooser::create(FileChooserClient* client, const Fil
eChooserSettings& settings) |
| 60 { | 60 { |
| 61 return adoptRef(new FileChooser(client, settings)); | 61 return adoptRef(new FileChooser(client, settings)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 FileChooser::~FileChooser() | 64 FileChooser::~FileChooser() |
| 65 { | 65 { |
| 66 } | 66 } |
| 67 | 67 |
| 68 void FileChooser::chooseFile(const String& filename) | |
| 69 { | |
| 70 Vector<String> filenames; | |
| 71 filenames.append(filename); | |
| 72 chooseFiles(filenames); | |
| 73 } | |
| 74 | |
| 75 void FileChooser::chooseFiles(const Vector<String>& filenames) | 68 void FileChooser::chooseFiles(const Vector<String>& filenames) |
| 76 { | 69 { |
| 77 // FIXME: This is inelegant. We should not be looking at settings here. | 70 // FIXME: This is inelegant. We should not be looking at settings here. |
| 78 if (m_settings.selectedFiles == filenames) | 71 if (m_settings.selectedFiles == filenames) |
| 79 return; | 72 return; |
| 80 | 73 |
| 81 if (m_client) { | 74 if (m_client) { |
| 82 Vector<FileChooserFileInfo> files; | 75 Vector<FileChooserFileInfo> files; |
| 83 for (unsigned i = 0; i < filenames.size(); ++i) | 76 for (unsigned i = 0; i < filenames.size(); ++i) |
| 84 files.append(FileChooserFileInfo(filenames[i])); | 77 files.append(FileChooserFileInfo(filenames[i])); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 102 Vector<String> FileChooserSettings::acceptTypes() const | 95 Vector<String> FileChooserSettings::acceptTypes() const |
| 103 { | 96 { |
| 104 Vector<String> acceptTypes; | 97 Vector<String> acceptTypes; |
| 105 acceptTypes.reserveCapacity(acceptMIMETypes.size() + acceptFileExtensions.si
ze()); | 98 acceptTypes.reserveCapacity(acceptMIMETypes.size() + acceptFileExtensions.si
ze()); |
| 106 acceptTypes.appendVector(acceptMIMETypes); | 99 acceptTypes.appendVector(acceptMIMETypes); |
| 107 acceptTypes.appendVector(acceptFileExtensions); | 100 acceptTypes.appendVector(acceptFileExtensions); |
| 108 return acceptTypes; | 101 return acceptTypes; |
| 109 } | 102 } |
| 110 | 103 |
| 111 } | 104 } |
| OLD | NEW |