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

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 | « mandoline/tab/DEPS ('k') | 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 "components/clipboard/public/interfaces/clipboard.mojom.h"
8 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h "
9 #include "components/resource_provider/public/interfaces/resource_provider.mojom .h"
10 #include "components/view_manager/public/interfaces/display.mojom.h"
11 #include "components/view_manager/public/interfaces/gpu.mojom.h"
12 #include "components/view_manager/public/interfaces/surfaces.mojom.h"
13 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h"
7 #include "mojo/application/public/cpp/application_connection.h" 14 #include "mojo/application/public/cpp/application_connection.h"
8 #include "mojo/application/public/cpp/application_impl.h" 15 #include "mojo/application/public/cpp/application_impl.h"
16 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
17 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h"
18
19 #if defined(OS_LINUX) && !defined(OS_ANDROID)
20 #include "components/font_service/public/interfaces/font_service.mojom.h"
21 #endif
9 22
10 namespace mandoline { 23 namespace mandoline {
11 24
12 FrameConnection::FrameConnection() : application_connection_(nullptr) { 25 FrameConnection::FrameConnection() : application_connection_(nullptr) {
13 } 26 }
14 27
15 FrameConnection::~FrameConnection() { 28 FrameConnection::~FrameConnection() {
16 } 29 }
17 30
18 void FrameConnection::Init(mojo::ApplicationImpl* app, 31 void FrameConnection::Init(mojo::ApplicationImpl* app,
19 mojo::URLRequestPtr request, 32 mojo::URLRequestPtr request,
20 mojo::ViewManagerClientPtr* view_manage_client) { 33 mojo::ViewManagerClientPtr* view_manage_client) {
21 DCHECK(!application_connection_); 34 DCHECK(!application_connection_);
22 application_connection_ = app->ConnectToApplication(request.Pass()); 35
36 mojo::CapabilityFilterPtr filter(mojo::CapabilityFilter::New());
37 mojo::Array<mojo::String> resource_provider_interfaces;
38 resource_provider_interfaces.push_back(
39 resource_provider::ResourceProvider::Name_);
40 filter->filter.insert("mojo:resource_provider",
41 resource_provider_interfaces.Pass());
42
43 mojo::Array<mojo::String> network_service_interfaces;
44 network_service_interfaces.push_back(mojo::NetworkService::Name_);
45 network_service_interfaces.push_back(mojo::URLLoaderFactory::Name_);
46 filter->filter.insert("mojo:network_service",
47 network_service_interfaces.Pass());
48
49 mojo::Array<mojo::String> clipboard_interfaces;
50 clipboard_interfaces.push_back(mojo::Clipboard::Name_);
51 filter->filter.insert("mojo:clipboard", clipboard_interfaces.Pass());
52
53 mojo::Array<mojo::String> surfaces_interfaces;
54 surfaces_interfaces.push_back(mojo::DisplayFactory::Name_);
55 surfaces_interfaces.push_back(mojo::Surface::Name_);
56 filter->filter.insert("mojo:surfaces_service", surfaces_interfaces.Pass());
57
58 mojo::Array<mojo::String> view_manager_interfaces;
59 view_manager_interfaces.push_back(mojo::Gpu::Name_);
60 view_manager_interfaces.push_back(mojo::ViewManagerRoot::Name_);
61 filter->filter.insert("mojo:view_manager", view_manager_interfaces.Pass());
62
63 mojo::Array<mojo::String> devtools_interfaces;
64 devtools_interfaces.push_back(devtools_service::DevToolsRegistry::Name_);
65 filter->filter.insert("mojo:devtools_service", devtools_interfaces.Pass());
66
67 #if defined(OS_LINUX) && !defined(OS_ANDROID)
68 mojo::Array<mojo::String> font_service_interfaces;
69 font_service_interfaces.push_back(font_service::FontService::Name_);
70 filter->filter.insert("mojo:font_service", font_service_interfaces.Pass());
71 #endif
72
73 application_connection_ = app->ConnectToApplicationWithCapabilityFilter(
74 request.Pass(), filter.Pass());
23 application_connection_->ConnectToService(view_manage_client); 75 application_connection_->ConnectToService(view_manage_client);
24 application_connection_->ConnectToService(&frame_tree_client_); 76 application_connection_->ConnectToService(&frame_tree_client_);
25 frame_tree_client_.set_connection_error_handler([]() { 77 frame_tree_client_.set_connection_error_handler([]() {
26 // TODO(sky): implement this. 78 // TODO(sky): implement this.
27 NOTIMPLEMENTED(); 79 NOTIMPLEMENTED();
28 }); 80 });
29 } 81 }
30 82
31 } // namespace mandoline 83 } // namespace mandoline
OLDNEW
« no previous file with comments | « mandoline/tab/DEPS ('k') | mojo/application/public/cpp/application_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698