| 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_util.h" | 10 #include "base/file_util.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 class SelectFileDialogImpl : public SelectFileDialog { | 32 class SelectFileDialogImpl : public SelectFileDialog { |
| 33 public: | 33 public: |
| 34 explicit SelectFileDialogImpl(Listener* listener); | 34 explicit SelectFileDialogImpl(Listener* listener); |
| 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 virtual ~SelectFileDialogImpl(); | 64 virtual ~SelectFileDialogImpl(); |
| 53 | 65 |
| 54 // Add the filters from |file_types_| to |chooser|. | 66 // Add the filters from |file_types_| to |chooser|. |
| 55 void AddFilters(GtkFileChooser* chooser); | 67 void AddFilters(GtkFileChooser* chooser); |
| 56 | 68 |
| 57 // Notifies the listener that a single file was chosen. | 69 // Notifies the listener that a single file was chosen. |
| 58 void FileSelected(GtkWidget* dialog, const FilePath& path); | 70 void FileSelected(GtkWidget* dialog, const FilePath& path); |
| 59 | 71 |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 // This will preserve the image's aspect ratio. | 586 // This will preserve the image's aspect ratio. |
| 575 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, | 587 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, |
| 576 kPreviewHeight, NULL); | 588 kPreviewHeight, NULL); |
| 577 g_free(filename); | 589 g_free(filename); |
| 578 if (pixbuf) { | 590 if (pixbuf) { |
| 579 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->preview_), pixbuf); | 591 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->preview_), pixbuf); |
| 580 g_object_unref(pixbuf); | 592 g_object_unref(pixbuf); |
| 581 } | 593 } |
| 582 gtk_file_chooser_set_preview_widget_active(chooser, pixbuf ? TRUE : FALSE); | 594 gtk_file_chooser_set_preview_widget_active(chooser, pixbuf ? TRUE : FALSE); |
| 583 } | 595 } |
| OLD | NEW |