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

Side by Side Diff: views/controls/native_control_gtk.cc

Issue 231022: Reverting 27113. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/native_control_gtk.h ('k') | views/controls/native_control_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "views/controls/native_control_gtk.h" 5 #include "views/controls/native_control_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "views/focus/focus_manager.h" 10 #include "views/focus/focus_manager.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void NativeControlGtk::Focus() { 56 void NativeControlGtk::Focus() {
57 DCHECK(native_view()); 57 DCHECK(native_view());
58 gtk_widget_grab_focus(native_view()); 58 gtk_widget_grab_focus(native_view());
59 } 59 }
60 60
61 void NativeControlGtk::NativeControlCreated(GtkWidget* native_control) { 61 void NativeControlGtk::NativeControlCreated(GtkWidget* native_control) {
62 Attach(native_control); 62 Attach(native_control);
63 63
64 // Update the newly created GtkWdigetwith any resident enabled state. 64 // Update the newly created GtkWdigetwith any resident enabled state.
65 gtk_widget_set_sensitive(native_view(), IsEnabled()); 65 gtk_widget_set_sensitive(native_view(), IsEnabled());
66
67 // Listen for focus change event to update the FocusManager focused view.
68 g_signal_connect(G_OBJECT(native_control), "focus-in-event",
69 G_CALLBACK(CallFocusIn), this);
70 }
71
72 // static
73 void NativeControlGtk::CallFocusIn(GtkWidget* widget,
74 GdkEventFocus* event,
75 NativeControlGtk* control) {
76 FocusManager* focus_manager =
77 FocusManager::GetFocusManagerForNativeView(widget);
78 if (!focus_manager) {
79 // TODO(jcampan): http://crbug.com/21378 Reenable this NOTREACHED() when the
80 // options page is only based on views.
81 // NOTREACHED();
82 NOTIMPLEMENTED();
83 return;
84 }
85 focus_manager->SetFocusedView(control->focus_view());
66 } 86 }
67 87
68 } // namespace views 88 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/native_control_gtk.h ('k') | views/controls/native_control_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698