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

Unified Diff: chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc

Issue 221813010: Sets transient for PrintDialogGtk2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
index 4f27d86798396fce033f2aa2bfc633d7b51ee965..005dbb2432f1359f409f11a0f74d09df3bf02a32 100644
--- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
+++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <gdk/gdk.h>
-#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <map>
#include <set>
@@ -21,34 +19,15 @@
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/ui/libgtk2ui/gtk2_signal.h"
+#include "chrome/browser/ui/libgtk2ui/gtk2_util.h"
#include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h"
#include "grit/ui_strings.h"
#include "ui/aura/window_observer.h"
-#include "ui/aura/window_tree_host.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/shell_dialogs/select_file_dialog.h"
namespace {
-const char kAuraTransientParent[] = "aura-transient-parent";
-
-// Set |dialog| as transient for |parent|, which will keep it on top and center
-// it above |parent|.
-void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent) {
- gtk_widget_realize(dialog);
- GdkWindow* gdk_window = gtk_widget_get_window(dialog);
-
- // TODO(erg): Check to make sure we're using X11 if wayland or some other
- // display server ever happens. Otherwise, this will crash.
- XSetTransientForHint(GDK_WINDOW_XDISPLAY(gdk_window),
- GDK_WINDOW_XID(gdk_window),
- parent->GetHost()->GetAcceleratedWidget());
-
- // We also set the |parent| as a property of |dialog|, so that we can unlink
- // the two later.
- g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, parent);
-}
-
// Makes sure that .jpg also shows .JPG.
gboolean FileFilterCaseInsensitive(const GtkFileFilterInfo* file_info,
std::string* file_extension) {
@@ -208,10 +187,9 @@ void SelectFileDialogImplGTK::OnWindowDestroying(aura::Window* window) {
// Remove the |parent| property associated with the |dialog|.
for (std::set<GtkWidget*>::iterator it = dialogs_.begin();
it != dialogs_.end(); ++it) {
- aura::Window* parent = reinterpret_cast<aura::Window*>(
- g_object_get_data(G_OBJECT(*it), kAuraTransientParent));
+ aura::Window* parent = GetAuraTransientParent(*it);
if (parent == window)
- g_object_set_data(G_OBJECT(*it), kAuraTransientParent, NULL);
+ ClearAuraTransientParent(*it);
}
std::set<aura::Window*>::iterator iter = parents_.find(window);
@@ -525,8 +503,7 @@ void SelectFileDialogImplGTK::FileDialogDestroyed(GtkWidget* dialog) {
// windows got destroyed, or 2) when the parent tab has been opened by
// 'Open Link in New Tab' context menu on a downloadable item and
// the tab has no content (see the comment in SelectFile as well).
- aura::Window* parent = reinterpret_cast<aura::Window*>(
- g_object_get_data(G_OBJECT(dialog), kAuraTransientParent));
+ aura::Window* parent = GetAuraTransientParent(dialog);
if (!parent)
return;
std::set<aura::Window*>::iterator iter = parents_.find(parent);
« no previous file with comments | « chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698