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

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

Issue 2626013005: Change CaptureSynchronizer and PointerWatcherEventRouter to support multiple CaptureClients. (Closed)
Patch Set: separate out changes for removing GetCaptureClient() Created 3 years, 10 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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/auto_reset.h" 13 #include "base/auto_reset.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "mojo/public/cpp/bindings/map.h" 16 #include "mojo/public/cpp/bindings/map.h"
17 #include "services/service_manager/public/cpp/connector.h" 17 #include "services/service_manager/public/cpp/connector.h"
18 #include "services/ui/common/accelerator_util.h" 18 #include "services/ui/common/accelerator_util.h"
19 #include "services/ui/public/cpp/gpu/gpu.h" 19 #include "services/ui/public/cpp/gpu/gpu.h"
20 #include "services/ui/public/cpp/property_type_converters.h" 20 #include "services/ui/public/cpp/property_type_converters.h"
21 #include "services/ui/public/interfaces/constants.mojom.h" 21 #include "services/ui/public/interfaces/constants.mojom.h"
22 #include "services/ui/public/interfaces/window_manager.mojom.h" 22 #include "services/ui/public/interfaces/window_manager.mojom.h"
23 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h" 23 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h"
24 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
25 #include "ui/aura/client/capture_client.h"
25 #include "ui/aura/client/drag_drop_client.h" 26 #include "ui/aura/client/drag_drop_client.h"
26 #include "ui/aura/client/transient_window_client.h" 27 #include "ui/aura/client/transient_window_client.h"
27 #include "ui/aura/env.h" 28 #include "ui/aura/env.h"
28 #include "ui/aura/mus/capture_synchronizer.h" 29 #include "ui/aura/mus/capture_synchronizer.h"
29 #include "ui/aura/mus/drag_drop_controller_mus.h" 30 #include "ui/aura/mus/drag_drop_controller_mus.h"
30 #include "ui/aura/mus/focus_synchronizer.h" 31 #include "ui/aura/mus/focus_synchronizer.h"
31 #include "ui/aura/mus/in_flight_change.h" 32 #include "ui/aura/mus/in_flight_change.h"
32 #include "ui/aura/mus/input_method_mus.h" 33 #include "ui/aura/mus/input_method_mus.h"
33 #include "ui/aura/mus/mus_context_factory.h" 34 #include "ui/aura/mus/mus_context_factory.h"
34 #include "ui/aura/mus/property_converter.h" 35 #include "ui/aura/mus/property_converter.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 tree_ptr_->GetWindowManagerClient(MakeRequest( 461 tree_ptr_->GetWindowManagerClient(MakeRequest(
461 &window_manager_internal_client_, tree_ptr_.associated_group())); 462 &window_manager_internal_client_, tree_ptr_.associated_group()));
462 } 463 }
463 } 464 }
464 465
465 void WindowTreeClient::WindowTreeConnectionEstablished( 466 void WindowTreeClient::WindowTreeConnectionEstablished(
466 ui::mojom::WindowTree* window_tree) { 467 ui::mojom::WindowTree* window_tree) {
467 tree_ = window_tree; 468 tree_ = window_tree;
468 469
469 drag_drop_controller_ = base::MakeUnique<DragDropControllerMus>(this, tree_); 470 drag_drop_controller_ = base::MakeUnique<DragDropControllerMus>(this, tree_);
470 capture_synchronizer_ = 471 capture_synchronizer_ = base::MakeUnique<CaptureSynchronizer>(this, tree_);
471 base::MakeUnique<CaptureSynchronizer>(this, tree_, GetCaptureClient());
472 focus_synchronizer_ = base::MakeUnique<FocusSynchronizer>(this, tree_); 472 focus_synchronizer_ = base::MakeUnique<FocusSynchronizer>(this, tree_);
473 } 473 }
474 474
475 void WindowTreeClient::OnConnectionLost() { 475 void WindowTreeClient::OnConnectionLost() {
476 delegate_->OnLostConnection(this); 476 delegate_->OnLostConnection(this);
477 } 477 }
478 478
479 bool WindowTreeClient::HandleInternalPropertyChanged(WindowMus* window, 479 bool WindowTreeClient::HandleInternalPropertyChanged(WindowMus* window,
480 const void* key) { 480 const void* key) {
481 if (key != client::kModalKey) 481 if (key != client::kModalKey)
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 base::MakeUnique<InFlightDragChange>(window_mus, ChangeType::MOVE_LOOP)); 822 base::MakeUnique<InFlightDragChange>(window_mus, ChangeType::MOVE_LOOP));
823 // Tell the window manager to take over moving us. 823 // Tell the window manager to take over moving us.
824 tree_->PerformWindowMove(current_move_loop_change_, window_mus->server_id(), 824 tree_->PerformWindowMove(current_move_loop_change_, window_mus->server_id(),
825 source, cursor_location); 825 source, cursor_location);
826 } 826 }
827 827
828 void WindowTreeClient::CancelWindowMove(Window* window) { 828 void WindowTreeClient::CancelWindowMove(Window* window) {
829 tree_->CancelWindowMove(WindowMus::Get(window)->server_id()); 829 tree_->CancelWindowMove(WindowMus::Get(window)->server_id());
830 } 830 }
831 831
832 void WindowTreeClient::OnCaptureClientSet(
833 client::CaptureClient* capture_client) {
834 capture_client->AddObserver(capture_synchronizer_.get());
835 }
836
837 void WindowTreeClient::OnCaptureClientUnset(
838 client::CaptureClient* capture_client) {
839 capture_synchronizer_->SetCaptureWindow(nullptr);
840 capture_client->RemoveObserver(capture_synchronizer_.get());
sadrul 2017/01/27 01:06:53 Can this be replaced by adding functions on Captur
841 }
842
832 void WindowTreeClient::AddObserver(WindowTreeClientObserver* observer) { 843 void WindowTreeClient::AddObserver(WindowTreeClientObserver* observer) {
833 observers_.AddObserver(observer); 844 observers_.AddObserver(observer);
834 } 845 }
835 846
836 void WindowTreeClient::RemoveObserver(WindowTreeClientObserver* observer) { 847 void WindowTreeClient::RemoveObserver(WindowTreeClientObserver* observer) {
837 observers_.RemoveObserver(observer); 848 observers_.RemoveObserver(observer);
838 } 849 }
839 850
840 void WindowTreeClient::AddTestObserver(WindowTreeClientTestObserver* observer) { 851 void WindowTreeClient::AddTestObserver(WindowTreeClientTestObserver* observer) {
841 test_observers_.AddObserver(observer); 852 test_observers_.AddObserver(observer);
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1834 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1824 this, capture_synchronizer_.get(), window)); 1835 this, capture_synchronizer_.get(), window));
1825 } 1836 }
1826 1837
1827 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1838 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1828 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1839 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1829 this, focus_synchronizer_.get(), window)); 1840 this, focus_synchronizer_.get(), window));
1830 } 1841 }
1831 1842
1832 } // namespace aura 1843 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698