| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 public: | 32 public: |
| 33 explicit SelectFileDialogImpl(Listener* listener); | 33 explicit SelectFileDialogImpl(Listener* listener); |
| 34 virtual ~SelectFileDialogImpl(); | 34 virtual ~SelectFileDialogImpl(); |
| 35 | 35 |
| 36 // BaseShellDialog implementation. | 36 // BaseShellDialog implementation. |
| 37 virtual bool IsRunning(gfx::NativeWindow parent_window) const; | 37 virtual bool IsRunning(gfx::NativeWindow parent_window) const; |
| 38 virtual void ListenerDestroyed(); | 38 virtual void ListenerDestroyed(); |
| 39 | 39 |
| 40 // SelectFileDialog implementation. | 40 // SelectFileDialog implementation. |
| 41 // |params| is user data we pass back via the Listener interface. | 41 // |params| is user data we pass back via the Listener interface. |
| 42 virtual void SelectFile(Type type, | 42 virtual void SelectFile( |
| 43 const string16& title, | 43 Type type, |
| 44 const FilePath& default_path, | 44 const string16& title, |
| 45 const FileTypeInfo* file_types, | 45 const FilePath& default_path, |
| 46 int file_type_index, | 46 const FileTypeInfo* file_types, |
| 47 const FilePath::StringType& default_extension, | 47 int file_type_index, |
| 48 gfx::NativeWindow owning_window, | 48 const FilePath::StringType& default_extension, |
| 49 void* params); | 49 gfx::NativeWindow owning_window, |
| 50 void* params); |
| 51 virtual void SelectFileDialogImpl::SelectFileInTab( |
| 52 Type type, |
| 53 const string16& title, |
| 54 const FilePath& default_path, |
| 55 const FileTypeInfo* file_types, |
| 56 int file_type_index, |
| 57 const FilePath::StringType& default_extension, |
| 58 TabContents* owning_tab, |
| 59 void* params) { |
| 60 NOTIMPLEMENTED(); |
| 61 } |
| 50 | 62 |
| 51 private: | 63 private: |
| 52 // Add the filters from |file_types_| to |chooser|. | 64 // Add the filters from |file_types_| to |chooser|. |
| 53 void AddFilters(GtkFileChooser* chooser); | 65 void AddFilters(GtkFileChooser* chooser); |
| 54 | 66 |
| 55 // Notifies the listener that a single file was chosen. | 67 // Notifies the listener that a single file was chosen. |
| 56 void FileSelected(GtkWidget* dialog, const FilePath& path); | 68 void FileSelected(GtkWidget* dialog, const FilePath& path); |
| 57 | 69 |
| 58 // Notifies the listener that multiple files were chosen. | 70 // Notifies the listener that multiple files were chosen. |
| 59 void MultiFilesSelected(GtkWidget* dialog, | 71 void MultiFilesSelected(GtkWidget* dialog, |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // This will preserve the image's aspect ratio. | 515 // This will preserve the image's aspect ratio. |
| 504 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, | 516 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, |
| 505 kPreviewHeight, NULL); | 517 kPreviewHeight, NULL); |
| 506 g_free(filename); | 518 g_free(filename); |
| 507 if (pixbuf) { | 519 if (pixbuf) { |
| 508 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->preview_), pixbuf); | 520 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->preview_), pixbuf); |
| 509 g_object_unref(pixbuf); | 521 g_object_unref(pixbuf); |
| 510 } | 522 } |
| 511 gtk_file_chooser_set_preview_widget_active(chooser, pixbuf ? TRUE : FALSE); | 523 gtk_file_chooser_set_preview_widget_active(chooser, pixbuf ? TRUE : FALSE); |
| 512 } | 524 } |
| OLD | NEW |