Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: ui/views/mus/window_tree_host_mus.cc

Issue 2412593002: IME for Mus: Send ack for key events after IME driver processes the event. (Closed)
Patch Set: Addressed feedback. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "services/ui/public/cpp/window.h" 8 #include "services/ui/public/cpp/window.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/aura/window_event_dispatcher.h" 10 #include "ui/aura/window_event_dispatcher.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // Initialize the stub platform window bounds to those of the ui::Window. 47 // Initialize the stub platform window bounds to those of the ui::Window.
48 platform_window()->SetBounds(window->bounds()); 48 platform_window()->SetBounds(window->bounds());
49 49
50 // The location of events is already transformed, and there is no way to 50 // The location of events is already transformed, and there is no way to
51 // correctly determine the reverse transform. So, don't attempt to transform 51 // correctly determine the reverse transform. So, don't attempt to transform
52 // event locations, else the root location is wrong. 52 // event locations, else the root location is wrong.
53 // TODO(sky): we need to transform for device scale though. 53 // TODO(sky): we need to transform for device scale though.
54 dispatcher()->set_transform_events(false); 54 dispatcher()->set_transform_events(false);
55 compositor()->SetHostHasTransparentBackground(true); 55 compositor()->SetHostHasTransparentBackground(true);
56
57 input_method_ = base::MakeUnique<InputMethodMus>(this, window);
58 SetSharedInputMethod(input_method_.get());
59 } 56 }
60 57
61 WindowTreeHostMus::~WindowTreeHostMus() { 58 WindowTreeHostMus::~WindowTreeHostMus() {
62 DestroyCompositor(); 59 DestroyCompositor();
63 DestroyDispatcher(); 60 DestroyDispatcher();
64 } 61 }
65 62
66 void WindowTreeHostMus::InitInputMethod(shell::Connector* connector) {
67 input_method_->Init(connector);
68 }
69
70 void WindowTreeHostMus::DispatchEvent(ui::Event* event) { 63 void WindowTreeHostMus::DispatchEvent(ui::Event* event) {
71 if (event->IsKeyEvent() && GetInputMethod()) { 64 // Key events are sent to InputMethodMus directly from NativeWidgetMus.
72 GetInputMethod()->DispatchKeyEvent(event->AsKeyEvent()); 65 DCHECK(!event->IsKeyEvent());
73 return;
74 }
75 WindowTreeHostPlatform::DispatchEvent(event); 66 WindowTreeHostPlatform::DispatchEvent(event);
76 } 67 }
77 68
78 void WindowTreeHostMus::OnClosed() { 69 void WindowTreeHostMus::OnClosed() {
79 if (native_widget_) 70 if (native_widget_)
80 native_widget_->OnPlatformWindowClosed(); 71 native_widget_->OnPlatformWindowClosed();
81 } 72 }
82 73
83 void WindowTreeHostMus::OnActivationChanged(bool active) { 74 void WindowTreeHostMus::OnActivationChanged(bool active) {
84 if (active) 75 if (active)
85 GetInputMethod()->OnFocus(); 76 GetInputMethod()->OnFocus();
86 else 77 else
87 GetInputMethod()->OnBlur(); 78 GetInputMethod()->OnBlur();
88 if (native_widget_) 79 if (native_widget_)
89 native_widget_->OnActivationChanged(active); 80 native_widget_->OnActivationChanged(active);
90 WindowTreeHostPlatform::OnActivationChanged(active); 81 WindowTreeHostPlatform::OnActivationChanged(active);
91 } 82 }
92 83
93 void WindowTreeHostMus::OnCloseRequest() { 84 void WindowTreeHostMus::OnCloseRequest() {
94 OnHostCloseRequested(); 85 OnHostCloseRequested();
95 } 86 }
96 87
97 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() { 88 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() {
98 // TODO: This should read the profile from mus. crbug.com/647510 89 // TODO: This should read the profile from mus. crbug.com/647510
99 return gfx::ICCProfile(); 90 return gfx::ICCProfile();
100 } 91 }
101 92
102 } // namespace views 93 } // namespace views
OLDNEW
« ui/views/mus/input_method_mus.cc ('K') | « ui/views/mus/window_tree_host_mus.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698