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

Side by Side Diff: ui/aura/mus/window_tree_client.cc

Issue 2831583005: Enable Config::MUS to use classic IME instead of servicified IME. (Closed)
Patch Set: Addressed feedback. Created 3 years, 7 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
« no previous file with comments | « ash/shell.cc ('k') | ui/aura/mus/window_tree_host_mus.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/aura/mus/window_tree_client.h" 5 #include "ui/aura/mus/window_tree_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 1276
1277 void WindowTreeClient::OnWindowInputEvent(uint32_t event_id, 1277 void WindowTreeClient::OnWindowInputEvent(uint32_t event_id,
1278 Id window_id, 1278 Id window_id,
1279 int64_t display_id, 1279 int64_t display_id,
1280 std::unique_ptr<ui::Event> event, 1280 std::unique_ptr<ui::Event> event,
1281 bool matches_pointer_watcher) { 1281 bool matches_pointer_watcher) {
1282 DCHECK(event); 1282 DCHECK(event);
1283 1283
1284 WindowMus* window = GetWindowByServerId(window_id); // May be null. 1284 WindowMus* window = GetWindowByServerId(window_id); // May be null.
1285 1285
1286 if (event->IsKeyEvent()) {
1287 DCHECK(!matches_pointer_watcher); // PointerWatcher isn't for key events.
1288 if (!window || !window->GetWindow()->GetHost()) {
1289 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED);
1290 return;
1291 }
1292 InputMethodMus* input_method = GetWindowTreeHostMus(window)->input_method();
1293 input_method->DispatchKeyEvent(event->AsKeyEvent(),
1294 CreateEventResultCallback(event_id));
1295 return;
1296 }
1297
1298 if (matches_pointer_watcher && has_pointer_watcher_) { 1286 if (matches_pointer_watcher && has_pointer_watcher_) {
1299 DCHECK(event->IsPointerEvent()); 1287 DCHECK(event->IsPointerEvent());
1300 std::unique_ptr<ui::Event> event_in_dip(ui::Event::Clone(*event)); 1288 std::unique_ptr<ui::Event> event_in_dip(ui::Event::Clone(*event));
1301 ConvertEventLocationToDip(display_id, event_in_dip->AsLocatedEvent()); 1289 ConvertEventLocationToDip(display_id, event_in_dip->AsLocatedEvent());
1302 delegate_->OnPointerEventObserved(*event_in_dip->AsPointerEvent(), 1290 delegate_->OnPointerEventObserved(*event_in_dip->AsPointerEvent(),
1303 window ? window->GetWindow() : nullptr); 1291 window ? window->GetWindow() : nullptr);
1304 } 1292 }
1305 1293
1306 // If the window has already been deleted, use |event| to update event states 1294 // If the window has already been deleted, use |event| to update event states
1307 // kept in aura::Env. 1295 // kept in aura::Env.
1308 if (!window || !window->GetWindow()->GetHost()) { 1296 if (!window || !window->GetWindow()->GetHost()) {
1309 EnvInputStateController* env_controller = 1297 EnvInputStateController* env_controller =
1310 Env::GetInstance()->env_controller(); 1298 Env::GetInstance()->env_controller();
1311 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get()); 1299 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get());
1312 if (mapped_event->IsMouseEvent()) { 1300 if (mapped_event->IsMouseEvent()) {
1313 env_controller->UpdateStateForMouseEvent(nullptr, 1301 env_controller->UpdateStateForMouseEvent(nullptr,
1314 *mapped_event->AsMouseEvent()); 1302 *mapped_event->AsMouseEvent());
1315 } else if (mapped_event->IsTouchEvent()) { 1303 } else if (mapped_event->IsTouchEvent()) {
1316 env_controller->UpdateStateForTouchEvent(*mapped_event->AsTouchEvent()); 1304 env_controller->UpdateStateForTouchEvent(*mapped_event->AsTouchEvent());
1317 } 1305 }
1318 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); 1306 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED);
1319 return; 1307 return;
1320 } 1308 }
1321 1309
1310 if (event->IsKeyEvent()) {
1311 InputMethodMus* input_method = GetWindowTreeHostMus(window)->input_method();
1312 if (input_method) {
1313 input_method->DispatchKeyEvent(event->AsKeyEvent(),
1314 CreateEventResultCallback(event_id));
1315 return;
1316 }
1317 }
1318
1322 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); 1319 EventAckHandler ack_handler(CreateEventResultCallback(event_id));
1323 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or 1320 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or
1324 // ui::TouchEvent once we have proper support for pointer events. 1321 // ui::TouchEvent once we have proper support for pointer events.
1325 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get()); 1322 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get());
1326 DispatchEventToTarget(mapped_event.get(), window); 1323 DispatchEventToTarget(mapped_event.get(), window);
1327 ack_handler.set_handled(mapped_event->handled()); 1324 ack_handler.set_handled(mapped_event->handled());
1328 } 1325 }
1329 1326
1330 void WindowTreeClient::OnPointerEventObserved(std::unique_ptr<ui::Event> event, 1327 void WindowTreeClient::OnPointerEventObserved(std::unique_ptr<ui::Event> event,
1331 uint32_t window_id, 1328 uint32_t window_id,
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 2036 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
2040 this, capture_synchronizer_.get(), window)); 2037 this, capture_synchronizer_.get(), window));
2041 } 2038 }
2042 2039
2043 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 2040 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
2044 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 2041 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
2045 this, focus_synchronizer_.get(), window)); 2042 this, focus_synchronizer_.get(), window));
2046 } 2043 }
2047 2044
2048 } // namespace aura 2045 } // namespace aura
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ui/aura/mus/window_tree_host_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698