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

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

Issue 1121783003: Move navigations with POST or referrer to the shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 7 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 | « components/view_manager/view_manager_service_unittest.cc ('k') | mandoline/ui/browser/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 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (view_map->empty()) { 197 if (view_map->empty()) {
198 delete view_map; 198 delete view_map;
199 view_states.Pointer()->Set(nullptr); 199 view_states.Pointer()->Set(nullptr);
200 } 200 }
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 shell_->ConnectToApplication("mojo:surfaces_service", 207 mojo::URLRequestPtr request(mojo::URLRequest::New());
208 request->url = mojo::String::From("mojo:surfaces_service");
209 shell_->ConnectToApplication(request.Pass(),
208 GetProxy(&surfaces_service_provider), 210 GetProxy(&surfaces_service_provider),
209 nullptr); 211 nullptr);
210 ConnectToService(surfaces_service_provider.get(), &surface_); 212 ConnectToService(surfaces_service_provider.get(), &surface_);
211 surface_->GetIdNamespace( 213 surface_->GetIdNamespace(
212 base::Bind(&SurfaceBinding::PerViewManagerState::SetIdNamespace, 214 base::Bind(&SurfaceBinding::PerViewManagerState::SetIdNamespace,
213 base::Unretained(this))); 215 base::Unretained(this)));
214 // Block until we receive our id namespace. 216 // Block until we receive our id namespace.
215 surface_.WaitForIncomingMethodCall(); 217 surface_.WaitForIncomingMethodCall();
216 DCHECK_NE(0u, id_namespace_); 218 DCHECK_NE(0u, id_namespace_);
217 219
218 mojo::ResourceReturnerPtr returner_ptr; 220 mojo::ResourceReturnerPtr returner_ptr;
219 returner_binding_.Bind(GetProxy(&returner_ptr)); 221 returner_binding_.Bind(GetProxy(&returner_ptr));
220 surface_->SetResourceReturner(returner_ptr.Pass()); 222 surface_->SetResourceReturner(returner_ptr.Pass());
221 223
222 mojo::ServiceProviderPtr gpu_service_provider; 224 mojo::ServiceProviderPtr gpu_service_provider;
223 // TODO(jamesr): Should be mojo:gpu_service 225 // TODO(jamesr): Should be mojo:gpu_service
224 shell_->ConnectToApplication("mojo:native_viewport_service", 226 mojo::URLRequestPtr request2(mojo::URLRequest::New());
227 request2->url = mojo::String::From("mojo:native_viewport_service");
228 shell_->ConnectToApplication(request2.Pass(),
225 GetProxy(&gpu_service_provider), 229 GetProxy(&gpu_service_provider),
226 nullptr); 230 nullptr);
227 ConnectToService(gpu_service_provider.get(), &gpu_); 231 ConnectToService(gpu_service_provider.get(), &gpu_);
228 } 232 }
229 233
230 void SurfaceBinding::PerViewManagerState::SetIdNamespace( 234 void SurfaceBinding::PerViewManagerState::SetIdNamespace(
231 uint32_t id_namespace) { 235 uint32_t id_namespace) {
232 id_namespace_ = id_namespace; 236 id_namespace_ = id_namespace;
233 } 237 }
234 238
235 void SurfaceBinding::PerViewManagerState::ReturnResources( 239 void SurfaceBinding::PerViewManagerState::ReturnResources(
236 mojo::Array<mojo::ReturnedResourcePtr> resources) { 240 mojo::Array<mojo::ReturnedResourcePtr> resources) {
237 } 241 }
238 242
239 // SurfaceBinding -------------------------------------------------------------- 243 // SurfaceBinding --------------------------------------------------------------
240 244
241 SurfaceBinding::SurfaceBinding(mojo::Shell* shell, mojo::View* view) 245 SurfaceBinding::SurfaceBinding(mojo::Shell* shell, mojo::View* view)
242 : view_(view), 246 : view_(view),
243 state_(PerViewManagerState::Get(shell, view->view_manager())) { 247 state_(PerViewManagerState::Get(shell, view->view_manager())) {
244 } 248 }
245 249
246 SurfaceBinding::~SurfaceBinding() { 250 SurfaceBinding::~SurfaceBinding() {
247 } 251 }
248 252
249 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { 253 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() {
250 return state_->CreateOutputSurface(view_); 254 return state_->CreateOutputSurface(view_);
251 } 255 }
252 256
253 } // namespace mandoline 257 } // namespace mandoline
OLDNEW
« no previous file with comments | « components/view_manager/view_manager_service_unittest.cc ('k') | mandoline/ui/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698