Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc

Issue 2165083002: Linux: Refactor X11DesktopHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.h" 5 #include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 12 matching lines...) Expand all
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/strings/sys_string_conversions.h" 24 #include "base/strings/sys_string_conversions.h"
25 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
26 #include "base/threading/thread.h" 26 #include "base/threading/thread.h"
27 #include "base/threading/thread_restrictions.h" 27 #include "base/threading/thread_restrictions.h"
28 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h" 28 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h"
29 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" 29 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h"
30 #include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h" 30 #include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h"
31 #include "ui/aura/window_observer.h" 31 #include "ui/aura/window_observer.h"
32 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
33 #include "ui/events/platform/x11/x11_event_source.h"
33 #include "ui/shell_dialogs/select_file_dialog.h" 34 #include "ui/shell_dialogs/select_file_dialog.h"
34 #include "ui/strings/grit/ui_strings.h" 35 #include "ui/strings/grit/ui_strings.h"
35 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
36 36
37 namespace { 37 namespace {
38 38
39 // Makes sure that .jpg also shows .JPG. 39 // Makes sure that .jpg also shows .JPG.
40 gboolean FileFilterCaseInsensitive(const GtkFileFilterInfo* file_info, 40 gboolean FileFilterCaseInsensitive(const GtkFileFilterInfo* file_info,
41 std::string* file_extension) { 41 std::string* file_extension) {
42 return base::EndsWith(file_info->filename, *file_extension, 42 return base::EndsWith(file_info->filename, *file_extension,
43 base::CompareCase::INSENSITIVE_ASCII); 43 base::CompareCase::INSENSITIVE_ASCII);
44 } 44 }
45 45
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 params_map_[dialog] = params; 162 params_map_[dialog] = params;
163 163
164 // TODO(erg): Figure out how to fake GTK window-to-parent modality without 164 // TODO(erg): Figure out how to fake GTK window-to-parent modality without
165 // having the parent be a real GtkWindow. 165 // having the parent be a real GtkWindow.
166 gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); 166 gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
167 167
168 gtk_widget_show_all(dialog); 168 gtk_widget_show_all(dialog);
169 169
170 // We need to call gtk_window_present after making the widgets visible to make 170 // We need to call gtk_window_present after making the widgets visible to make
171 // sure window gets correctly raised and gets focus. 171 // sure window gets correctly raised and gets focus.
172 int time = views::X11DesktopHandler::get()->wm_user_time_ms(); 172 gtk_window_present_with_time(
173 gtk_window_present_with_time(GTK_WINDOW(dialog), time); 173 GTK_WINDOW(dialog), ui::X11EventSource::GetInstance()->GetTimestamp());
174 } 174 }
175 175
176 void SelectFileDialogImplGTK::AddFilters(GtkFileChooser* chooser) { 176 void SelectFileDialogImplGTK::AddFilters(GtkFileChooser* chooser) {
177 for (size_t i = 0; i < file_types_.extensions.size(); ++i) { 177 for (size_t i = 0; i < file_types_.extensions.size(); ++i) {
178 GtkFileFilter* filter = NULL; 178 GtkFileFilter* filter = NULL;
179 std::set<std::string> fallback_labels; 179 std::set<std::string> fallback_labels;
180 180
181 for (size_t j = 0; j < file_types_.extensions[i].size(); ++j) { 181 for (size_t j = 0; j < file_types_.extensions[i].size(); ++j) {
182 const std::string& current_extension = file_types_.extensions[i][j]; 182 const std::string& current_extension = file_types_.extensions[i][j];
183 if (!current_extension.empty()) { 183 if (!current_extension.empty()) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 g_free(filename); 531 g_free(filename);
532 if (pixbuf) { 532 if (pixbuf) {
533 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); 533 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf);
534 g_object_unref(pixbuf); 534 g_object_unref(pixbuf);
535 } 535 }
536 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), 536 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser),
537 pixbuf ? TRUE : FALSE); 537 pixbuf ? TRUE : FALSE);
538 } 538 }
539 539
540 } // namespace libgtk2ui 540 } // namespace libgtk2ui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc ('k') | chrome/browser/ui/startup/startup_browser_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698