diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-22 19:47:30 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-22 19:47:30 +0000 |
commit | 735d947c3e1abc6787e159354dbba5d0472502fd (patch) | |
tree | 676dfdb7a3a0c217bc9ed51a338e92da1c259cdc | |
parent | 3e7502c979ee67073edd878696275a84847ff85b (diff) | |
download | chromium_src-735d947c3e1abc6787e159354dbba5d0472502fd.zip chromium_src-735d947c3e1abc6787e159354dbba5d0472502fd.tar.gz chromium_src-735d947c3e1abc6787e159354dbba5d0472502fd.tar.bz2 |
GTK: Move code shared by future content/ classes and chrome/ to ui/.
BUG=93804
TEST=none
Review URL: http://codereview.chromium.org/8490029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111193 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_view_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_view_gtk.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/find_bar_gtk.h | 4 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 | ||||
-rw-r--r-- | ui/base/gtk/focus_store_gtk.cc (renamed from chrome/browser/ui/gtk/focus_store_gtk.cc) | 11 | ||||
-rw-r--r-- | ui/base/gtk/focus_store_gtk.h (renamed from chrome/browser/ui/gtk/focus_store_gtk.h) | 16 | ||||
-rw-r--r-- | ui/ui.gyp | 2 |
7 files changed, 24 insertions, 18 deletions
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc index d01cee4..53e6cf3 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc @@ -13,10 +13,7 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "build/build_config.h" -#include "chrome/browser/tab_contents/render_view_context_menu_gtk.h" #include "chrome/browser/tab_contents/tab_contents_view_wrapper_gtk.h" -#include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h" -#include "chrome/browser/ui/gtk/constrained_window_gtk.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_factory.h" #include "content/browser/renderer_host/render_widget_host_view_gtk.h" diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.h b/chrome/browser/tab_contents/tab_contents_view_gtk.h index 488c580..69d9f88 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.h +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.h @@ -12,8 +12,8 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" -#include "chrome/browser/ui/gtk/focus_store_gtk.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "ui/base/gtk/focus_store_gtk.h" #include "ui/base/gtk/gtk_signal.h" #include "ui/base/gtk/owned_widget_gtk.h" @@ -134,7 +134,7 @@ class TabContentsViewGtk : public TabContentsView { // so that we can control the size of the web pages. ui::OwnedWidgetGtk expanded_; - FocusStoreGtk focus_store_; + ui::FocusStoreGtk focus_store_; // The helper object that handles drag destination related interactions with // GTK. diff --git a/chrome/browser/ui/gtk/find_bar_gtk.h b/chrome/browser/ui/gtk/find_bar_gtk.h index 709d9c0..ad3222c 100644 --- a/chrome/browser/ui/gtk/find_bar_gtk.h +++ b/chrome/browser/ui/gtk/find_bar_gtk.h @@ -11,10 +11,10 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/ui/find_bar/find_bar.h" -#include "chrome/browser/ui/gtk/focus_store_gtk.h" #include "chrome/browser/ui/gtk/slide_animator_gtk.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "ui/base/gtk/focus_store_gtk.h" #include "ui/base/gtk/gtk_signal.h" #include "ui/base/gtk/owned_widget_gtk.h" #include "ui/gfx/point.h" @@ -218,7 +218,7 @@ class FindBarGtk : public FindBar, FindBarController* find_bar_controller_; // Saves where the focus used to be whenever we get it. - FocusStoreGtk focus_store_; + ui::FocusStoreGtk focus_store_; // If true, the change signal for the text entry is ignored. bool ignore_changed_signal_; diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index aa14297..2cb50dd 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3002,8 +3002,6 @@ 'browser/ui/gtk/first_run_bubble.h', 'browser/ui/gtk/first_run_dialog.cc', 'browser/ui/gtk/first_run_dialog.h', - 'browser/ui/gtk/focus_store_gtk.cc', - 'browser/ui/gtk/focus_store_gtk.h', 'browser/ui/gtk/fullscreen_exit_bubble_gtk.cc', 'browser/ui/gtk/fullscreen_exit_bubble_gtk.h', 'browser/ui/gtk/gconf_titlebar_listener.cc', diff --git a/chrome/browser/ui/gtk/focus_store_gtk.cc b/ui/base/gtk/focus_store_gtk.cc index 7eb9047..b98787c 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 diff --git a/chrome/browser/ui/gtk/focus_store_gtk.h b/ui/base/gtk/focus_store_gtk.h index 012332e..e237ee1 100644 --- a/chrome/browser/ui/gtk/focus_store_gtk.h +++ b/ui/base/gtk/focus_store_gtk.h @@ -2,19 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_ -#define CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_ +#ifndef UI_BASE_GTK_FOCUS_STORE_GTK_H_ +#define UI_BASE_GTK_FOCUS_STORE_GTK_H_ #pragma once #include "base/basictypes.h" +#include "ui/base/ui_export.h" typedef struct _GtkWidget GtkWidget; -class FocusStoreGtk { +namespace ui { + +class UI_EXPORT FocusStoreGtk { public: FocusStoreGtk(); - - virtual ~FocusStoreGtk(); + ~FocusStoreGtk(); GtkWidget* widget() const { return widget_; } @@ -40,4 +42,6 @@ class FocusStoreGtk { DISALLOW_COPY_AND_ASSIGN(FocusStoreGtk); }; -#endif // CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_ +} // namespace ui + +#endif // UI_BASE_GTK_FOCUS_STORE_GTK_H_ @@ -105,6 +105,8 @@ 'base/events.h', 'base/gtk/event_synthesis_gtk.cc', 'base/gtk/event_synthesis_gtk.h', + 'base/gtk/focus_store_gtk.cc', + 'base/gtk/focus_store_gtk.h', 'base/gtk/g_object_destructor_filo.cc', 'base/gtk/g_object_destructor_filo.h', 'base/gtk/gtk_expanded_container.cc', |