OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/views/native_widget_view_manager.h" | 5 #include "mojo/views/native_widget_view_manager.h" |
6 | 6 |
7 #include "mojo/aura/window_tree_host_mojo.h" | 7 #include "mojo/aura/window_tree_host_mojo.h" |
8 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" | 8 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/default_capture_client.h" | 10 #include "ui/aura/client/default_capture_client.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 namespace mojo { | 26 namespace mojo { |
27 namespace { | 27 namespace { |
28 | 28 |
29 // TODO: figure out what this should be. | 29 // TODO: figure out what this should be. |
30 class FocusRulesImpl : public wm::BaseFocusRules { | 30 class FocusRulesImpl : public wm::BaseFocusRules { |
31 public: | 31 public: |
32 FocusRulesImpl() {} | 32 FocusRulesImpl() {} |
33 virtual ~FocusRulesImpl() {} | 33 virtual ~FocusRulesImpl() {} |
34 | 34 |
35 virtual bool SupportsChildActivation(aura::Window* window) const OVERRIDE { | 35 virtual bool SupportsChildActivation(aura::Window* window) const override { |
36 return true; | 36 return true; |
37 } | 37 } |
38 | 38 |
39 private: | 39 private: |
40 DISALLOW_COPY_AND_ASSIGN(FocusRulesImpl); | 40 DISALLOW_COPY_AND_ASSIGN(FocusRulesImpl); |
41 }; | 41 }; |
42 | 42 |
43 class MinimalInputEventFilter : public ui::internal::InputMethodDelegate, | 43 class MinimalInputEventFilter : public ui::internal::InputMethodDelegate, |
44 public ui::EventHandler { | 44 public ui::EventHandler { |
45 public: | 45 public: |
(...skipping 12 matching lines...) Expand all Loading... |
58 } | 58 } |
59 | 59 |
60 virtual ~MinimalInputEventFilter() { | 60 virtual ~MinimalInputEventFilter() { |
61 root_->RemovePreTargetHandler(this); | 61 root_->RemovePreTargetHandler(this); |
62 root_->SetProperty(aura::client::kRootWindowInputMethodKey, | 62 root_->SetProperty(aura::client::kRootWindowInputMethodKey, |
63 static_cast<ui::InputMethod*>(NULL)); | 63 static_cast<ui::InputMethod*>(NULL)); |
64 } | 64 } |
65 | 65 |
66 private: | 66 private: |
67 // ui::EventHandler: | 67 // ui::EventHandler: |
68 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { | 68 virtual void OnKeyEvent(ui::KeyEvent* event) override { |
69 // See the comment in InputMethodEventFilter::OnKeyEvent() for details. | 69 // See the comment in InputMethodEventFilter::OnKeyEvent() for details. |
70 if (event->IsTranslated()) { | 70 if (event->IsTranslated()) { |
71 event->SetTranslated(false); | 71 event->SetTranslated(false); |
72 } else { | 72 } else { |
73 if (input_method_->DispatchKeyEvent(*event)) | 73 if (input_method_->DispatchKeyEvent(*event)) |
74 event->StopPropagation(); | 74 event->StopPropagation(); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 // ui::internal::InputMethodDelegate: | 78 // ui::internal::InputMethodDelegate: |
79 virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) OVERRIDE { | 79 virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override { |
80 // See the comment in InputMethodEventFilter::DispatchKeyEventPostIME() for | 80 // See the comment in InputMethodEventFilter::DispatchKeyEventPostIME() for |
81 // details. | 81 // details. |
82 ui::KeyEvent aura_event(event); | 82 ui::KeyEvent aura_event(event); |
83 aura_event.SetTranslated(true); | 83 aura_event.SetTranslated(true); |
84 ui::EventDispatchDetails details = | 84 ui::EventDispatchDetails details = |
85 root_->GetHost()->dispatcher()->OnEventFromSource(&aura_event); | 85 root_->GetHost()->dispatcher()->OnEventFromSource(&aura_event); |
86 return aura_event.handled() || details.dispatcher_destroyed; | 86 return aura_event.handled() || details.dispatcher_destroyed; |
87 } | 87 } |
88 | 88 |
89 aura::Window* root_; | 89 aura::Window* root_; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 | 149 |
150 void NativeWidgetViewManager::OnViewInputEvent(View* view, | 150 void NativeWidgetViewManager::OnViewInputEvent(View* view, |
151 const EventPtr& event) { | 151 const EventPtr& event) { |
152 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >()); | 152 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >()); |
153 if (ui_event) | 153 if (ui_event) |
154 window_tree_host_->SendEventToProcessor(ui_event.get()); | 154 window_tree_host_->SendEventToProcessor(ui_event.get()); |
155 } | 155 } |
156 | 156 |
157 } // namespace mojo | 157 } // namespace mojo |
OLD | NEW |