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

Side by Side Diff: mandoline/tab/frame_connection.cc

Issue 1287043004: Use CapabilityFilter to restrict what HTMLViewers can connect to. (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
« no previous file with comments | « no previous file | mojo/application/public/cpp/application_impl.h » ('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/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
OLDNEW
« no previous file with comments | « no previous file | mojo/application/public/cpp/application_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698