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

Side by Side Diff: mandoline/ui/aura/surface_binding.cc

Issue 1244233002: Allow trusted brokers to restrict connections for spawned applications to whitelisted applications … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mandoline/ui/aura/surface_binding.h" 5 #include "mandoline/ui/aura/surface_binding.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 202
203 void SurfaceBinding::PerViewManagerState::Init() { 203 void SurfaceBinding::PerViewManagerState::Init() {
204 DCHECK(!surface_.get()); 204 DCHECK(!surface_.get());
205 205
206 mojo::ServiceProviderPtr surfaces_service_provider; 206 mojo::ServiceProviderPtr surfaces_service_provider;
207 mojo::URLRequestPtr request(mojo::URLRequest::New()); 207 mojo::URLRequestPtr request(mojo::URLRequest::New());
208 request->url = mojo::String::From("mojo:surfaces_service"); 208 request->url = mojo::String::From("mojo:surfaces_service");
209 shell_->ConnectToApplication(request.Pass(), 209 shell_->ConnectToApplication(request.Pass(),
210 GetProxy(&surfaces_service_provider), 210 GetProxy(&surfaces_service_provider),
211 nullptr,
211 nullptr); 212 nullptr);
212 ConnectToService(surfaces_service_provider.get(), &surface_); 213 ConnectToService(surfaces_service_provider.get(), &surface_);
213 surface_->GetIdNamespace( 214 surface_->GetIdNamespace(
214 base::Bind(&SurfaceBinding::PerViewManagerState::SetIdNamespace, 215 base::Bind(&SurfaceBinding::PerViewManagerState::SetIdNamespace,
215 base::Unretained(this))); 216 base::Unretained(this)));
216 // Block until we receive our id namespace. 217 // Block until we receive our id namespace.
217 surface_.WaitForIncomingResponse(); 218 surface_.WaitForIncomingResponse();
218 DCHECK_NE(0u, id_namespace_); 219 DCHECK_NE(0u, id_namespace_);
219 220
220 mojo::ResourceReturnerPtr returner_ptr; 221 mojo::ResourceReturnerPtr returner_ptr;
221 returner_binding_.Bind(GetProxy(&returner_ptr)); 222 returner_binding_.Bind(GetProxy(&returner_ptr));
222 surface_->SetResourceReturner(returner_ptr.Pass()); 223 surface_->SetResourceReturner(returner_ptr.Pass());
223 224
224 mojo::ServiceProviderPtr gpu_service_provider; 225 mojo::ServiceProviderPtr gpu_service_provider;
225 // TODO(jamesr): Should be mojo:gpu_service 226 // TODO(jamesr): Should be mojo:gpu_service
226 mojo::URLRequestPtr request2(mojo::URLRequest::New()); 227 mojo::URLRequestPtr request2(mojo::URLRequest::New());
227 request2->url = mojo::String::From("mojo:view_manager"); 228 request2->url = mojo::String::From("mojo:view_manager");
228 shell_->ConnectToApplication(request2.Pass(), 229 shell_->ConnectToApplication(request2.Pass(),
229 GetProxy(&gpu_service_provider), 230 GetProxy(&gpu_service_provider),
231 nullptr,
230 nullptr); 232 nullptr);
231 ConnectToService(gpu_service_provider.get(), &gpu_); 233 ConnectToService(gpu_service_provider.get(), &gpu_);
232 } 234 }
233 235
234 void SurfaceBinding::PerViewManagerState::SetIdNamespace( 236 void SurfaceBinding::PerViewManagerState::SetIdNamespace(
235 uint32_t id_namespace) { 237 uint32_t id_namespace) {
236 id_namespace_ = id_namespace; 238 id_namespace_ = id_namespace;
237 } 239 }
238 240
239 void SurfaceBinding::PerViewManagerState::ReturnResources( 241 void SurfaceBinding::PerViewManagerState::ReturnResources(
240 mojo::Array<mojo::ReturnedResourcePtr> resources) { 242 mojo::Array<mojo::ReturnedResourcePtr> resources) {
241 } 243 }
242 244
243 // SurfaceBinding -------------------------------------------------------------- 245 // SurfaceBinding --------------------------------------------------------------
244 246
245 SurfaceBinding::SurfaceBinding(mojo::Shell* shell, mojo::View* view) 247 SurfaceBinding::SurfaceBinding(mojo::Shell* shell, mojo::View* view)
246 : view_(view), 248 : view_(view),
247 state_(PerViewManagerState::Get(shell, view->view_manager())) { 249 state_(PerViewManagerState::Get(shell, view->view_manager())) {
248 } 250 }
249 251
250 SurfaceBinding::~SurfaceBinding() { 252 SurfaceBinding::~SurfaceBinding() {
251 } 253 }
252 254
253 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { 255 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() {
254 return state_->CreateOutputSurface(view_); 256 return state_->CreateOutputSurface(view_);
255 } 257 }
256 258
257 } // namespace mandoline 259 } // namespace mandoline
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698