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 2626013005: Change CaptureSynchronizer and PointerWatcherEventRouter to support multiple CaptureClients. (Closed)
Patch Set: another approach to attach capture client Created 3 years, 11 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/property_type_converters.h" 19 #include "services/ui/public/cpp/property_type_converters.h"
20 #include "services/ui/public/interfaces/constants.mojom.h" 20 #include "services/ui/public/interfaces/constants.mojom.h"
21 #include "services/ui/public/interfaces/window_manager.mojom.h" 21 #include "services/ui/public/interfaces/window_manager.mojom.h"
22 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h" 22 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h"
23 #include "ui/aura/client/aura_constants.h" 23 #include "ui/aura/client/aura_constants.h"
24 #include "ui/aura/client/capture_client.h"
24 #include "ui/aura/client/drag_drop_client.h" 25 #include "ui/aura/client/drag_drop_client.h"
25 #include "ui/aura/client/transient_window_client.h" 26 #include "ui/aura/client/transient_window_client.h"
26 #include "ui/aura/mus/capture_synchronizer.h" 27 #include "ui/aura/mus/capture_synchronizer.h"
27 #include "ui/aura/mus/drag_drop_controller_mus.h" 28 #include "ui/aura/mus/drag_drop_controller_mus.h"
28 #include "ui/aura/mus/focus_synchronizer.h" 29 #include "ui/aura/mus/focus_synchronizer.h"
29 #include "ui/aura/mus/in_flight_change.h" 30 #include "ui/aura/mus/in_flight_change.h"
30 #include "ui/aura/mus/input_method_mus.h" 31 #include "ui/aura/mus/input_method_mus.h"
31 #include "ui/aura/mus/property_converter.h" 32 #include "ui/aura/mus/property_converter.h"
32 #include "ui/aura/mus/property_utils.h" 33 #include "ui/aura/mus/property_utils.h"
33 #include "ui/aura/mus/window_manager_delegate.h" 34 #include "ui/aura/mus/window_manager_delegate.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 ui::mojom::WindowManagerWindowTreeFactoryPtr factory; 219 ui::mojom::WindowManagerWindowTreeFactoryPtr factory;
219 connector_->BindInterface(ui::mojom::kServiceName, &factory); 220 connector_->BindInterface(ui::mojom::kServiceName, &factory);
220 ui::mojom::WindowTreePtr window_tree; 221 ui::mojom::WindowTreePtr window_tree;
221 factory->CreateWindowTree(MakeRequest(&window_tree), 222 factory->CreateWindowTree(MakeRequest(&window_tree),
222 binding_.CreateInterfacePtrAndBind()); 223 binding_.CreateInterfacePtrAndBind());
223 SetWindowTree(std::move(window_tree)); 224 SetWindowTree(std::move(window_tree));
224 } 225 }
225 226
226 client::CaptureClient* WindowTreeClient::GetCaptureClient() { 227 client::CaptureClient* WindowTreeClient::GetCaptureClient() {
227 return delegate_->GetCaptureClient(); 228 return delegate_->GetCaptureClient();
228 } 229 }
sadrul 2017/01/21 03:23:37 Remove this (and WindowTreeClientDelegate::GetCapt
riajiang 2017/01/24 19:36:22 Removed these two and updated use cases.
229 230
230 void WindowTreeClient::SetCanFocus(Window* window, bool can_focus) { 231 void WindowTreeClient::SetCanFocus(Window* window, bool can_focus) {
231 DCHECK(tree_); 232 DCHECK(tree_);
232 DCHECK(window); 233 DCHECK(window);
233 tree_->SetCanFocus(WindowMus::Get(window)->server_id(), can_focus); 234 tree_->SetCanFocus(WindowMus::Get(window)->server_id(), can_focus);
234 } 235 }
235 236
236 void WindowTreeClient::SetPredefinedCursor(WindowMus* window, 237 void WindowTreeClient::SetPredefinedCursor(WindowMus* window,
237 ui::mojom::Cursor old_cursor, 238 ui::mojom::Cursor old_cursor,
238 ui::mojom::Cursor new_cursor) { 239 ui::mojom::Cursor new_cursor) {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 tree_ptr_->GetWindowManagerClient(MakeRequest( 447 tree_ptr_->GetWindowManagerClient(MakeRequest(
447 &window_manager_internal_client_, tree_ptr_.associated_group())); 448 &window_manager_internal_client_, tree_ptr_.associated_group()));
448 } 449 }
449 } 450 }
450 451
451 void WindowTreeClient::WindowTreeConnectionEstablished( 452 void WindowTreeClient::WindowTreeConnectionEstablished(
452 ui::mojom::WindowTree* window_tree) { 453 ui::mojom::WindowTree* window_tree) {
453 tree_ = window_tree; 454 tree_ = window_tree;
454 455
455 drag_drop_controller_ = base::MakeUnique<DragDropControllerMus>(this, tree_); 456 drag_drop_controller_ = base::MakeUnique<DragDropControllerMus>(this, tree_);
456 capture_synchronizer_ = 457 capture_synchronizer_ = base::MakeUnique<CaptureSynchronizer>(this, tree_);
457 base::MakeUnique<CaptureSynchronizer>(this, tree_, GetCaptureClient());
458 focus_synchronizer_ = base::MakeUnique<FocusSynchronizer>(this, tree_); 458 focus_synchronizer_ = base::MakeUnique<FocusSynchronizer>(this, tree_);
459 } 459 }
460 460
461 void WindowTreeClient::OnConnectionLost() { 461 void WindowTreeClient::OnConnectionLost() {
462 delegate_->OnLostConnection(this); 462 delegate_->OnLostConnection(this);
463 } 463 }
464 464
465 bool WindowTreeClient::HandleInternalPropertyChanged(WindowMus* window, 465 bool WindowTreeClient::HandleInternalPropertyChanged(WindowMus* window,
466 const void* key) { 466 const void* key) {
467 if (key != client::kModalKey) 467 if (key != client::kModalKey && key != client::kRootWindowCaptureClientKey)
468 return false; 468 return false;
469 469
470 if (key == client::kRootWindowCaptureClientKey) {
471 capture_synchronizer_->Attach(
472 client::GetCaptureClient(window->GetWindow()));
473 return true;
474 }
475
470 if (window->GetWindow()->GetProperty(client::kModalKey) == 476 if (window->GetWindow()->GetProperty(client::kModalKey) ==
471 ui::MODAL_TYPE_NONE) { 477 ui::MODAL_TYPE_NONE) {
472 // TODO: shouldn't early return, but explicitly tell server to turn off 478 // TODO: shouldn't early return, but explicitly tell server to turn off
473 // modality. http://crbug.com/660073. 479 // modality. http://crbug.com/660073.
474 return true; 480 return true;
475 } 481 }
476 482
477 const uint32_t change_id = 483 const uint32_t change_id =
478 ScheduleInFlightChange(base::MakeUnique<InFlightSetModalChange>(window)); 484 ScheduleInFlightChange(base::MakeUnique<InFlightSetModalChange>(window));
479 // TODO: this is subtly different that explicitly specifying a type. 485 // TODO: this is subtly different that explicitly specifying a type.
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1723 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1718 this, capture_synchronizer_.get(), window)); 1724 this, capture_synchronizer_.get(), window));
1719 } 1725 }
1720 1726
1721 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1727 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1722 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1728 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1723 this, focus_synchronizer_.get(), window)); 1729 this, focus_synchronizer_.get(), window));
1724 } 1730 }
1725 1731
1726 } // namespace aura 1732 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698