| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file implements common select dialog functionality between GTK and KDE. | 5 // This file implements common select dialog functionality between GTK and KDE. |
| 6 | 6 |
| 7 #ifndef UI_SHELL_DIALOGS_GTK_SELECT_FILE_DIALOG_IMPL_H_ | 7 #ifndef UI_SHELL_DIALOGS_GTK_SELECT_FILE_DIALOG_IMPL_H_ |
| 8 #define UI_SHELL_DIALOGS_GTK_SELECT_FILE_DIALOG_IMPL_H_ | 8 #define UI_SHELL_DIALOGS_GTK_SELECT_FILE_DIALOG_IMPL_H_ |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 virtual bool IsRunning(gfx::NativeWindow parent_window) const OVERRIDE; | 36 virtual bool IsRunning(gfx::NativeWindow parent_window) const OVERRIDE; |
| 37 virtual void ListenerDestroyed() OVERRIDE; | 37 virtual void ListenerDestroyed() OVERRIDE; |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 explicit SelectFileDialogImpl(Listener* listener, | 40 explicit SelectFileDialogImpl(Listener* listener, |
| 41 ui::SelectFilePolicy* policy); | 41 ui::SelectFilePolicy* policy); |
| 42 virtual ~SelectFileDialogImpl(); | 42 virtual ~SelectFileDialogImpl(); |
| 43 | 43 |
| 44 // SelectFileDialog implementation. | 44 // SelectFileDialog implementation. |
| 45 // |params| is user data we pass back via the Listener interface. | 45 // |params| is user data we pass back via the Listener interface. |
| 46 virtual void SelectFileImpl(Type type, | 46 virtual void SelectFileImpl( |
| 47 const string16& title, | 47 Type type, |
| 48 const FilePath& default_path, | 48 const string16& title, |
| 49 const FileTypeInfo* file_types, | 49 const base::FilePath& default_path, |
| 50 int file_type_index, | 50 const FileTypeInfo* file_types, |
| 51 const FilePath::StringType& default_extension, | 51 int file_type_index, |
| 52 gfx::NativeWindow owning_window, | 52 const base::FilePath::StringType& default_extension, |
| 53 void* params) = 0; | 53 gfx::NativeWindow owning_window, |
| 54 void* params) = 0; |
| 54 | 55 |
| 55 // Wrapper for file_util::DirectoryExists() that allow access on the UI | 56 // Wrapper for file_util::DirectoryExists() that allow access on the UI |
| 56 // thread. Use this only in the file dialog functions, where it's ok | 57 // thread. Use this only in the file dialog functions, where it's ok |
| 57 // because the file dialog has to do many stats anyway. One more won't | 58 // because the file dialog has to do many stats anyway. One more won't |
| 58 // hurt too badly and it's likely already cached. | 59 // hurt too badly and it's likely already cached. |
| 59 bool CallDirectoryExistsOnUIThread(const FilePath& path); | 60 bool CallDirectoryExistsOnUIThread(const base::FilePath& path); |
| 60 | 61 |
| 61 // The file filters. | 62 // The file filters. |
| 62 FileTypeInfo file_types_; | 63 FileTypeInfo file_types_; |
| 63 | 64 |
| 64 // The index of the default selected file filter. | 65 // The index of the default selected file filter. |
| 65 // Note: This starts from 1, not 0. | 66 // Note: This starts from 1, not 0. |
| 66 size_t file_type_index_; | 67 size_t file_type_index_; |
| 67 | 68 |
| 68 // The set of all parent windows for which we are currently running dialogs. | 69 // The set of all parent windows for which we are currently running dialogs. |
| 69 std::set<GtkWindow*> parents_; | 70 std::set<GtkWindow*> parents_; |
| 70 | 71 |
| 71 // The type of dialog we are showing the user. | 72 // The type of dialog we are showing the user. |
| 72 Type type_; | 73 Type type_; |
| 73 | 74 |
| 74 // These two variables track where the user last saved a file or opened a | 75 // These two variables track where the user last saved a file or opened a |
| 75 // file so that we can display future dialogs with the same starting path. | 76 // file so that we can display future dialogs with the same starting path. |
| 76 static FilePath* last_saved_path_; | 77 static base::FilePath* last_saved_path_; |
| 77 static FilePath* last_opened_path_; | 78 static base::FilePath* last_opened_path_; |
| 78 | 79 |
| 79 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); | 80 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 SelectFileDialog* CreateLinuxSelectFileDialog( | 83 SelectFileDialog* CreateLinuxSelectFileDialog( |
| 83 SelectFileDialog::Listener* listener, | 84 SelectFileDialog::Listener* listener, |
| 84 SelectFilePolicy* policy); | 85 SelectFilePolicy* policy); |
| 85 | 86 |
| 86 } // namespace ui | 87 } // namespace ui |
| 87 | 88 |
| 88 #endif // UI_SHELL_DIALOGS_GTK_SELECT_FILE_DIALOG_IMPL_H_ | 89 #endif // UI_SHELL_DIALOGS_GTK_SELECT_FILE_DIALOG_IMPL_H_ |
| OLD | NEW |