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

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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "ui/aura/mus/window_tree_client_test_observer.h" 45 #include "ui/aura/mus/window_tree_client_test_observer.h"
46 #include "ui/aura/mus/window_tree_host_mus.h" 46 #include "ui/aura/mus/window_tree_host_mus.h"
47 #include "ui/aura/mus/window_tree_host_mus_init_params.h" 47 #include "ui/aura/mus/window_tree_host_mus_init_params.h"
48 #include "ui/aura/window.h" 48 #include "ui/aura/window.h"
49 #include "ui/aura/window_delegate.h" 49 #include "ui/aura/window_delegate.h"
50 #include "ui/aura/window_tracker.h" 50 #include "ui/aura/window_tracker.h"
51 #include "ui/base/layout.h" 51 #include "ui/base/layout.h"
52 #include "ui/base/ui_base_types.h" 52 #include "ui/base/ui_base_types.h"
53 #include "ui/display/screen.h" 53 #include "ui/display/screen.h"
54 #include "ui/events/event.h" 54 #include "ui/events/event.h"
55 #include "ui/events/event_sink.h"
55 #include "ui/gfx/geometry/dip_util.h" 56 #include "ui/gfx/geometry/dip_util.h"
56 #include "ui/gfx/geometry/insets.h" 57 #include "ui/gfx/geometry/insets.h"
57 #include "ui/gfx/geometry/size.h" 58 #include "ui/gfx/geometry/size.h"
58 59
59 #if defined(HiWord) 60 #if defined(HiWord)
60 #undef HiWord 61 #undef HiWord
61 #endif 62 #endif
62 #if defined(LoWord) 63 #if defined(LoWord)
63 #undef LoWord 64 #undef LoWord
64 #endif 65 #endif
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 1276
1276 void WindowTreeClient::OnWindowInputEvent(uint32_t event_id, 1277 void WindowTreeClient::OnWindowInputEvent(uint32_t event_id,
1277 Id window_id, 1278 Id window_id,
1278 int64_t display_id, 1279 int64_t display_id,
1279 std::unique_ptr<ui::Event> event, 1280 std::unique_ptr<ui::Event> event,
1280 bool matches_pointer_watcher) { 1281 bool matches_pointer_watcher) {
1281 DCHECK(event); 1282 DCHECK(event);
1282 1283
1283 WindowMus* window = GetWindowByServerId(window_id); // May be null. 1284 WindowMus* window = GetWindowByServerId(window_id); // May be null.
1284 1285
1285 if (event->IsKeyEvent()) {
1286 DCHECK(!matches_pointer_watcher); // PointerWatcher isn't for key events.
1287 if (!window || !window->GetWindow()->GetHost()) {
1288 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED);
1289 return;
1290 }
1291 InputMethodMus* input_method = GetWindowTreeHostMus(window)->input_method();
1292 input_method->DispatchKeyEvent(event->AsKeyEvent(),
1293 CreateEventResultCallback(event_id));
1294 return;
1295 }
1296
1297 if (matches_pointer_watcher && has_pointer_watcher_) { 1286 if (matches_pointer_watcher && has_pointer_watcher_) {
1298 DCHECK(event->IsPointerEvent()); 1287 DCHECK(event->IsPointerEvent());
1299 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));
1300 ConvertEventLocationToDip(display_id, event_in_dip->AsLocatedEvent()); 1289 ConvertEventLocationToDip(display_id, event_in_dip->AsLocatedEvent());
1301 delegate_->OnPointerEventObserved(*event_in_dip->AsPointerEvent(), 1290 delegate_->OnPointerEventObserved(*event_in_dip->AsPointerEvent(),
1302 window ? window->GetWindow() : nullptr); 1291 window ? window->GetWindow() : nullptr);
1303 } 1292 }
1304 1293
1305 // TODO: use |display_id| to find host and send there. 1294 // TODO: use |display_id| to find host and send there.
1306 if (!window || !window->GetWindow()->GetHost()) { 1295 if (!window || !window->GetWindow()->GetHost()) {
1307 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); 1296 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED);
1308 return; 1297 return;
1309 } 1298 }
1310 1299
1300 if (event->IsKeyEvent()) {
1301 InputMethodMus* input_method = GetWindowTreeHostMus(window)->input_method();
1302 if (input_method) {
1303 input_method->DispatchKeyEvent(event->AsKeyEvent(),
1304 CreateEventResultCallback(event_id));
1305 return;
1306 }
1307 }
1308
1311 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); 1309 EventAckHandler ack_handler(CreateEventResultCallback(event_id));
1312 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or 1310 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or
1313 // ui::TouchEvent once we have proper support for pointer events. 1311 // ui::TouchEvent once we have proper support for pointer events.
1314 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get()); 1312 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get());
1315 DispatchEventToTarget(mapped_event.get(), window); 1313 DispatchEventToTarget(mapped_event.get(), window);
1316 ack_handler.set_handled(mapped_event->handled()); 1314 ack_handler.set_handled(mapped_event->handled());
1317 } 1315 }
1318 1316
1319 void WindowTreeClient::OnPointerEventObserved(std::unique_ptr<ui::Event> event, 1317 void WindowTreeClient::OnPointerEventObserved(std::unique_ptr<ui::Event> event,
1320 uint32_t window_id, 1318 uint32_t window_id,
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 2026 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
2029 this, capture_synchronizer_.get(), window)); 2027 this, capture_synchronizer_.get(), window));
2030 } 2028 }
2031 2029
2032 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 2030 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
2033 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 2031 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
2034 this, focus_synchronizer_.get(), window)); 2032 this, focus_synchronizer_.get(), window));
2035 } 2033 }
2036 2034
2037 } // namespace aura 2035 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698