OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "components/web_view/public/cpp/web_view.h" | |
6 | |
7 #include <stdint.h> | |
8 #include <utility> | |
9 | |
10 #include "base/bind.h" | |
11 #include "components/mus/public/cpp/window.h" | |
12 #include "mojo/shell/public/cpp/shell.h" | |
13 | |
14 namespace web_view { | |
15 namespace { | |
16 | |
17 void OnEmbed(bool success, uint16_t connection_id) { | |
18 CHECK(success); | |
19 } | |
20 | |
21 } // namespace | |
22 | |
23 WebView::WebView(mojom::WebViewClient* client) : binding_(client) {} | |
24 WebView::~WebView() {} | |
25 | |
26 void WebView::Init(mojo::Shell* shell, mus::Window* window) { | |
27 mojom::WebViewFactoryPtr factory; | |
28 shell->ConnectToService("mojo:web_view", &factory); | |
29 factory->CreateWebView(binding_.CreateInterfacePtrAndBind(), | |
30 GetProxy(&web_view_)); | |
31 | |
32 mus::mojom::WindowTreeClientPtr window_tree_client; | |
33 web_view_->GetWindowTreeClient(GetProxy(&window_tree_client)); | |
34 window->Embed(std::move(window_tree_client), | |
35 mus::mojom::WindowTree::kAccessPolicyEmbedRoot, | |
36 base::Bind(&OnEmbed)); | |
37 } | |
38 | |
39 } // namespace web_view | |
OLD | NEW |