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/public/cpp/web_view.h" | 5 #include "mandoline/tab/public/cpp/web_view.h" |
6 | 6 |
7 #include "components/view_manager/public/cpp/view.h" | 7 #include "components/view_manager/public/cpp/view.h" |
8 #include "mojo/application/public/cpp/application_impl.h" | 8 #include "mojo/application/public/cpp/application_impl.h" |
9 | 9 |
10 namespace web_view { | 10 namespace web_view { |
11 | 11 |
12 WebView::WebView(mojom::WebViewClient* client) : binding_(client) {} | 12 WebView::WebView(mojom::WebViewClient* client) : binding_(client) {} |
13 WebView::~WebView() {} | 13 WebView::~WebView() {} |
14 | 14 |
15 void WebView::Init(mojo::ApplicationImpl* app, mojo::View* view) { | 15 void WebView::Init(mojo::ApplicationImpl* app, mojo::View* view) { |
16 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 16 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
17 request->url = "mojo:web_view"; | 17 request->url = "mojo:web_view"; |
18 | 18 |
19 mojom::WebViewClientPtr client; | 19 mojom::WebViewClientPtr client; |
20 mojo::InterfaceRequest<mojom::WebViewClient> client_request = | 20 mojo::InterfaceRequest<mojom::WebViewClient> client_request = |
21 GetProxy(&client); | 21 GetProxy(&client); |
22 binding_.Bind(client_request.Pass()); | 22 binding_.Bind(client_request.Pass()); |
23 | 23 |
24 mojom::WebViewFactoryPtr factory; | 24 mojom::WebViewFactoryPtr factory; |
25 app->ConnectToService(request.Pass(), &factory); | 25 app->ConnectToService(request.Pass(), &factory); |
26 factory->CreateWebView(client.Pass(), GetProxy(&web_view_)); | 26 factory->CreateWebView(client.Pass(), GetProxy(&web_view_)); |
27 | 27 |
28 mojo::ViewManagerClientPtr view_manager_client; | 28 mojo::ViewTreeClientPtr view_tree_client; |
29 web_view_->GetViewManagerClient(GetProxy(&view_manager_client)); | 29 web_view_->GetViewTreeClient(GetProxy(&view_tree_client)); |
30 view->Embed(view_manager_client.Pass()); | 30 view->Embed(view_tree_client.Pass()); |
31 } | 31 } |
32 | 32 |
33 } // namespace web_view | 33 } // namespace web_view |
OLD | NEW |