OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_GTK_SELECT_FILE_DIALOG_IMPL_H_ | 7 #ifndef CHROME_BROWSER_UI_GTK_SELECT_FILE_DIALOG_IMPL_H_ |
8 #define CHROME_BROWSER_UI_GTK_SELECT_FILE_DIALOG_IMPL_H_ | 8 #define CHROME_BROWSER_UI_GTK_SELECT_FILE_DIALOG_IMPL_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
11 #include <set> | 11 #include <set> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/nix/xdg_util.h" | 14 #include "base/nix/xdg_util.h" |
15 #include "chrome/browser/ui/select_file_dialog.h" | 15 #include "chrome/browser/ui/select_file_dialog.h" |
16 | 16 |
17 // Shared implementation SelectFileDialog used by SelectFileDialogImplGTK | 17 // Shared implementation SelectFileDialog used by SelectFileDialogImplGTK |
18 class SelectFileDialogImpl : public SelectFileDialog { | 18 class SelectFileDialogImpl : public SelectFileDialog { |
19 public: | 19 public: |
20 // Factory method for creating a GTK-styled SelectFileDialogImpl | 20 // Factory method for creating a GTK-styled SelectFileDialogImpl |
21 static SelectFileDialogImpl* NewSelectFileDialogImplGTK(Listener* listener); | 21 static SelectFileDialogImpl* NewSelectFileDialogImplGTK( |
| 22 Listener* listener, |
| 23 ui::SelectFilePolicy* policy); |
22 // Factory method for creating a KDE-styled SelectFileDialogImpl | 24 // Factory method for creating a KDE-styled SelectFileDialogImpl |
23 static SelectFileDialogImpl* NewSelectFileDialogImplKDE( | 25 static SelectFileDialogImpl* NewSelectFileDialogImplKDE( |
24 Listener* listener, | 26 Listener* listener, |
| 27 ui::SelectFilePolicy* policy, |
25 base::nix::DesktopEnvironment desktop); | 28 base::nix::DesktopEnvironment desktop); |
26 | 29 |
27 // Returns true if the SelectFileDialog class returned by | 30 // Returns true if the SelectFileDialog class returned by |
28 // NewSelectFileDialogImplKDE will actually work. | 31 // NewSelectFileDialogImplKDE will actually work. |
29 static bool CheckKDEDialogWorksOnUIThread(); | 32 static bool CheckKDEDialogWorksOnUIThread(); |
30 | 33 |
31 // BaseShellDialog implementation. | 34 // BaseShellDialog implementation. |
32 virtual bool IsRunning(gfx::NativeWindow parent_window) const OVERRIDE; | 35 virtual bool IsRunning(gfx::NativeWindow parent_window) const OVERRIDE; |
33 virtual void ListenerDestroyed() OVERRIDE; | 36 virtual void ListenerDestroyed() OVERRIDE; |
34 | 37 |
35 protected: | 38 protected: |
36 explicit SelectFileDialogImpl(Listener* listener); | 39 explicit SelectFileDialogImpl(Listener* listener, |
| 40 ui::SelectFilePolicy* policy); |
37 virtual ~SelectFileDialogImpl(); | 41 virtual ~SelectFileDialogImpl(); |
38 | 42 |
39 // SelectFileDialog implementation. | 43 // SelectFileDialog implementation. |
40 // |params| is user data we pass back via the Listener interface. | 44 // |params| is user data we pass back via the Listener interface. |
41 virtual void SelectFileImpl(Type type, | 45 virtual void SelectFileImpl(Type type, |
42 const string16& title, | 46 const string16& title, |
43 const FilePath& default_path, | 47 const FilePath& default_path, |
44 const FileTypeInfo* file_types, | 48 const FileTypeInfo* file_types, |
45 int file_type_index, | 49 int file_type_index, |
46 const FilePath::StringType& default_extension, | 50 const FilePath::StringType& default_extension, |
(...skipping 21 matching lines...) Expand all Loading... |
68 | 72 |
69 // These two variables track where the user last saved a file or opened a | 73 // These two variables track where the user last saved a file or opened a |
70 // file so that we can display future dialogs with the same starting path. | 74 // file so that we can display future dialogs with the same starting path. |
71 static FilePath* last_saved_path_; | 75 static FilePath* last_saved_path_; |
72 static FilePath* last_opened_path_; | 76 static FilePath* last_opened_path_; |
73 | 77 |
74 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); | 78 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); |
75 }; | 79 }; |
76 | 80 |
77 #endif // CHROME_BROWSER_UI_GTK_SELECT_FILE_DIALOG_IMPL_H_ | 81 #endif // CHROME_BROWSER_UI_GTK_SELECT_FILE_DIALOG_IMPL_H_ |
OLD | NEW |