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 #include <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
6 #include <map> | 6 #include <map> |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 // Xlib defines RootWindow | 10 // Xlib defines RootWindow |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 // Implementation of SelectFileDialog that shows a Gtk common dialog for | 47 // Implementation of SelectFileDialog that shows a Gtk common dialog for |
48 // choosing a file or folder. This acts as a modal dialog. | 48 // choosing a file or folder. This acts as a modal dialog. |
49 class SelectFileDialogImplGTK : public SelectFileDialogImpl, | 49 class SelectFileDialogImplGTK : public SelectFileDialogImpl, |
50 public aura::WindowObserver { | 50 public aura::WindowObserver { |
51 public: | 51 public: |
52 explicit SelectFileDialogImplGTK(Listener* listener, | 52 explicit SelectFileDialogImplGTK(Listener* listener, |
53 ui::SelectFilePolicy* policy); | 53 ui::SelectFilePolicy* policy); |
54 | 54 |
55 protected: | 55 protected: |
56 virtual ~SelectFileDialogImplGTK(); | 56 ~SelectFileDialogImplGTK() override; |
57 | 57 |
58 // BaseShellDialog implementation: | 58 // BaseShellDialog implementation: |
59 virtual bool IsRunning(gfx::NativeWindow parent_window) const override; | 59 bool IsRunning(gfx::NativeWindow parent_window) const override; |
60 | 60 |
61 // SelectFileDialog implementation. | 61 // SelectFileDialog implementation. |
62 // |params| is user data we pass back via the Listener interface. | 62 // |params| is user data we pass back via the Listener interface. |
63 virtual void SelectFileImpl( | 63 void SelectFileImpl(Type type, |
64 Type type, | 64 const base::string16& title, |
65 const base::string16& title, | 65 const base::FilePath& default_path, |
66 const base::FilePath& default_path, | 66 const FileTypeInfo* file_types, |
67 const FileTypeInfo* file_types, | 67 int file_type_index, |
68 int file_type_index, | 68 const base::FilePath::StringType& default_extension, |
69 const base::FilePath::StringType& default_extension, | 69 gfx::NativeWindow owning_window, |
70 gfx::NativeWindow owning_window, | 70 void* params) override; |
71 void* params) override; | |
72 | 71 |
73 private: | 72 private: |
74 virtual bool HasMultipleFileTypeChoicesImpl() override; | 73 bool HasMultipleFileTypeChoicesImpl() override; |
75 | 74 |
76 // Overridden from aura::WindowObserver: | 75 // Overridden from aura::WindowObserver: |
77 virtual void OnWindowDestroying(aura::Window* window) override; | 76 void OnWindowDestroying(aura::Window* window) override; |
78 | 77 |
79 // Add the filters from |file_types_| to |chooser|. | 78 // Add the filters from |file_types_| to |chooser|. |
80 void AddFilters(GtkFileChooser* chooser); | 79 void AddFilters(GtkFileChooser* chooser); |
81 | 80 |
82 // Notifies the listener that a single file was chosen. | 81 // Notifies the listener that a single file was chosen. |
83 void FileSelected(GtkWidget* dialog, const base::FilePath& path); | 82 void FileSelected(GtkWidget* dialog, const base::FilePath& path); |
84 | 83 |
85 // Notifies the listener that multiple files were chosen. | 84 // Notifies the listener that multiple files were chosen. |
86 void MultiFilesSelected(GtkWidget* dialog, | 85 void MultiFilesSelected(GtkWidget* dialog, |
87 const std::vector<base::FilePath>& files); | 86 const std::vector<base::FilePath>& files); |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 g_free(filename); | 627 g_free(filename); |
629 if (pixbuf) { | 628 if (pixbuf) { |
630 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); | 629 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); |
631 g_object_unref(pixbuf); | 630 g_object_unref(pixbuf); |
632 } | 631 } |
633 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), | 632 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), |
634 pixbuf ? TRUE : FALSE); | 633 pixbuf ? TRUE : FALSE); |
635 } | 634 } |
636 | 635 |
637 } // namespace libgtk2ui | 636 } // namespace libgtk2ui |
OLD | NEW |