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" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // Input ----------------------------------------------------------------------- | 110 // Input ----------------------------------------------------------------------- |
111 | 111 |
112 void RootView::DispatchKeyEvent(ui::KeyEvent* event) { | 112 void RootView::DispatchKeyEvent(ui::KeyEvent* event) { |
113 View* v = NULL; | 113 View* v = NULL; |
114 if (GetFocusManager()) // NULL in unittests. | 114 if (GetFocusManager()) // NULL in unittests. |
115 v = GetFocusManager()->GetFocusedView(); | 115 v = GetFocusManager()->GetFocusedView(); |
116 // Special case to handle right-click context menus triggered by the | 116 // Special case to handle right-click context menus triggered by the |
117 // keyboard. | 117 // keyboard. |
118 if (v && v->enabled() && ((event->key_code() == ui::VKEY_APPS) || | 118 if (v && v->enabled() && ((event->key_code() == ui::VKEY_APPS) || |
119 (event->key_code() == ui::VKEY_F10 && event->IsShiftDown()))) { | 119 (event->key_code() == ui::VKEY_F10 && event->IsShiftDown()))) { |
120 v->ShowContextMenu(v->GetKeyboardContextMenuLocation(), false); | 120 v->ShowContextMenu(v->GetKeyboardContextMenuLocation(), |
| 121 ui::MENU_SOURCE_KEYBOARD); |
121 event->StopPropagation(); | 122 event->StopPropagation(); |
122 return; | 123 return; |
123 } | 124 } |
124 | 125 |
125 for (; v && v != this && !event->handled(); v = v->parent()) | 126 for (; v && v != this && !event->handled(); v = v->parent()) |
126 DispatchEventToTarget(v, event); | 127 DispatchEventToTarget(v, event); |
127 } | 128 } |
128 | 129 |
129 void RootView::DispatchScrollEvent(ui::ScrollEvent* event) { | 130 void RootView::DispatchScrollEvent(ui::ScrollEvent* event) { |
130 for (View* v = GetEventHandlerForPoint(event->location()); | 131 for (View* v = GetEventHandlerForPoint(event->location()); |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 DispatchEventToTarget(p, ¬ify_event); | 684 DispatchEventToTarget(p, ¬ify_event); |
684 } | 685 } |
685 } | 686 } |
686 | 687 |
687 bool RootView::CanDispatchToTarget(ui::EventTarget* target) { | 688 bool RootView::CanDispatchToTarget(ui::EventTarget* target) { |
688 return event_dispatch_target_ == target; | 689 return event_dispatch_target_ == target; |
689 } | 690 } |
690 | 691 |
691 } // namespace internal | 692 } // namespace internal |
692 } // namespace views | 693 } // namespace views |
OLD | NEW |