diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 23:15:10 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 23:15:10 +0000 |
commit | 0aaec000440c2453f20265a7b580efc4ad10b282 (patch) | |
tree | c1739e498cf814750a0c63495a3ebca358117261 /views/controls/native/native_view_host_gtk.cc | |
parent | f5c8a1596de89f2f3010186b03cc2378d23254ae (diff) | |
download | chromium_src-0aaec000440c2453f20265a7b580efc4ad10b282.zip chromium_src-0aaec000440c2453f20265a7b580efc4ad10b282.tar.gz chromium_src-0aaec000440c2453f20265a7b580efc4ad10b282.tar.bz2 |
Relanding the NativeViewHost refactoring (it was breaking the ChromeOS build).
Refactoring some of the NativeViewHost and NativeControl focus management so their consumers don't have to explicitly set the focused view.
See original review:
http://codereview.chromium.org/235011/show
BUG=None
TEST=Run all tests. Make sure focus is stored/restored properly in Chrome.
TBR=ben
Review URL: http://codereview.chromium.org/246032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27563 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/native/native_view_host_gtk.cc')
-rw-r--r-- | views/controls/native/native_view_host_gtk.cc | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/views/controls/native/native_view_host_gtk.cc b/views/controls/native/native_view_host_gtk.cc index 581f08d..ac761b88 100644 --- a/views/controls/native/native_view_host_gtk.cc +++ b/views/controls/native/native_view_host_gtk.cc @@ -48,7 +48,7 @@ void NativeViewHostGtk::NativeViewAttached() { } if (!focus_signal_id_) { - focus_signal_id_ = g_signal_connect(G_OBJECT(host_->native_view()), + focus_signal_id_ = g_signal_connect(G_OBJECT(host_->focus_native_view()), "focus-in-event", G_CALLBACK(CallFocusIn), this); } @@ -70,7 +70,7 @@ void NativeViewHostGtk::NativeViewDetaching() { destroy_signal_id_); destroy_signal_id_ = 0; - g_signal_handler_disconnect(G_OBJECT(host_->native_view()), + g_signal_handler_disconnect(G_OBJECT(host_->focus_native_view()), focus_signal_id_); focus_signal_id_ = 0; @@ -165,11 +165,6 @@ void NativeViewHostGtk::HideWidget() { gtk_widget_hide(fixed_); } -void NativeViewHostGtk::SetFocus() { - DCHECK(host_->native_view()); - gtk_widget_grab_focus(host_->native_view()); -} - //////////////////////////////////////////////////////////////////////////////// // NativeViewHostGtk, private: @@ -216,19 +211,11 @@ void NativeViewHostGtk::CallDestroy(GtkObject* object, } // static -void NativeViewHostGtk::CallFocusIn(GtkWidget* widget, - GdkEventFocus* event, - NativeViewHostGtk* host) { - FocusManager* focus_manager = - FocusManager::GetFocusManagerForNativeView(widget); - if (!focus_manager) { - // TODO(jcampan): http://crbug.com/21378 Reenable this NOTREACHED() when the - // options page is only based on views. - // NOTREACHED(); - NOTIMPLEMENTED(); - return; - } - focus_manager->SetFocusedView(host->host_->focus_view()); +gboolean NativeViewHostGtk::CallFocusIn(GtkWidget* widget, + GdkEventFocus* event, + NativeViewHostGtk* host) { + host->host_->GotNativeFocus(); + return false; } //////////////////////////////////////////////////////////////////////////////// |