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/window_tree_host_mus.h" | 5 #include "ui/views/mus/window_tree_host_mus.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "components/bitmap_uploader/bitmap_uploader.h" | 8 #include "components/bitmap_uploader/bitmap_uploader.h" |
9 #include "components/mus/public/cpp/window.h" | 9 #include "components/mus/public/cpp/window.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 input_method_.reset(new InputMethodMUS(this, window)); | 65 input_method_.reset(new InputMethodMUS(this, window)); |
66 SetSharedInputMethod(input_method_.get()); | 66 SetSharedInputMethod(input_method_.get()); |
67 } | 67 } |
68 | 68 |
69 WindowTreeHostMus::~WindowTreeHostMus() { | 69 WindowTreeHostMus::~WindowTreeHostMus() { |
70 DestroyCompositor(); | 70 DestroyCompositor(); |
71 DestroyDispatcher(); | 71 DestroyDispatcher(); |
72 } | 72 } |
73 | 73 |
74 void WindowTreeHostMus::DispatchEvent(ui::Event* event) { | 74 void WindowTreeHostMus::DispatchEvent(ui::Event* event) { |
75 if (event->IsKeyEvent() && GetInputMethod()) { | 75 // TODO(markdittmer): This flow is going away. For now, it is only intended |
| 76 // for managing key events. |
| 77 DCHECK(event->IsKeyEvent()); |
| 78 if (GetInputMethod()) { |
76 GetInputMethod()->DispatchKeyEvent(event->AsKeyEvent()); | 79 GetInputMethod()->DispatchKeyEvent(event->AsKeyEvent()); |
77 event->StopPropagation(); | 80 event->StopPropagation(); |
78 return; | 81 return; |
79 } | 82 } |
80 WindowTreeHostPlatform::DispatchEvent(event); | 83 WindowTreeHostPlatform::DispatchEvent(event); |
81 } | 84 } |
82 | 85 |
83 void WindowTreeHostMus::OnClosed() { | 86 void WindowTreeHostMus::OnClosed() { |
84 if (native_widget_) | 87 if (native_widget_) |
85 native_widget_->OnPlatformWindowClosed(); | 88 native_widget_->OnPlatformWindowClosed(); |
86 } | 89 } |
87 | 90 |
88 void WindowTreeHostMus::OnActivationChanged(bool active) { | 91 void WindowTreeHostMus::OnActivationChanged(bool active) { |
89 if (active) | 92 if (active) |
90 GetInputMethod()->OnFocus(); | 93 GetInputMethod()->OnFocus(); |
91 else | 94 else |
92 GetInputMethod()->OnBlur(); | 95 GetInputMethod()->OnBlur(); |
93 if (native_widget_) | 96 if (native_widget_) |
94 native_widget_->OnActivationChanged(active); | 97 native_widget_->OnActivationChanged(active); |
95 WindowTreeHostPlatform::OnActivationChanged(active); | 98 WindowTreeHostPlatform::OnActivationChanged(active); |
96 } | 99 } |
97 | 100 |
98 void WindowTreeHostMus::OnCloseRequest() { | 101 void WindowTreeHostMus::OnCloseRequest() { |
99 OnHostCloseRequested(); | 102 OnHostCloseRequested(); |
100 } | 103 } |
101 | 104 |
102 } // namespace views | 105 } // namespace views |
OLD | NEW |