| Index: chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
|
| diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
|
| index 3beecc718da28cca68b68300db6d7d34d55690be..f3e6249be2acdbb616fab1f1414a32826c25be95 100644
|
| --- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
|
| +++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
|
| @@ -2,6 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.h"
|
| +
|
| #include <gtk/gtk.h>
|
| #include <sys/stat.h>
|
| #include <sys/types.h>
|
| @@ -49,122 +51,6 @@ void OnFileFilterDataDestroyed(std::string* file_extension) {
|
|
|
| namespace libgtk2ui {
|
|
|
| -// Implementation of SelectFileDialog that shows a Gtk common dialog for
|
| -// choosing a file or folder. This acts as a modal dialog.
|
| -class SelectFileDialogImplGTK : public SelectFileDialogImpl,
|
| - public aura::WindowObserver {
|
| - public:
|
| - explicit SelectFileDialogImplGTK(Listener* listener,
|
| - ui::SelectFilePolicy* policy);
|
| -
|
| - protected:
|
| - ~SelectFileDialogImplGTK() override;
|
| -
|
| - // BaseShellDialog implementation:
|
| - bool IsRunning(gfx::NativeWindow parent_window) const override;
|
| -
|
| - // SelectFileDialog implementation.
|
| - // |params| is user data we pass back via the Listener interface.
|
| - void SelectFileImpl(Type type,
|
| - const base::string16& title,
|
| - const base::FilePath& default_path,
|
| - const FileTypeInfo* file_types,
|
| - int file_type_index,
|
| - const base::FilePath::StringType& default_extension,
|
| - gfx::NativeWindow owning_window,
|
| - void* params) override;
|
| -
|
| - private:
|
| - bool HasMultipleFileTypeChoicesImpl() override;
|
| -
|
| - // Overridden from aura::WindowObserver:
|
| - void OnWindowDestroying(aura::Window* window) override;
|
| -
|
| - // Add the filters from |file_types_| to |chooser|.
|
| - void AddFilters(GtkFileChooser* chooser);
|
| -
|
| - // Notifies the listener that a single file was chosen.
|
| - void FileSelected(GtkWidget* dialog, const base::FilePath& path);
|
| -
|
| - // Notifies the listener that multiple files were chosen.
|
| - void MultiFilesSelected(GtkWidget* dialog,
|
| - const std::vector<base::FilePath>& files);
|
| -
|
| - // Notifies the listener that no file was chosen (the action was canceled).
|
| - // Dialog is passed so we can find that |params| pointer that was passed to
|
| - // us when we were told to show the dialog.
|
| - void FileNotSelected(GtkWidget* dialog);
|
| -
|
| - GtkWidget* CreateSelectFolderDialog(
|
| - Type type,
|
| - const std::string& title,
|
| - const base::FilePath& default_path,
|
| - gfx::NativeWindow parent);
|
| -
|
| - GtkWidget* CreateFileOpenDialog(const std::string& title,
|
| - const base::FilePath& default_path, gfx::NativeWindow parent);
|
| -
|
| - GtkWidget* CreateMultiFileOpenDialog(const std::string& title,
|
| - const base::FilePath& default_path, gfx::NativeWindow parent);
|
| -
|
| - GtkWidget* CreateSaveAsDialog(const std::string& title,
|
| - const base::FilePath& default_path, gfx::NativeWindow parent);
|
| -
|
| - // Removes and returns the |params| associated with |dialog| from
|
| - // |params_map_|.
|
| - void* PopParamsForDialog(GtkWidget* dialog);
|
| -
|
| - // Take care of internal data structures when a file dialog is destroyed.
|
| - void FileDialogDestroyed(GtkWidget* dialog);
|
| -
|
| - // Check whether response_id corresponds to the user cancelling/closing the
|
| - // dialog. Used as a helper for the below callbacks.
|
| - bool IsCancelResponse(gint response_id);
|
| -
|
| - // Common function for OnSelectSingleFileDialogResponse and
|
| - // OnSelectSingleFolderDialogResponse.
|
| - void SelectSingleFileHelper(GtkWidget* dialog,
|
| - gint response_id,
|
| - bool allow_folder);
|
| -
|
| - // Common function for CreateFileOpenDialog and CreateMultiFileOpenDialog.
|
| - GtkWidget* CreateFileOpenHelper(const std::string& title,
|
| - const base::FilePath& default_path,
|
| - gfx::NativeWindow parent);
|
| -
|
| - // Callback for when the user responds to a Save As or Open File dialog.
|
| - CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK, void,
|
| - OnSelectSingleFileDialogResponse, int);
|
| -
|
| - // Callback for when the user responds to a Select Folder dialog.
|
| - CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK, void,
|
| - OnSelectSingleFolderDialogResponse, int);
|
| -
|
| - // Callback for when the user responds to a Open Multiple Files dialog.
|
| - CHROMEGTK_CALLBACK_1(SelectFileDialogImplGTK, void,
|
| - OnSelectMultiFileDialogResponse, int);
|
| -
|
| - // Callback for when the file chooser gets destroyed.
|
| - CHROMEGTK_CALLBACK_0(SelectFileDialogImplGTK, void, OnFileChooserDestroy);
|
| -
|
| - // Callback for when we update the preview for the selection.
|
| - CHROMEGTK_CALLBACK_0(SelectFileDialogImplGTK, void, OnUpdatePreview);
|
| -
|
| - // A map from dialog windows to the |params| user data associated with them.
|
| - std::map<GtkWidget*, void*> params_map_;
|
| -
|
| - // The GtkImage widget for showing previews of selected images.
|
| - GtkWidget* preview_;
|
| -
|
| - // All our dialogs.
|
| - std::set<GtkWidget*> dialogs_;
|
| -
|
| - // The set of all parent windows for which we are currently running dialogs.
|
| - std::set<aura::Window*> parents_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImplGTK);
|
| -};
|
| -
|
| // The size of the preview we display for selected image files. We set height
|
| // larger than width because generally there is more free space vertically
|
| // than horiztonally (setting the preview image will alway expand the width of
|
|
|