| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } else { | 59 } else { |
| 60 // The view becomes visible after native control is created. | 60 // The view becomes visible after native control is created. |
| 61 // Layout now. | 61 // Layout now. |
| 62 Layout(); | 62 Layout(); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 void NativeControlGtk::Focus() { | 66 void NativeControlGtk::Focus() { |
| 67 DCHECK(native_view()); | 67 DCHECK(native_view()); |
| 68 gtk_widget_grab_focus(native_view()); | 68 gtk_widget_grab_focus(native_view()); |
| 69 |
| 70 GetParent()->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS); |
| 69 } | 71 } |
| 70 | 72 |
| 71 void NativeControlGtk::NativeControlCreated(GtkWidget* native_control) { | 73 void NativeControlGtk::NativeControlCreated(GtkWidget* native_control) { |
| 72 Attach(native_control); | 74 Attach(native_control); |
| 73 | 75 |
| 74 // Update the newly created GtkWdigetwith any resident enabled state. | 76 // Update the newly created GtkWdigetwith any resident enabled state. |
| 75 gtk_widget_set_sensitive(native_view(), IsEnabled()); | 77 gtk_widget_set_sensitive(native_view(), IsEnabled()); |
| 76 | 78 |
| 77 // Listen for focus change event to update the FocusManager focused view. | 79 // Listen for focus change event to update the FocusManager focused view. |
| 78 g_signal_connect(native_control, "focus-in-event", | 80 g_signal_connect(native_control, "focus-in-event", |
| (...skipping 11 matching lines...) Expand all Loading... |
| 90 // options page is only based on views. | 92 // options page is only based on views. |
| 91 // NOTREACHED(); | 93 // NOTREACHED(); |
| 92 NOTIMPLEMENTED(); | 94 NOTIMPLEMENTED(); |
| 93 return false; | 95 return false; |
| 94 } | 96 } |
| 95 focus_manager->SetFocusedView(control->focus_view()); | 97 focus_manager->SetFocusedView(control->focus_view()); |
| 96 return false; | 98 return false; |
| 97 } | 99 } |
| 98 | 100 |
| 99 } // namespace views | 101 } // namespace views |
| OLD | NEW |