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

Side by Side Diff: chrome/browser/ui/libgtkui/select_file_dialog_impl_gtk.h

Issue 2453243002: Gtk3 UI: Rename files in libgtkui containing gtk2 in their name (Closed)
Patch Set: Fix git cl format mistake 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_UI_LIBGTKUI_SELECT_FILE_DIALOG_IMPL_GTK2_H_ 5 #ifndef CHROME_BROWSER_UI_LIBGTKUI_SELECT_FILE_DIALOG_IMPL_GTK_H_
6 #define CHROME_BROWSER_UI_LIBGTKUI_SELECT_FILE_DIALOG_IMPL_GTK2_H_ 6 #define CHROME_BROWSER_UI_LIBGTKUI_SELECT_FILE_DIALOG_IMPL_GTK_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/ui/libgtkui/gtk2_signal.h" 9 #include "chrome/browser/ui/libgtkui/gtk_signal.h"
10 #include "chrome/browser/ui/libgtkui/gtk2_util.h" 10 #include "chrome/browser/ui/libgtkui/gtk_util.h"
11 #include "chrome/browser/ui/libgtkui/select_file_dialog_impl.h" 11 #include "chrome/browser/ui/libgtkui/select_file_dialog_impl.h"
12 12
13 namespace libgtkui { 13 namespace libgtkui {
14 14
15 // Implementation of SelectFileDialog that shows a Gtk common dialog for 15 // Implementation of SelectFileDialog that shows a Gtk common dialog for
16 // choosing a file or folder. This acts as a modal dialog. 16 // choosing a file or folder. This acts as a modal dialog.
17 class SelectFileDialogImplGTK : public SelectFileDialogImpl, 17 class SelectFileDialogImplGTK : public SelectFileDialogImpl,
18 public aura::WindowObserver { 18 public aura::WindowObserver {
19 public: 19 public:
20 SelectFileDialogImplGTK(Listener* listener, 20 SelectFileDialogImplGTK(Listener* listener, ui::SelectFilePolicy* policy);
21 ui::SelectFilePolicy* policy);
22 21
23 protected: 22 protected:
24 ~SelectFileDialogImplGTK() override; 23 ~SelectFileDialogImplGTK() override;
25 24
26 // BaseShellDialog implementation: 25 // BaseShellDialog implementation:
27 bool IsRunning(gfx::NativeWindow parent_window) const override; 26 bool IsRunning(gfx::NativeWindow parent_window) const override;
28 27
29 // SelectFileDialog implementation. 28 // SelectFileDialog implementation.
30 // |params| is user data we pass back via the Listener interface. 29 // |params| is user data we pass back via the Listener interface.
31 void SelectFileImpl(Type type, 30 void SelectFileImpl(Type type,
(...skipping 20 matching lines...) Expand all
52 51
53 // Notifies the listener that multiple files were chosen. 52 // Notifies the listener that multiple files were chosen.
54 void MultiFilesSelected(GtkWidget* dialog, 53 void MultiFilesSelected(GtkWidget* dialog,
55 const std::vector<base::FilePath>& files); 54 const std::vector<base::FilePath>& files);
56 55
57 // Notifies the listener that no file was chosen (the action was canceled). 56 // Notifies the listener that no file was chosen (the action was canceled).
58 // Dialog is passed so we can find that |params| pointer that was passed to 57 // Dialog is passed so we can find that |params| pointer that was passed to
59 // us when we were told to show the dialog. 58 // us when we were told to show the dialog.
60 void FileNotSelected(GtkWidget* dialog); 59 void FileNotSelected(GtkWidget* dialog);
61 60
62 GtkWidget* CreateSelectFolderDialog( 61 GtkWidget* CreateSelectFolderDialog(Type type,
63 Type type, 62 const std::string& title,
64 const std::string& title, 63 const base::FilePath& default_path,
65 const base::FilePath& default_path, 64 gfx::NativeWindow parent);
66 gfx::NativeWindow parent);
67 65
68 GtkWidget* CreateFileOpenDialog(const std::string& title, 66 GtkWidget* CreateFileOpenDialog(const std::string& title,
69 const base::FilePath& default_path, gfx::NativeWindow parent); 67 const base::FilePath& default_path,
68 gfx::NativeWindow parent);
70 69
71 GtkWidget* CreateMultiFileOpenDialog(const std::string& title, 70 GtkWidget* CreateMultiFileOpenDialog(const std::string& title,
72 const base::FilePath& default_path, gfx::NativeWindow parent); 71 const base::FilePath& default_path,
72 gfx::NativeWindow parent);
73 73
74 GtkWidget* CreateSaveAsDialog(const std::string& title, 74 GtkWidget* CreateSaveAsDialog(const std::string& title,
75 const base::FilePath& default_path, gfx::NativeWindow parent); 75 const base::FilePath& default_path,
76 gfx::NativeWindow parent);
76 77
77 // Removes and returns the |params| associated with |dialog| from 78 // Removes and returns the |params| associated with |dialog| from
78 // |params_map_|. 79 // |params_map_|.
79 void* PopParamsForDialog(GtkWidget* dialog); 80 void* PopParamsForDialog(GtkWidget* dialog);
80 81
81 // Check whether response_id corresponds to the user cancelling/closing the 82 // Check whether response_id corresponds to the user cancelling/closing the
82 // dialog. Used as a helper for the below callbacks. 83 // dialog. Used as a helper for the below callbacks.
83 bool IsCancelResponse(gint response_id); 84 bool IsCancelResponse(gint response_id);
84 85
85 // Common function for OnSelectSingleFileDialogResponse and 86 // Common function for OnSelectSingleFileDialogResponse and
86 // OnSelectSingleFolderDialogResponse. 87 // OnSelectSingleFolderDialogResponse.
87 void SelectSingleFileHelper(GtkWidget* dialog, 88 void SelectSingleFileHelper(GtkWidget* dialog,
88 gint response_id, 89 gint response_id,
89 bool allow_folder); 90 bool allow_folder);
90 91
91 // Common function for CreateFileOpenDialog and CreateMultiFileOpenDialog. 92 // Common function for CreateFileOpenDialog and CreateMultiFileOpenDialog.
92 GtkWidget* CreateFileOpenHelper(const std::string& title, 93 GtkWidget* CreateFileOpenHelper(const std::string& title,
93 const base::FilePath& default_path, 94 const base::FilePath& default_path,
94 gfx::NativeWindow parent); 95 gfx::NativeWindow parent);
95 96
96 // Callback for when the user responds to a Save As or Open File dialog. 97 // Callback for when the user responds to a Save As or Open File dialog.
97 CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK, void, 98 CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK,
98 OnSelectSingleFileDialogResponse, int); 99 void,
100 OnSelectSingleFileDialogResponse,
101 int);
99 102
100 // Callback for when the user responds to a Select Folder dialog. 103 // Callback for when the user responds to a Select Folder dialog.
101 CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK, void, 104 CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK,
102 OnSelectSingleFolderDialogResponse, int); 105 void,
106 OnSelectSingleFolderDialogResponse,
107 int);
103 108
104 // Callback for when the user responds to a Open Multiple Files dialog. 109 // Callback for when the user responds to a Open Multiple Files dialog.
105 CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK, void, 110 CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK,
106 OnSelectMultiFileDialogResponse, int); 111 void,
112 OnSelectMultiFileDialogResponse,
113 int);
107 114
108 // Callback for when the file chooser gets destroyed. 115 // Callback for when the file chooser gets destroyed.
109 CHROMEGTK_CALLBACK_0(SelectFileDialogImplGTK, void, OnFileChooserDestroy); 116 CHROMEGTK_CALLBACK_0(SelectFileDialogImplGTK, void, OnFileChooserDestroy);
110 117
111 // Callback for when we update the preview for the selection. 118 // Callback for when we update the preview for the selection.
112 CHROMEGTK_CALLBACK_0(SelectFileDialogImplGTK, void, OnUpdatePreview); 119 CHROMEGTK_CALLBACK_0(SelectFileDialogImplGTK, void, OnUpdatePreview);
113 120
114 // A map from dialog windows to the |params| user data associated with them. 121 // A map from dialog windows to the |params| user data associated with them.
115 std::map<GtkWidget*, void*> params_map_; 122 std::map<GtkWidget*, void*> params_map_;
116 123
117 // The GtkImage widget for showing previews of selected images. 124 // The GtkImage widget for showing previews of selected images.
118 GtkWidget* preview_; 125 GtkWidget* preview_;
119 126
120 // All our dialogs. 127 // All our dialogs.
121 std::set<GtkWidget*> dialogs_; 128 std::set<GtkWidget*> dialogs_;
122 129
123 // The set of all parent windows for which we are currently running dialogs. 130 // The set of all parent windows for which we are currently running dialogs.
124 std::set<aura::Window*> parents_; 131 std::set<aura::Window*> parents_;
125 132
126 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImplGTK); 133 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImplGTK);
127 }; 134 };
128 135
129 } // namespace libgtkui 136 } // namespace libgtkui
130 137
131 #endif // CHROME_BROWSER_UI_LIBGTKUI_SELECT_FILE_DIALOG_IMPL_GTK2_H_ 138 #endif // CHROME_BROWSER_UI_LIBGTKUI_SELECT_FILE_DIALOG_IMPL_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtkui/printing_gtk_util.cc ('k') | chrome/browser/ui/libgtkui/select_file_dialog_impl_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698