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