OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/widget/root_view.h" | 5 #include "ui/views/widget/root_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "ui/base/accessibility/accessible_view_state.h" | 11 #include "ui/base/accessibility/accessible_view_state.h" |
12 #include "ui/base/dragdrop/drag_drop_types.h" | 12 #include "ui/base/dragdrop/drag_drop_types.h" |
| 13 #include "ui/base/event.h" |
13 #include "ui/base/keycodes/keyboard_codes.h" | 14 #include "ui/base/keycodes/keyboard_codes.h" |
14 #include "ui/compositor/layer.h" | 15 #include "ui/compositor/layer.h" |
15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
16 #include "ui/views/focus/view_storage.h" | 17 #include "ui/views/focus/view_storage.h" |
17 #include "ui/views/layout/fill_layout.h" | 18 #include "ui/views/layout/fill_layout.h" |
18 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
19 | 20 |
20 namespace views { | 21 namespace views { |
21 namespace internal { | 22 namespace internal { |
22 | 23 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return child_count() > 0 ? child_at(0) : NULL; | 104 return child_count() > 0 ? child_at(0) : NULL; |
104 } | 105 } |
105 | 106 |
106 void RootView::NotifyNativeViewHierarchyChanged(bool attached, | 107 void RootView::NotifyNativeViewHierarchyChanged(bool attached, |
107 gfx::NativeView native_view) { | 108 gfx::NativeView native_view) { |
108 PropagateNativeViewHierarchyChanged(attached, native_view, this); | 109 PropagateNativeViewHierarchyChanged(attached, native_view, this); |
109 } | 110 } |
110 | 111 |
111 // Input ----------------------------------------------------------------------- | 112 // Input ----------------------------------------------------------------------- |
112 | 113 |
113 bool RootView::OnKeyEvent(const KeyEvent& event) { | 114 bool RootView::OnKeyEvent(const ui::KeyEvent& event) { |
114 bool consumed = false; | 115 bool consumed = false; |
115 | 116 |
116 View* v = NULL; | 117 View* v = NULL; |
117 if (GetFocusManager()) // NULL in unittests. | 118 if (GetFocusManager()) // NULL in unittests. |
118 v = GetFocusManager()->GetFocusedView(); | 119 v = GetFocusManager()->GetFocusedView(); |
119 // Special case to handle right-click context menus triggered by the | 120 // Special case to handle right-click context menus triggered by the |
120 // keyboard. | 121 // keyboard. |
121 if (v && v->enabled() && ((event.key_code() == ui::VKEY_APPS) || | 122 if (v && v->enabled() && ((event.key_code() == ui::VKEY_APPS) || |
122 (event.key_code() == ui::VKEY_F10 && event.IsShiftDown()))) { | 123 (event.key_code() == ui::VKEY_F10 && event.IsShiftDown()))) { |
123 v->ShowContextMenu(v->GetKeyboardContextMenuLocation(), false); | 124 v->ShowContextMenu(v->GetKeyboardContextMenuLocation(), false); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 } | 600 } |
600 | 601 |
601 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { | 602 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { |
602 last_mouse_event_flags_ = event.flags(); | 603 last_mouse_event_flags_ = event.flags(); |
603 last_mouse_event_x_ = event.x(); | 604 last_mouse_event_x_ = event.x(); |
604 last_mouse_event_y_ = event.y(); | 605 last_mouse_event_y_ = event.y(); |
605 } | 606 } |
606 | 607 |
607 } // namespace internal | 608 } // namespace internal |
608 } // namespace views | 609 } // namespace views |
OLD | NEW |