| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mus/native_widget_mus.h" | 5 #include "ui/views/mus/native_widget_mus.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "components/mus/public/cpp/property_type_converters.h" | 9 #include "components/mus/public/cpp/property_type_converters.h" |
| 10 #include "components/mus/public/cpp/window.h" | 10 #include "components/mus/public/cpp/window.h" |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 // If such object is not attached, character events might be sent (e.g. on | 814 // If such object is not attached, character events might be sent (e.g. on |
| 815 // Windows). In this case, we just skip these. | 815 // Windows). In this case, we just skip these. |
| 816 return; | 816 return; |
| 817 } | 817 } |
| 818 // Renderer may send a key event back to us if the key event wasn't handled, | 818 // Renderer may send a key event back to us if the key event wasn't handled, |
| 819 // and the window may be invisible by that time. | 819 // and the window may be invisible by that time. |
| 820 if (!content_->IsVisible()) | 820 if (!content_->IsVisible()) |
| 821 return; | 821 return; |
| 822 | 822 |
| 823 native_widget_delegate_->OnKeyEvent(event); | 823 native_widget_delegate_->OnKeyEvent(event); |
| 824 if (event->handled()) | |
| 825 return; | |
| 826 | |
| 827 if (GetWidget()->HasFocusManager() && | |
| 828 !GetWidget()->GetFocusManager()->OnKeyEvent(*event)) | |
| 829 event->SetHandled(); | |
| 830 } | 824 } |
| 831 | 825 |
| 832 void NativeWidgetMus::OnMouseEvent(ui::MouseEvent* event) { | 826 void NativeWidgetMus::OnMouseEvent(ui::MouseEvent* event) { |
| 833 // TODO(sky): forward to tooltipmanager. See NativeWidgetDesktopAura. | 827 // TODO(sky): forward to tooltipmanager. See NativeWidgetDesktopAura. |
| 834 DCHECK(content_->IsVisible()); | 828 DCHECK(content_->IsVisible()); |
| 835 native_widget_delegate_->OnMouseEvent(event); | 829 native_widget_delegate_->OnMouseEvent(event); |
| 836 // WARNING: we may have been deleted. | 830 // WARNING: we may have been deleted. |
| 837 } | 831 } |
| 838 | 832 |
| 839 void NativeWidgetMus::OnScrollEvent(ui::ScrollEvent* event) { | 833 void NativeWidgetMus::OnScrollEvent(ui::ScrollEvent* event) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 854 | 848 |
| 855 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) { | 849 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) { |
| 856 native_widget_delegate_->OnGestureEvent(event); | 850 native_widget_delegate_->OnGestureEvent(event); |
| 857 } | 851 } |
| 858 | 852 |
| 859 void NativeWidgetMus::OnHostCloseRequested(const aura::WindowTreeHost* host) { | 853 void NativeWidgetMus::OnHostCloseRequested(const aura::WindowTreeHost* host) { |
| 860 GetWidget()->Close(); | 854 GetWidget()->Close(); |
| 861 } | 855 } |
| 862 | 856 |
| 863 } // namespace views | 857 } // namespace views |
| OLD | NEW |