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

Side by Side Diff: views/focus/focus_manager_gtk.cc

Issue 203073: Lands http://codereview.chromium.org/193032 for Charlie:... (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.cc ('k') | views/window/dialog_client_view.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <gtk/gtk.h> 5 #include <gtk/gtk.h>
6 6
7 #include "views/focus/focus_manager.h" 7 #include "views/focus/focus_manager.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "views/widget/widget_gtk.h" 10 #include "views/widget/widget_gtk.h"
11 11
12 namespace views { 12 namespace views {
13 13
14 void FocusManager::ClearNativeFocus() { 14 void FocusManager::ClearNativeFocus() {
15 gtk_widget_grab_focus(widget_->GetNativeView()); 15 gtk_widget_grab_focus(widget_->GetNativeView());
16 } 16 }
17 17
18 void FocusManager::FocusNativeView(gfx::NativeView native_view) { 18 void FocusManager::FocusNativeView(gfx::NativeView native_view) {
19 if (native_view && !gtk_widget_is_focus(native_view)) 19 if (native_view && !gtk_widget_is_focus(native_view))
20 gtk_widget_grab_focus(native_view); 20 gtk_widget_grab_focus(native_view);
21 } 21 }
22 22
23 // static 23 // static
24 FocusManager* FocusManager::GetFocusManagerForNativeView( 24 FocusManager* FocusManager::GetFocusManagerForNativeView(
25 gfx::NativeView native_view) { 25 gfx::NativeView native_view) {
26 GtkWidget* root = gtk_widget_get_toplevel(native_view); 26 GtkWidget* root = gtk_widget_get_toplevel(native_view);
27 if (!root || !GTK_WIDGET_TOPLEVEL(root)) 27 if (!root || !GTK_WIDGET_TOPLEVEL(root))
28 return NULL; 28 return NULL;
29 29
30 WidgetGtk* widget = WidgetGtk::GetViewForNative(root); 30 WidgetGtk* widget = WidgetGtk::GetViewForNative(root);
31 if (!widget) { 31 if (!widget) {
32 NOTREACHED(); 32 // TODO(jcampan): http://crbug.com/21378 Reenable this NOTREACHED() when the
33 // options page is only based on views.
34 // NOTREACHED();
33 return NULL; 35 return NULL;
34 } 36 }
35 FocusManager* focus_manager = widget->GetFocusManager(); 37 FocusManager* focus_manager = widget->GetFocusManager();
36 DCHECK(focus_manager) << "no FocusManager for top level Widget"; 38 DCHECK(focus_manager) << "no FocusManager for top level Widget";
37 return focus_manager; 39 return focus_manager;
38 } 40 }
39 41
40 } // namespace views 42 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/native_control_gtk.cc ('k') | views/window/dialog_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698