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

Side by Side Diff: components/view_manager/public/cpp/lib/view_manager_init.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
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 "components/view_manager/public/cpp/view_manager_init.h" 5 #include "components/view_manager/public/cpp/view_manager_init.h"
6 6
7 #include "components/view_manager/public/cpp/lib/view_manager_client_impl.h" 7 #include "components/view_manager/public/cpp/lib/view_manager_client_impl.h"
8 #include "mojo/application/public/cpp/application_impl.h" 8 #include "mojo/application/public/cpp/application_impl.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 13 matching lines...) Expand all
24 private: 24 private:
25 ViewManagerInit* init_; 25 ViewManagerInit* init_;
26 26
27 DISALLOW_COPY_AND_ASSIGN(ClientFactory); 27 DISALLOW_COPY_AND_ASSIGN(ClientFactory);
28 }; 28 };
29 29
30 ViewManagerInit::ViewManagerInit(ApplicationImpl* app, 30 ViewManagerInit::ViewManagerInit(ApplicationImpl* app,
31 ViewManagerDelegate* delegate, 31 ViewManagerDelegate* delegate,
32 ViewManagerRootClient* root_client) 32 ViewManagerRootClient* root_client)
33 : app_(app), delegate_(delegate), client_factory_(new ClientFactory(this)) { 33 : app_(app), delegate_(delegate), client_factory_(new ClientFactory(this)) {
34 mojo::URLRequestPtr request(mojo::URLRequest::New());
35 request->url = mojo::String::From("mojo:view_manager");
34 ApplicationConnection* connection = 36 ApplicationConnection* connection =
35 app_->ConnectToApplication("mojo:view_manager"); 37 app_->ConnectToApplication(request.Pass());
36 connection->AddService(client_factory_.get()); 38 connection->AddService(client_factory_.get());
37 connection->ConnectToService(&service_); 39 connection->ConnectToService(&service_);
38 service_.set_error_handler(this); 40 service_.set_error_handler(this);
39 connection->ConnectToService(&view_manager_root_); 41 connection->ConnectToService(&view_manager_root_);
40 if (root_client) { 42 if (root_client) {
41 root_client_binding_.reset(new Binding<ViewManagerRootClient>(root_client)); 43 root_client_binding_.reset(new Binding<ViewManagerRootClient>(root_client));
42 ViewManagerRootClientPtr root_client_ptr; 44 ViewManagerRootClientPtr root_client_ptr;
43 root_client_binding_->Bind(GetProxy(&root_client_ptr)); 45 root_client_binding_->Bind(GetProxy(&root_client_ptr));
44 view_manager_root_->SetViewManagerRootClient(root_client_ptr.Pass()); 46 view_manager_root_->SetViewManagerRootClient(root_client_ptr.Pass());
45 } 47 }
46 } 48 }
47 49
48 ViewManagerInit::~ViewManagerInit() { 50 ViewManagerInit::~ViewManagerInit() {
49 } 51 }
50 52
51 void ViewManagerInit::OnCreate(InterfaceRequest<ViewManagerClient> request) { 53 void ViewManagerInit::OnCreate(InterfaceRequest<ViewManagerClient> request) {
52 // TODO(sky): straighten out lifetime. 54 // TODO(sky): straighten out lifetime.
53 const bool delete_on_error = false; 55 const bool delete_on_error = false;
54 ViewManagerClientImpl* client = new ViewManagerClientImpl( 56 ViewManagerClientImpl* client = new ViewManagerClientImpl(
55 delegate_, app_->shell(), request.Pass(), delete_on_error); 57 delegate_, app_->shell(), request.Pass(), delete_on_error);
56 client->SetViewManagerService(service_.Pass()); 58 client->SetViewManagerService(service_.Pass());
57 } 59 }
58 60
59 void ViewManagerInit::OnConnectionError() { 61 void ViewManagerInit::OnConnectionError() {
60 mojo::ApplicationImpl::Terminate(); 62 mojo::ApplicationImpl::Terminate();
61 } 63 }
62 64
63 } // namespace mojo 65 } // namespace mojo
OLDNEW
« no previous file with comments | « components/view_manager/public/cpp/lib/view_manager_context.cc ('k') | components/view_manager/public/cpp/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698