Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/tab/frame_connection.h" | 5 #include "mandoline/tab/frame_connection.h" |
| 6 | 6 |
| 7 #include "mojo/application/public/cpp/application_connection.h" | 7 #include "mojo/application/public/cpp/application_connection.h" |
| 8 #include "mojo/application/public/cpp/application_impl.h" | 8 #include "mojo/application/public/cpp/application_impl.h" |
| 9 | 9 |
| 10 namespace mandoline { | 10 namespace mandoline { |
| 11 | 11 |
| 12 FrameConnection::FrameConnection() : application_connection_(nullptr) { | 12 FrameConnection::FrameConnection() : application_connection_(nullptr) { |
| 13 } | 13 } |
| 14 | 14 |
| 15 FrameConnection::~FrameConnection() { | 15 FrameConnection::~FrameConnection() { |
| 16 } | 16 } |
| 17 | 17 |
| 18 void FrameConnection::Init(mojo::ApplicationImpl* app, | 18 void FrameConnection::Init(mojo::ApplicationImpl* app, |
| 19 mojo::URLRequestPtr request, | 19 mojo::URLRequestPtr request, |
| 20 mojo::ViewManagerClientPtr* view_manage_client) { | 20 mojo::ViewManagerClientPtr* view_manage_client) { |
| 21 DCHECK(!application_connection_); | 21 DCHECK(!application_connection_); |
| 22 application_connection_ = app->ConnectToApplication(request.Pass()); | 22 |
| 23 mojo::CapabilityFilterPtr filter(mojo::CapabilityFilter::New()); | |
| 24 mojo::Array<mojo::String> resource_provider_interfaces; | |
| 25 resource_provider_interfaces.push_back("resource_provider::ResourceProvider"); | |
| 26 filter->filter.insert("mojo:resource_provider", | |
| 27 resource_provider_interfaces.Pass()); | |
| 28 | |
| 29 mojo::Array<mojo::String> network_service_interfaces; | |
| 30 network_service_interfaces.push_back("mojo::NetworkService"); | |
|
sky
2015/08/12 20:36:16
This strikes me as very fragile. If someone rename
| |
| 31 network_service_interfaces.push_back("mojo::URLLoaderFactory"); | |
| 32 filter->filter.insert("mojo:network_service", | |
| 33 network_service_interfaces.Pass()); | |
| 34 | |
| 35 mojo::Array<mojo::String> clipboard_interfaces; | |
| 36 clipboard_interfaces.push_back("mojo::Clipboard"); | |
| 37 filter->filter.insert("mojo:clipboard", clipboard_interfaces.Pass()); | |
| 38 | |
| 39 mojo::Array<mojo::String> surfaces_interfaces; | |
| 40 surfaces_interfaces.push_back("mojo::DisplayFactory"); | |
| 41 surfaces_interfaces.push_back("mojo::Surface"); | |
| 42 filter->filter.insert("mojo:surfaces_service", surfaces_interfaces.Pass()); | |
| 43 | |
| 44 mojo::Array<mojo::String> view_manager_interfaces; | |
| 45 view_manager_interfaces.push_back("mojo::Gpu"); | |
| 46 view_manager_interfaces.push_back("mojo::ViewManagerRoot"); | |
| 47 filter->filter.insert("mojo:view_manager", view_manager_interfaces.Pass()); | |
| 48 | |
| 49 mojo::Array<mojo::String> devtools_interfaces; | |
| 50 devtools_interfaces.push_back("devtools_service::DevToolsRegistry"); | |
| 51 filter->filter.insert("mojo:devtools_service", devtools_interfaces.Pass()); | |
| 52 | |
| 53 application_connection_ = app->ConnectToApplicationWithCapabilityFilter( | |
| 54 request.Pass(), filter.Pass()); | |
| 23 application_connection_->ConnectToService(view_manage_client); | 55 application_connection_->ConnectToService(view_manage_client); |
| 24 application_connection_->ConnectToService(&frame_tree_client_); | 56 application_connection_->ConnectToService(&frame_tree_client_); |
| 25 frame_tree_client_.set_connection_error_handler([]() { | 57 frame_tree_client_.set_connection_error_handler([]() { |
| 26 // TODO(sky): implement this. | 58 // TODO(sky): implement this. |
| 27 NOTIMPLEMENTED(); | 59 NOTIMPLEMENTED(); |
| 28 }); | 60 }); |
| 29 } | 61 } |
| 30 | 62 |
| 31 } // namespace mandoline | 63 } // namespace mandoline |
| OLD | NEW |