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

Side by Side Diff: services/ui/service.cc

Issue 2339353003: mus: Remove window server access to clipboard and the drag clipboard. (Closed)
Patch Set: Created 4 years, 3 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 | « services/ui/public/interfaces/clipboard.mojom ('k') | services/ui/ws/BUILD.gn » ('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 "services/ui/service.h" 5 #include "services/ui/service.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } // namespace 69 } // namespace
70 70
71 // TODO(sky): this is a pretty typical pattern, make it easier to do. 71 // TODO(sky): this is a pretty typical pattern, make it easier to do.
72 struct Service::PendingRequest { 72 struct Service::PendingRequest {
73 shell::Identity remote_identity; 73 shell::Identity remote_identity;
74 std::unique_ptr<mojom::WindowTreeFactoryRequest> wtf_request; 74 std::unique_ptr<mojom::WindowTreeFactoryRequest> wtf_request;
75 std::unique_ptr<mojom::DisplayManagerRequest> dm_request; 75 std::unique_ptr<mojom::DisplayManagerRequest> dm_request;
76 }; 76 };
77 77
78 struct Service::UserState { 78 struct Service::UserState {
79 std::unique_ptr<clipboard::ClipboardImpl> clipboard;
79 std::unique_ptr<ws::AccessibilityManager> accessibility; 80 std::unique_ptr<ws::AccessibilityManager> accessibility;
80 std::unique_ptr<ws::WindowTreeHostFactory> window_tree_host_factory; 81 std::unique_ptr<ws::WindowTreeHostFactory> window_tree_host_factory;
81 }; 82 };
82 83
83 Service::Service() 84 Service::Service()
84 : test_config_(false), 85 : test_config_(false),
85 platform_screen_(display::PlatformScreen::Create()), 86 platform_screen_(display::PlatformScreen::Create()),
86 ime_registrar_(&ime_server_) {} 87 ime_registrar_(&ime_server_) {}
87 88
88 Service::~Service() { 89 Service::~Service() {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 if (!user_state->accessibility) { 263 if (!user_state->accessibility) {
263 const ws::UserId& user_id = remote_identity.user_id(); 264 const ws::UserId& user_id = remote_identity.user_id();
264 user_state->accessibility.reset( 265 user_state->accessibility.reset(
265 new ws::AccessibilityManager(window_server_.get(), user_id)); 266 new ws::AccessibilityManager(window_server_.get(), user_id));
266 } 267 }
267 user_state->accessibility->Bind(std::move(request)); 268 user_state->accessibility->Bind(std::move(request));
268 } 269 }
269 270
270 void Service::Create(const shell::Identity& remote_identity, 271 void Service::Create(const shell::Identity& remote_identity,
271 mojom::ClipboardRequest request) { 272 mojom::ClipboardRequest request) {
272 const ws::UserId& user_id = remote_identity.user_id(); 273 UserState* user_state = GetUserState(remote_identity);
273 window_server_->GetClipboardForUser(user_id)->AddBinding(std::move(request)); 274 if (!user_state->clipboard)
275 user_state->clipboard.reset(new clipboard::ClipboardImpl);
276 user_state->clipboard->AddBinding(std::move(request));
274 } 277 }
275 278
276 void Service::Create(const shell::Identity& remote_identity, 279 void Service::Create(const shell::Identity& remote_identity,
277 mojom::DisplayManagerRequest request) { 280 mojom::DisplayManagerRequest request) {
278 // DisplayManagerObservers generally expect there to be at least one display. 281 // DisplayManagerObservers generally expect there to be at least one display.
279 if (!window_server_->display_manager()->has_displays()) { 282 if (!window_server_->display_manager()->has_displays()) {
280 std::unique_ptr<PendingRequest> pending_request(new PendingRequest); 283 std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
281 pending_request->remote_identity = remote_identity; 284 pending_request->remote_identity = remote_identity;
282 pending_request->dm_request.reset( 285 pending_request->dm_request.reset(
283 new mojom::DisplayManagerRequest(std::move(request))); 286 new mojom::DisplayManagerRequest(std::move(request)));
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 mojom::WindowServerTestRequest request) { 359 mojom::WindowServerTestRequest request) {
357 if (!test_config_) 360 if (!test_config_)
358 return; 361 return;
359 mojo::MakeStrongBinding( 362 mojo::MakeStrongBinding(
360 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()), 363 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()),
361 std::move(request)); 364 std::move(request));
362 } 365 }
363 366
364 367
365 } // namespace ui 368 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/interfaces/clipboard.mojom ('k') | services/ui/ws/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698