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

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

Issue 2779093004: Update event states in Env when target window has been destroyed. (Closed)
Patch Set: get EnvInputStateController from Env 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 | « ui/aura/env_input_state_controller.cc ('k') | ui/aura/mus/window_tree_client_unittest.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 11 matching lines...) Expand all
22 #include "services/ui/common/accelerator_util.h" 22 #include "services/ui/common/accelerator_util.h"
23 #include "services/ui/public/cpp/gpu/gpu.h" 23 #include "services/ui/public/cpp/gpu/gpu.h"
24 #include "services/ui/public/cpp/property_type_converters.h" 24 #include "services/ui/public/cpp/property_type_converters.h"
25 #include "services/ui/public/interfaces/constants.mojom.h" 25 #include "services/ui/public/interfaces/constants.mojom.h"
26 #include "services/ui/public/interfaces/window_manager.mojom.h" 26 #include "services/ui/public/interfaces/window_manager.mojom.h"
27 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h" 27 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h"
28 #include "ui/aura/client/aura_constants.h" 28 #include "ui/aura/client/aura_constants.h"
29 #include "ui/aura/client/drag_drop_client.h" 29 #include "ui/aura/client/drag_drop_client.h"
30 #include "ui/aura/client/transient_window_client.h" 30 #include "ui/aura/client/transient_window_client.h"
31 #include "ui/aura/env.h" 31 #include "ui/aura/env.h"
32 #include "ui/aura/env_input_state_controller.h"
32 #include "ui/aura/mus/capture_synchronizer.h" 33 #include "ui/aura/mus/capture_synchronizer.h"
33 #include "ui/aura/mus/drag_drop_controller_mus.h" 34 #include "ui/aura/mus/drag_drop_controller_mus.h"
34 #include "ui/aura/mus/focus_synchronizer.h" 35 #include "ui/aura/mus/focus_synchronizer.h"
35 #include "ui/aura/mus/in_flight_change.h" 36 #include "ui/aura/mus/in_flight_change.h"
36 #include "ui/aura/mus/input_method_mus.h" 37 #include "ui/aura/mus/input_method_mus.h"
37 #include "ui/aura/mus/mus_context_factory.h" 38 #include "ui/aura/mus/mus_context_factory.h"
38 #include "ui/aura/mus/property_converter.h" 39 #include "ui/aura/mus/property_converter.h"
39 #include "ui/aura/mus/property_utils.h" 40 #include "ui/aura/mus/property_utils.h"
40 #include "ui/aura/mus/window_manager_delegate.h" 41 #include "ui/aura/mus/window_manager_delegate.h"
41 #include "ui/aura/mus/window_mus.h" 42 #include "ui/aura/mus/window_mus.h"
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 } 1296 }
1296 1297
1297 if (matches_pointer_watcher && has_pointer_watcher_) { 1298 if (matches_pointer_watcher && has_pointer_watcher_) {
1298 DCHECK(event->IsPointerEvent()); 1299 DCHECK(event->IsPointerEvent());
1299 std::unique_ptr<ui::Event> event_in_dip(ui::Event::Clone(*event)); 1300 std::unique_ptr<ui::Event> event_in_dip(ui::Event::Clone(*event));
1300 ConvertEventLocationToDip(display_id, event_in_dip->AsLocatedEvent()); 1301 ConvertEventLocationToDip(display_id, event_in_dip->AsLocatedEvent());
1301 delegate_->OnPointerEventObserved(*event_in_dip->AsPointerEvent(), 1302 delegate_->OnPointerEventObserved(*event_in_dip->AsPointerEvent(),
1302 window ? window->GetWindow() : nullptr); 1303 window ? window->GetWindow() : nullptr);
1303 } 1304 }
1304 1305
1305 // TODO: use |display_id| to find host and send there. 1306 // If the window has already been deleted, use |event| to update event states
1307 // kept in aura::Env.
1306 if (!window || !window->GetWindow()->GetHost()) { 1308 if (!window || !window->GetWindow()->GetHost()) {
1309 EnvInputStateController* env_controller =
1310 Env::GetInstance()->env_controller();
1311 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get());
1312 if (mapped_event->IsMouseEvent()) {
1313 env_controller->UpdateStateForMouseEvent(nullptr,
1314 *mapped_event->AsMouseEvent());
1315 } else if (mapped_event->IsTouchEvent()) {
1316 env_controller->UpdateStateForTouchEvent(*mapped_event->AsTouchEvent());
1317 }
1307 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); 1318 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED);
1308 return; 1319 return;
1309 } 1320 }
1310 1321
1311 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); 1322 EventAckHandler ack_handler(CreateEventResultCallback(event_id));
1312 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or 1323 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or
1313 // ui::TouchEvent once we have proper support for pointer events. 1324 // ui::TouchEvent once we have proper support for pointer events.
1314 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get()); 1325 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get());
1315 DispatchEventToTarget(mapped_event.get(), window); 1326 DispatchEventToTarget(mapped_event.get(), window);
1316 ack_handler.set_handled(mapped_event->handled()); 1327 ack_handler.set_handled(mapped_event->handled());
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 2039 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
2029 this, capture_synchronizer_.get(), window)); 2040 this, capture_synchronizer_.get(), window));
2030 } 2041 }
2031 2042
2032 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 2043 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
2033 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 2044 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
2034 this, focus_synchronizer_.get(), window)); 2045 this, focus_synchronizer_.get(), window));
2035 } 2046 }
2036 2047
2037 } // namespace aura 2048 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/env_input_state_controller.cc ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698