summaryrefslogtreecommitdiffstats
path: root/views/window
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 13:54:29 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 13:54:29 +0000
commite6269fd0e957510a2536a77e5a2fcabf799ccd20 (patch)
treee2185f9d89325d873fe3bd99ed27baf6224ed578 /views/window
parent1505fa2d80afe698db06150512b26c2d08d0e088 (diff)
downloadchromium_src-e6269fd0e957510a2536a77e5a2fcabf799ccd20.zip
chromium_src-e6269fd0e957510a2536a77e5a2fcabf799ccd20.tar.gz
chromium_src-e6269fd0e957510a2536a77e5a2fcabf799ccd20.tar.bz2
views: implement a TODO to move WidgetGtk::GetWindowForNative to WindowGtk.
BUG=NONE TEST=compiles. Review URL: http://codereview.chromium.org/1640003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48717 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r--views/window/window_gtk.cc15
-rw-r--r--views/window/window_gtk.h8
2 files changed, 21 insertions, 2 deletions
diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc
index 1a5147f..8a3e7b9 100644
--- a/views/window/window_gtk.cc
+++ b/views/window/window_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -366,6 +366,17 @@ gboolean WindowGtk::OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event) {
return WidgetGtk::OnLeaveNotify(widget, event);
}
+// static
+WindowGtk* WindowGtk::GetWindowForNative(GtkWidget* widget) {
+ gpointer user_data = g_object_get_data(G_OBJECT(widget), "chrome-window");
+ return static_cast<WindowGtk*>(user_data);
+}
+
+// static
+void WindowGtk::SetWindowForNative(GtkWidget* widget, WindowGtk* window) {
+ g_object_set_data(G_OBJECT(widget), "chrome-window", window);
+}
+
////////////////////////////////////////////////////////////////////////////////
// WindowGtk, protected:
@@ -405,6 +416,8 @@ void WindowGtk::Init(GtkWindow* parent, const gfx::Rect& bounds) {
UpdateWindowTitle();
SetInitialBounds(parent, bounds);
+ SetWindowForNative(GTK_WIDGET(GetNativeWindow()), this);
+
// if (!IsAppWindow()) {
// notification_registrar_.Add(
// this,
diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h
index 865ac81..fffa6cb 100644
--- a/views/window/window_gtk.h
+++ b/views/window/window_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,6 +69,12 @@ class WindowGtk : public WidgetGtk, public Window {
GdkEventWindowState* event);
virtual gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event);
+ // Gets the WindowGtk in the userdata section of the widget.
+ static WindowGtk* GetWindowForNative(GtkWidget* widget);
+
+ // Sets the WindowGtk in the userdata section of the widget.
+ static void SetWindowForNative(GtkWidget* widget, WindowGtk* window);
+
protected:
// For the constructor.
friend class Window;