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 "components/web_view/public/cpp/web_view.h" | 5 #include "components/web_view/public/cpp/web_view.h" |
6 | 6 |
7 #include "components/view_manager/public/cpp/view.h" | 7 #include "components/mus/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 view->SetAccessPolicy(mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT); | 16 view->SetAccessPolicy(mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT); |
17 | 17 |
18 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 18 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
19 request->url = "mojo:web_view"; | 19 request->url = "mojo:web_view"; |
20 | 20 |
21 mojom::WebViewClientPtr client; | 21 mojom::WebViewClientPtr client; |
22 mojo::InterfaceRequest<mojom::WebViewClient> client_request = | 22 mojo::InterfaceRequest<mojom::WebViewClient> client_request = |
23 GetProxy(&client); | 23 GetProxy(&client); |
24 binding_.Bind(client_request.Pass()); | 24 binding_.Bind(client_request.Pass()); |
25 | 25 |
26 mojom::WebViewFactoryPtr factory; | 26 mojom::WebViewFactoryPtr factory; |
27 app->ConnectToService(request.Pass(), &factory); | 27 app->ConnectToService(request.Pass(), &factory); |
28 factory->CreateWebView(client.Pass(), GetProxy(&web_view_)); | 28 factory->CreateWebView(client.Pass(), GetProxy(&web_view_)); |
29 | 29 |
30 mojo::ViewTreeClientPtr view_tree_client; | 30 mojo::ViewTreeClientPtr view_tree_client; |
31 web_view_->GetViewTreeClient(GetProxy(&view_tree_client)); | 31 web_view_->GetViewTreeClient(GetProxy(&view_tree_client)); |
32 view->Embed(view_tree_client.Pass()); | 32 view->Embed(view_tree_client.Pass()); |
33 } | 33 } |
34 | 34 |
35 } // namespace web_view | 35 } // namespace web_view |
OLD | NEW |