Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h

Issue 2449243002: Gtk3 ui: Add libgtk3ui as a separate build component (Closed)
Patch Set: Add theme_properties dep to //chrome/browser/ui Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // This file implements common select dialog functionality between GTK and KDE.
6
7 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_SELECT_FILE_DIALOG_IMPL_H_
8 #define CHROME_BROWSER_UI_LIBGTK2UI_SELECT_FILE_DIALOG_IMPL_H_
9
10 #include <stddef.h>
11
12 #include <set>
13
14 #include "base/compiler_specific.h"
15 #include "base/macros.h"
16 #include "base/nix/xdg_util.h"
17 #include "ui/aura/window.h"
18 #include "ui/shell_dialogs/select_file_dialog.h"
19 #include "ui/shell_dialogs/select_file_policy.h"
20
21 namespace libgtk2ui {
22
23 // Shared implementation SelectFileDialog used by SelectFileDialogImplGTK
24 class SelectFileDialogImpl : public ui::SelectFileDialog {
25 public:
26 // Main factory method which returns correct type.
27 static ui::SelectFileDialog* Create(Listener* listener,
28 ui::SelectFilePolicy* policy);
29
30 // Factory method for creating a GTK-styled SelectFileDialogImpl
31 static SelectFileDialogImpl* NewSelectFileDialogImplGTK(
32 Listener* listener,
33 ui::SelectFilePolicy* policy);
34 // Factory method for creating a KDE-styled SelectFileDialogImpl
35 static SelectFileDialogImpl* NewSelectFileDialogImplKDE(
36 Listener* listener,
37 ui::SelectFilePolicy* policy,
38 base::nix::DesktopEnvironment desktop);
39
40 // Returns true if the SelectFileDialog class returned by
41 // NewSelectFileDialogImplKDE will actually work.
42 static bool CheckKDEDialogWorksOnUIThread();
43
44 // BaseShellDialog implementation.
45 void ListenerDestroyed() override;
46
47 protected:
48 explicit SelectFileDialogImpl(Listener* listener,
49 ui::SelectFilePolicy* policy);
50 ~SelectFileDialogImpl() override;
51
52 // SelectFileDialog implementation.
53 // |params| is user data we pass back via the Listener interface.
54 void SelectFileImpl(Type type,
55 const base::string16& title,
56 const base::FilePath& default_path,
57 const FileTypeInfo* file_types,
58 int file_type_index,
59 const base::FilePath::StringType& default_extension,
60 gfx::NativeWindow owning_window,
61 void* params) override = 0;
62
63 // Wrapper for base::DirectoryExists() that allow access on the UI
64 // thread. Use this only in the file dialog functions, where it's ok
65 // because the file dialog has to do many stats anyway. One more won't
66 // hurt too badly and it's likely already cached.
67 bool CallDirectoryExistsOnUIThread(const base::FilePath& path);
68
69 // The file filters.
70 FileTypeInfo file_types_;
71
72 // The index of the default selected file filter.
73 // Note: This starts from 1, not 0.
74 size_t file_type_index_;
75
76 // The type of dialog we are showing the user.
77 Type type_;
78
79 // These two variables track where the user last saved a file or opened a
80 // file so that we can display future dialogs with the same starting path.
81 static base::FilePath* last_saved_path_;
82 static base::FilePath* last_opened_path_;
83
84 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl);
85 };
86
87 } // namespace libgtk2ui
88
89 #endif // CHROME_BROWSER_UI_LIBGTK2UI_SELECT_FILE_DIALOG_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/printing_gtk2_util.cc ('k') | chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698