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

Unified Diff: ui/base/gtk/focus_store_gtk.cc

Issue 8490029: GTK: Move code shared by future content/ classes and chrome/ to ui/. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove platform_util method. Created 9 years, 1 month 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 | « ui/base/gtk/focus_store_gtk.h ('k') | ui/ui.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/gtk/focus_store_gtk.cc
diff --git a/chrome/browser/ui/gtk/focus_store_gtk.cc b/ui/base/gtk/focus_store_gtk.cc
similarity index 75%
rename from chrome/browser/ui/gtk/focus_store_gtk.cc
rename to ui/base/gtk/focus_store_gtk.cc
index 7eb904773637a450e44a155cc2616c61cdfc18c1..b98787c30b0df0fed6ea3e8a3e58d41b4282c612 100644
--- a/chrome/browser/ui/gtk/focus_store_gtk.cc
+++ b/ui/base/gtk/focus_store_gtk.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/gtk/focus_store_gtk.h"
+#include "ui/base/gtk/focus_store_gtk.h"
#include <gtk/gtk.h>
-#include "chrome/browser/platform_util.h"
+namespace ui {
FocusStoreGtk::FocusStoreGtk()
: widget_(NULL),
@@ -20,7 +20,10 @@ FocusStoreGtk::~FocusStoreGtk() {
void FocusStoreGtk::Store(GtkWidget* widget) {
GtkWidget* focus_widget = NULL;
if (widget) {
- GtkWindow* window = platform_util::GetTopLevel(widget);
+ // A detached widget won't have a toplevel window as an ancestor, so we
+ // can't assume that the query for toplevel will return a window.
+ GtkWidget* toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
+ GtkWindow* window = GTK_IS_WINDOW(toplevel) ? GTK_WINDOW(toplevel) : NULL;
if (window)
focus_widget = window->focus_widget;
}
@@ -48,3 +51,5 @@ void FocusStoreGtk::DisconnectDestroyHandler() {
widget_ = NULL;
}
}
+
+} // namespace ui
« no previous file with comments | « ui/base/gtk/focus_store_gtk.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698