OLD | NEW |
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 "components/view_manager/view_manager_app.h" | 5 #include "components/view_manager/view_manager_app.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "components/view_manager/client_connection.h" | 8 #include "components/view_manager/client_connection.h" |
9 #include "components/view_manager/connection_manager.h" | 9 #include "components/view_manager/connection_manager.h" |
10 #include "components/view_manager/display_manager.h" | 10 #include "components/view_manager/display_manager.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 void ViewManagerApp::OnLostConnectionToWindowManager() { | 76 void ViewManagerApp::OnLostConnectionToWindowManager() { |
77 app_impl_->Terminate(); | 77 app_impl_->Terminate(); |
78 } | 78 } |
79 | 79 |
80 ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( | 80 ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( |
81 ConnectionManager* connection_manager, | 81 ConnectionManager* connection_manager, |
82 mojo::InterfaceRequest<mojo::ViewManagerService> service_request, | 82 mojo::InterfaceRequest<mojo::ViewManagerService> service_request, |
83 mojo::ConnectionSpecificId creator_id, | 83 mojo::ConnectionSpecificId creator_id, |
84 const std::string& creator_url, | |
85 mojo::URLRequestPtr request, | 84 mojo::URLRequestPtr request, |
86 const ViewId& root_id) { | 85 const ViewId& root_id) { |
87 mojo::ViewManagerClientPtr client; | 86 mojo::ViewManagerClientPtr client; |
88 std::string url = request->url.To<std::string>(); | |
89 app_impl_->ConnectToService(request.Pass(), &client); | 87 app_impl_->ConnectToService(request.Pass(), &client); |
90 | 88 |
91 scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl( | 89 scoped_ptr<ViewManagerServiceImpl> service( |
92 connection_manager, creator_id, creator_url, url, root_id)); | 90 new ViewManagerServiceImpl(connection_manager, creator_id, root_id)); |
93 return new DefaultClientConnection(service.Pass(), connection_manager, | 91 return new DefaultClientConnection(service.Pass(), connection_manager, |
94 service_request.Pass(), client.Pass()); | 92 service_request.Pass(), client.Pass()); |
95 } | 93 } |
96 | 94 |
97 ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( | 95 ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( |
98 ConnectionManager* connection_manager, | 96 ConnectionManager* connection_manager, |
99 mojo::InterfaceRequest<mojo::ViewManagerService> service_request, | 97 mojo::InterfaceRequest<mojo::ViewManagerService> service_request, |
100 mojo::ConnectionSpecificId creator_id, | 98 mojo::ConnectionSpecificId creator_id, |
101 const std::string& creator_url, | |
102 const ViewId& root_id, | 99 const ViewId& root_id, |
103 mojo::ViewManagerClientPtr view_manager_client) { | 100 mojo::ViewManagerClientPtr view_manager_client) { |
104 scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl( | 101 scoped_ptr<ViewManagerServiceImpl> service( |
105 connection_manager, creator_id, creator_url, std::string(), root_id)); | 102 new ViewManagerServiceImpl(connection_manager, creator_id, root_id)); |
106 return new DefaultClientConnection(service.Pass(), connection_manager, | 103 return new DefaultClientConnection(service.Pass(), connection_manager, |
107 service_request.Pass(), | 104 service_request.Pass(), |
108 view_manager_client.Pass()); | 105 view_manager_client.Pass()); |
109 } | 106 } |
110 | 107 |
111 void ViewManagerApp::Create(ApplicationConnection* connection, | 108 void ViewManagerApp::Create(ApplicationConnection* connection, |
112 InterfaceRequest<ViewManagerService> request) { | 109 InterfaceRequest<ViewManagerService> request) { |
113 if (connection_manager_->has_window_manager_client_connection()) { | 110 if (connection_manager_->has_window_manager_client_connection()) { |
114 VLOG(1) << "ViewManager interface requested more than once."; | 111 VLOG(1) << "ViewManager interface requested more than once."; |
115 return; | 112 return; |
116 } | 113 } |
117 | 114 |
118 scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl( | 115 scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl( |
119 connection_manager_.get(), kInvalidConnectionId, std::string(), | 116 connection_manager_.get(), kInvalidConnectionId, RootViewId())); |
120 connection->GetRemoteApplicationURL(), RootViewId())); | |
121 mojo::ViewManagerClientPtr client; | 117 mojo::ViewManagerClientPtr client; |
122 connection->ConnectToService(&client); | 118 connection->ConnectToService(&client); |
123 scoped_ptr<ClientConnection> client_connection( | 119 scoped_ptr<ClientConnection> client_connection( |
124 new DefaultClientConnection(service.Pass(), connection_manager_.get(), | 120 new DefaultClientConnection(service.Pass(), connection_manager_.get(), |
125 request.Pass(), client.Pass())); | 121 request.Pass(), client.Pass())); |
126 connection_manager_->SetWindowManagerClientConnection( | 122 connection_manager_->SetWindowManagerClientConnection( |
127 client_connection.Pass()); | 123 client_connection.Pass()); |
128 } | 124 } |
129 | 125 |
130 void ViewManagerApp::Create(ApplicationConnection* connection, | 126 void ViewManagerApp::Create(ApplicationConnection* connection, |
(...skipping 16 matching lines...) Expand all Loading... |
147 if (!gpu_state_.get()) | 143 if (!gpu_state_.get()) |
148 gpu_state_ = new gles2::GpuState; | 144 gpu_state_ = new gles2::GpuState; |
149 new gles2::GpuImpl(request.Pass(), gpu_state_); | 145 new gles2::GpuImpl(request.Pass(), gpu_state_); |
150 } | 146 } |
151 | 147 |
152 void ViewManagerApp::OnConnectionError() { | 148 void ViewManagerApp::OnConnectionError() { |
153 app_impl_->Terminate(); | 149 app_impl_->Terminate(); |
154 } | 150 } |
155 | 151 |
156 } // namespace view_manager | 152 } // namespace view_manager |
OLD | NEW |