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

Side by Side Diff: components/web_view/frame_connection.cc

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 years, 10 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 | « components/web_view/frame_connection.h ('k') | components/web_view/frame_devtools_agent.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 "components/web_view/frame_connection.h" 5 #include "components/web_view/frame_connection.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "components/clipboard/public/interfaces/clipboard.mojom.h" 12 #include "components/clipboard/public/interfaces/clipboard.mojom.h"
13 #include "components/mus/public/interfaces/display.mojom.h" 13 #include "components/mus/public/interfaces/display.mojom.h"
14 #include "components/mus/public/interfaces/gpu.mojom.h" 14 #include "components/mus/public/interfaces/gpu.mojom.h"
15 #include "components/mus/public/interfaces/window_tree_host.mojom.h" 15 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
16 #include "components/resource_provider/public/interfaces/resource_provider.mojom .h" 16 #include "components/resource_provider/public/interfaces/resource_provider.mojom .h"
17 #include "components/web_view/frame_tree.h" 17 #include "components/web_view/frame_tree.h"
18 #include "components/web_view/frame_utils.h" 18 #include "components/web_view/frame_utils.h"
19 #include "components/web_view/test_runner/public/interfaces/layout_test_runner.m ojom.h" 19 #include "components/web_view/test_runner/public/interfaces/layout_test_runner.m ojom.h"
20 #include "mojo/services/network/public/interfaces/cookie_store.mojom.h" 20 #include "mojo/services/network/public/interfaces/cookie_store.mojom.h"
21 #include "mojo/services/network/public/interfaces/network_service.mojom.h" 21 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
22 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" 22 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h"
23 #include "mojo/services/network/public/interfaces/web_socket_factory.mojom.h" 23 #include "mojo/services/network/public/interfaces/web_socket_factory.mojom.h"
24 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" 24 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
25 #include "mojo/shell/public/cpp/application_connection.h" 25 #include "mojo/shell/public/cpp/application_connection.h"
26 #include "mojo/shell/public/cpp/application_impl.h" 26 #include "mojo/shell/public/cpp/shell.h"
27 27
28 #if defined(OS_LINUX) && !defined(OS_ANDROID) 28 #if defined(OS_LINUX) && !defined(OS_ANDROID)
29 #include "components/font_service/public/interfaces/font_service.mojom.h" 29 #include "components/font_service/public/interfaces/font_service.mojom.h"
30 #endif 30 #endif
31 31
32 namespace web_view { 32 namespace web_view {
33 namespace { 33 namespace {
34 34
35 // Callback from when the content handler id is obtained. 35 // Callback from when the content handler id is obtained.
36 void OnGotContentHandlerForFrame( 36 void OnGotContentHandlerForFrame(
(...skipping 14 matching lines...) Expand all
51 } // namespace 51 } // namespace
52 52
53 FrameConnection::FrameConnection() : application_connection_(nullptr) { 53 FrameConnection::FrameConnection() : application_connection_(nullptr) {
54 } 54 }
55 55
56 FrameConnection::~FrameConnection() { 56 FrameConnection::~FrameConnection() {
57 } 57 }
58 58
59 // static 59 // static
60 void FrameConnection::CreateConnectionForCanNavigateFrame( 60 void FrameConnection::CreateConnectionForCanNavigateFrame(
61 mojo::ApplicationImpl* app, 61 mojo::Shell* shell,
62 Frame* frame, 62 Frame* frame,
63 mojo::URLRequestPtr request, 63 mojo::URLRequestPtr request,
64 const FrameTreeDelegate::CanNavigateFrameCallback& callback) { 64 const FrameTreeDelegate::CanNavigateFrameCallback& callback) {
65 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); 65 scoped_ptr<FrameConnection> frame_connection(new FrameConnection);
66 FrameConnection* connection = frame_connection.get(); 66 FrameConnection* connection = frame_connection.get();
67 connection->Init(app, std::move(request), 67 connection->Init(shell, std::move(request),
68 base::Bind(&OnGotContentHandlerForFrame, frame->app_id(), 68 base::Bind(&OnGotContentHandlerForFrame, frame->app_id(),
69 callback, base::Passed(&frame_connection))); 69 callback, base::Passed(&frame_connection)));
70 } 70 }
71 71
72 void FrameConnection::Init(mojo::ApplicationImpl* app, 72 void FrameConnection::Init(mojo::Shell* shell,
73 mojo::URLRequestPtr request, 73 mojo::URLRequestPtr request,
74 const base::Closure& on_got_id_callback) { 74 const base::Closure& on_got_id_callback) {
75 DCHECK(!application_connection_); 75 DCHECK(!application_connection_);
76 76
77 mojo::shell::mojom::CapabilityFilterPtr filter( 77 mojo::shell::mojom::CapabilityFilterPtr filter(
78 mojo::shell::mojom::CapabilityFilter::New()); 78 mojo::shell::mojom::CapabilityFilter::New());
79 mojo::Array<mojo::String> resource_provider_interfaces; 79 mojo::Array<mojo::String> resource_provider_interfaces;
80 resource_provider_interfaces.push_back( 80 resource_provider_interfaces.push_back(
81 resource_provider::ResourceProvider::Name_); 81 resource_provider::ResourceProvider::Name_);
82 filter->filter.insert("mojo:resource_provider", 82 filter->filter.insert("mojo:resource_provider",
(...skipping 27 matching lines...) Expand all
110 filter->filter.insert("mojo:web_view_test_runner", 110 filter->filter.insert("mojo:web_view_test_runner",
111 std::move(test_runner_interfaces)); 111 std::move(test_runner_interfaces));
112 112
113 #if defined(OS_LINUX) && !defined(OS_ANDROID) 113 #if defined(OS_LINUX) && !defined(OS_ANDROID)
114 mojo::Array<mojo::String> font_service_interfaces; 114 mojo::Array<mojo::String> font_service_interfaces;
115 font_service_interfaces.push_back(font_service::FontService::Name_); 115 font_service_interfaces.push_back(font_service::FontService::Name_);
116 filter->filter.insert("mojo:font_service", 116 filter->filter.insert("mojo:font_service",
117 std::move(font_service_interfaces)); 117 std::move(font_service_interfaces));
118 #endif 118 #endif
119 119
120 mojo::ApplicationImpl::ConnectParams params(std::move(request)); 120 mojo::Shell::ConnectParams params(std::move(request));
121 params.set_filter(std::move(filter)); 121 params.set_filter(std::move(filter));
122 application_connection_ = app->ConnectToApplication(&params); 122 application_connection_ = shell->ConnectToApplication(&params);
123 application_connection_->ConnectToService(&frame_client_); 123 application_connection_->ConnectToService(&frame_client_);
124 application_connection_->AddRemoteIDCallback(on_got_id_callback); 124 application_connection_->AddRemoteIDCallback(on_got_id_callback);
125 } 125 }
126 126
127 mus::mojom::WindowTreeClientPtr FrameConnection::GetWindowTreeClient() { 127 mus::mojom::WindowTreeClientPtr FrameConnection::GetWindowTreeClient() {
128 DCHECK(application_connection_); 128 DCHECK(application_connection_);
129 mus::mojom::WindowTreeClientPtr window_tree_client; 129 mus::mojom::WindowTreeClientPtr window_tree_client;
130 application_connection_->ConnectToService(&window_tree_client); 130 application_connection_->ConnectToService(&window_tree_client);
131 return window_tree_client; 131 return window_tree_client;
132 } 132 }
133 133
134 uint32_t FrameConnection::GetContentHandlerID() const { 134 uint32_t FrameConnection::GetContentHandlerID() const {
135 uint32_t content_handler_id = 135 uint32_t content_handler_id =
136 mojo::shell::mojom::Shell::kInvalidApplicationID; 136 mojo::shell::mojom::Shell::kInvalidApplicationID;
137 if (!application_connection_->GetRemoteContentHandlerID(&content_handler_id)) 137 if (!application_connection_->GetRemoteContentHandlerID(&content_handler_id))
138 NOTREACHED(); 138 NOTREACHED();
139 return content_handler_id; 139 return content_handler_id;
140 } 140 }
141 141
142 } // namespace web_view 142 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/frame_connection.h ('k') | components/web_view/frame_devtools_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698