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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "components/mus/public/cpp/window.h" | 11 #include "components/mus/public/cpp/window.h" |
11 #include "mojo/application/public/cpp/application_impl.h" | 12 #include "mojo/application/public/cpp/application_impl.h" |
12 | 13 |
13 namespace web_view { | 14 namespace web_view { |
14 namespace { | 15 namespace { |
15 | 16 |
16 void OnEmbed(bool success, uint16_t connection_id) { | 17 void OnEmbed(bool success, uint16_t connection_id) { |
17 CHECK(success); | 18 CHECK(success); |
18 } | 19 } |
19 | 20 |
20 } // namespace | 21 } // namespace |
21 | 22 |
22 WebView::WebView(mojom::WebViewClient* client) : binding_(client) {} | 23 WebView::WebView(mojom::WebViewClient* client) : binding_(client) {} |
23 WebView::~WebView() {} | 24 WebView::~WebView() {} |
24 | 25 |
25 void WebView::Init(mojo::ApplicationImpl* app, mus::Window* window) { | 26 void WebView::Init(mojo::ApplicationImpl* app, mus::Window* window) { |
26 mojom::WebViewClientPtr client; | 27 mojom::WebViewClientPtr client; |
27 mojo::InterfaceRequest<mojom::WebViewClient> client_request = | 28 mojo::InterfaceRequest<mojom::WebViewClient> client_request = |
28 GetProxy(&client); | 29 GetProxy(&client); |
29 binding_.Bind(client_request.Pass()); | 30 binding_.Bind(std::move(client_request)); |
30 | 31 |
31 mojom::WebViewFactoryPtr factory; | 32 mojom::WebViewFactoryPtr factory; |
32 app->ConnectToService("mojo:web_view", &factory); | 33 app->ConnectToService("mojo:web_view", &factory); |
33 factory->CreateWebView(client.Pass(), GetProxy(&web_view_)); | 34 factory->CreateWebView(std::move(client), GetProxy(&web_view_)); |
34 | 35 |
35 mus::mojom::WindowTreeClientPtr window_tree_client; | 36 mus::mojom::WindowTreeClientPtr window_tree_client; |
36 web_view_->GetWindowTreeClient(GetProxy(&window_tree_client)); | 37 web_view_->GetWindowTreeClient(GetProxy(&window_tree_client)); |
37 window->Embed(window_tree_client.Pass(), | 38 window->Embed(std::move(window_tree_client), |
38 mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, | 39 mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, |
39 base::Bind(&OnEmbed)); | 40 base::Bind(&OnEmbed)); |
40 } | 41 } |
41 | 42 |
42 } // namespace web_view | 43 } // namespace web_view |
OLD | NEW |