OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk_signal.h" | 9 #include "app/gtk_signal.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/mime_util.h" | 14 #include "base/mime_util.h" |
15 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
16 #include "base/thread.h" | 16 #include "base/thread.h" |
17 #include "base/thread_restrictions.h" | 17 #include "base/thread_restrictions.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "chrome/browser/browser_process.h" | |
20 #include "chrome/browser/browser_thread.h" | 19 #include "chrome/browser/browser_thread.h" |
21 #include "chrome/browser/shell_dialogs.h" | 20 #include "chrome/browser/shell_dialogs.h" |
22 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
23 | 22 |
24 // The size of the preview we display for selected image files. We set height | 23 // The size of the preview we display for selected image files. We set height |
25 // larger than width because generally there is more free space vertically | 24 // larger than width because generally there is more free space vertically |
26 // than horiztonally (setting the preview image will alway expand the width of | 25 // than horiztonally (setting the preview image will alway expand the width of |
27 // the dialog, but usually not the height). The image's aspect ratio will always | 26 // the dialog, but usually not the height). The image's aspect ratio will always |
28 // be preserved. | 27 // be preserved. |
29 static const int kPreviewWidth = 256; | 28 static const int kPreviewWidth = 256; |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, | 578 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_size(filename, kPreviewWidth, |
580 kPreviewHeight, NULL); | 579 kPreviewHeight, NULL); |
581 g_free(filename); | 580 g_free(filename); |
582 if (pixbuf) { | 581 if (pixbuf) { |
583 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); | 582 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); |
584 g_object_unref(pixbuf); | 583 g_object_unref(pixbuf); |
585 } | 584 } |
586 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), | 585 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), |
587 pixbuf ? TRUE : FALSE); | 586 pixbuf ? TRUE : FALSE); |
588 } | 587 } |
OLD | NEW |