| Index: services/ui/service.cc
|
| diff --git a/services/ui/service.cc b/services/ui/service.cc
|
| index d4eca9ccd9a5d58aa6cce8d9d4c37247d32e9ac5..adea7304cc217c907765c54ee05cb30e75944802 100644
|
| --- a/services/ui/service.cc
|
| +++ b/services/ui/service.cc
|
| @@ -69,7 +69,7 @@ const char kResourceFile200[] = "mus_app_resources_200.pak";
|
|
|
| // TODO(sky): this is a pretty typical pattern, make it easier to do.
|
| struct Service::PendingRequest {
|
| - shell::Connection* connection;
|
| + shell::Identity remote_identity;
|
| std::unique_ptr<mojom::WindowTreeFactoryRequest> wtf_request;
|
| std::unique_ptr<mojom::DisplayManagerRequest> dm_request;
|
| };
|
| @@ -129,8 +129,9 @@ void Service::InitializeResources(shell::Connector* connector) {
|
| ui::SCALE_FACTOR_200P);
|
| }
|
|
|
| -Service::UserState* Service::GetUserState(shell::Connection* connection) {
|
| - const ws::UserId& user_id = connection->GetRemoteIdentity().user_id();
|
| +Service::UserState* Service::GetUserState(
|
| + const shell::Identity& remote_identity) {
|
| + const ws::UserId& user_id = remote_identity.user_id();
|
| auto it = user_id_to_user_state_.find(user_id);
|
| if (it != user_id_to_user_state_.end())
|
| return it->second.get();
|
| @@ -138,9 +139,8 @@ Service::UserState* Service::GetUserState(shell::Connection* connection) {
|
| return user_id_to_user_state_[user_id].get();
|
| }
|
|
|
| -void Service::AddUserIfNecessary(shell::Connection* connection) {
|
| - window_server_->user_id_tracker()->AddUserId(
|
| - connection->GetRemoteIdentity().user_id());
|
| +void Service::AddUserIfNecessary(const shell::Identity& remote_identity) {
|
| + window_server_->user_id_tracker()->AddUserId(remote_identity.user_id());
|
| }
|
|
|
| void Service::OnStart(shell::Connector* connector,
|
| @@ -259,9 +259,9 @@ void Service::OnFirstDisplayReady() {
|
| requests.swap(pending_requests_);
|
| for (auto& request : requests) {
|
| if (request->wtf_request)
|
| - Create(request->connection, std::move(*request->wtf_request));
|
| + Create(request->remote_identity, std::move(*request->wtf_request));
|
| else
|
| - Create(request->connection, std::move(*request->dm_request));
|
| + Create(request->remote_identity, std::move(*request->dm_request));
|
| }
|
| }
|
|
|
| @@ -282,102 +282,102 @@ void Service::CreateDefaultDisplays() {
|
| &Service::OnCreatedPhysicalDisplay, weak_ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| -void Service::Create(shell::Connection* connection,
|
| +void Service::Create(const shell::Identity& remote_identity,
|
| mojom::AccessibilityManagerRequest request) {
|
| - UserState* user_state = GetUserState(connection);
|
| + UserState* user_state = GetUserState(remote_identity);
|
| if (!user_state->accessibility) {
|
| - const ws::UserId& user_id = connection->GetRemoteIdentity().user_id();
|
| + const ws::UserId& user_id = remote_identity.user_id();
|
| user_state->accessibility.reset(
|
| new ws::AccessibilityManager(window_server_.get(), user_id));
|
| }
|
| user_state->accessibility->Bind(std::move(request));
|
| }
|
|
|
| -void Service::Create(shell::Connection* connection,
|
| +void Service::Create(const shell::Identity& remote_identity,
|
| mojom::ClipboardRequest request) {
|
| - const ws::UserId& user_id = connection->GetRemoteIdentity().user_id();
|
| + const ws::UserId& user_id = remote_identity.user_id();
|
| window_server_->GetClipboardForUser(user_id)->AddBinding(std::move(request));
|
| }
|
|
|
| -void Service::Create(shell::Connection* connection,
|
| +void Service::Create(const shell::Identity& remote_identity,
|
| mojom::DisplayManagerRequest request) {
|
| // DisplayManagerObservers generally expect there to be at least one display.
|
| if (!window_server_->display_manager()->has_displays()) {
|
| std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
|
| - pending_request->connection = connection;
|
| + pending_request->remote_identity = remote_identity;
|
| pending_request->dm_request.reset(
|
| new mojom::DisplayManagerRequest(std::move(request)));
|
| pending_requests_.push_back(std::move(pending_request));
|
| return;
|
| }
|
| window_server_->display_manager()
|
| - ->GetUserDisplayManager(connection->GetRemoteIdentity().user_id())
|
| + ->GetUserDisplayManager(remote_identity.user_id())
|
| ->AddDisplayManagerBinding(std::move(request));
|
| }
|
|
|
| -void Service::Create(shell::Connection* connection, mojom::GpuRequest request) {
|
| +void Service::Create(const shell::Identity& remote_identity,
|
| + mojom::GpuRequest request) {
|
| if (use_chrome_gpu_command_buffer_)
|
| return;
|
| DCHECK(platform_display_init_params_.gpu_state);
|
| new GpuImpl(std::move(request), platform_display_init_params_.gpu_state);
|
| }
|
|
|
| -void Service::Create(shell::Connection* connection,
|
| +void Service::Create(const shell::Identity& remote_identity,
|
| mojom::GpuServiceRequest request) {
|
| if (!use_chrome_gpu_command_buffer_)
|
| return;
|
| - new GpuServiceImpl(std::move(request), connection);
|
| + new GpuServiceImpl(std::move(request));
|
| }
|
|
|
| -void Service::Create(shell::Connection* connection,
|
| +void Service::Create(const shell::Identity& remote_identity,
|
| mojom::UserAccessManagerRequest request) {
|
| window_server_->user_id_tracker()->Bind(std::move(request));
|
| }
|
|
|
| -void Service::Create(shell::Connection* connection,
|
| +void Service::Create(const shell::Identity& remote_identity,
|
| mojom::UserActivityMonitorRequest request) {
|
| - AddUserIfNecessary(connection);
|
| - const ws::UserId& user_id = connection->GetRemoteIdentity().user_id();
|
| + AddUserIfNecessary(remote_identity);
|
| + const ws::UserId& user_id = remote_identity.user_id();
|
| window_server_->GetUserActivityMonitorForUser(user_id)->Add(
|
| std::move(request));
|
| }
|
|
|
| -void Service::Create(shell::Connection* connection,
|
| +void Service::Create(const shell::Identity& remote_identity,
|
| mojom::WindowManagerWindowTreeFactoryRequest request) {
|
| - AddUserIfNecessary(connection);
|
| + AddUserIfNecessary(remote_identity);
|
| window_server_->window_manager_window_tree_factory_set()->Add(
|
| - connection->GetRemoteIdentity().user_id(), std::move(request));
|
| + remote_identity.user_id(), std::move(request));
|
| }
|
|
|
| -void Service::Create(Connection* connection,
|
| +void Service::Create(const shell::Identity& remote_identity,
|
| mojom::WindowTreeFactoryRequest request) {
|
| - AddUserIfNecessary(connection);
|
| + AddUserIfNecessary(remote_identity);
|
| if (!window_server_->display_manager()->has_displays()) {
|
| std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
|
| - pending_request->connection = connection;
|
| + pending_request->remote_identity = remote_identity;
|
| pending_request->wtf_request.reset(
|
| new mojom::WindowTreeFactoryRequest(std::move(request)));
|
| pending_requests_.push_back(std::move(pending_request));
|
| return;
|
| }
|
| - AddUserIfNecessary(connection);
|
| - new ws::WindowTreeFactory(
|
| - window_server_.get(), connection->GetRemoteIdentity().user_id(),
|
| - connection->GetRemoteIdentity().name(), std::move(request));
|
| + AddUserIfNecessary(remote_identity);
|
| + new ws::WindowTreeFactory(window_server_.get(), remote_identity.user_id(),
|
| + remote_identity.name(), std::move(request));
|
| }
|
|
|
| -void Service::Create(Connection* connection,
|
| +void Service::Create(const shell::Identity& remote_identity,
|
| mojom::WindowTreeHostFactoryRequest request) {
|
| - UserState* user_state = GetUserState(connection);
|
| + UserState* user_state = GetUserState(remote_identity);
|
| if (!user_state->window_tree_host_factory) {
|
| user_state->window_tree_host_factory.reset(new ws::WindowTreeHostFactory(
|
| - window_server_.get(), connection->GetRemoteIdentity().user_id(),
|
| + window_server_.get(), remote_identity.user_id(),
|
| platform_display_init_params_));
|
| }
|
| user_state->window_tree_host_factory->AddBinding(std::move(request));
|
| }
|
|
|
| -void Service::Create(Connection* connection,
|
| +void Service::Create(const shell::Identity& remote_identity,
|
| mojom::WindowServerTestRequest request) {
|
| if (!test_config_)
|
| return;
|
|
|