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

Side by Side Diff: components/web_view/public/cpp/web_view.cc

Issue 1635603002: Make use of CreateInterfacePtrAndBind() where appropriate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks Created 4 years, 11 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
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/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 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "components/mus/public/cpp/window.h" 11 #include "components/mus/public/cpp/window.h"
12 #include "mojo/shell/public/cpp/application_impl.h" 12 #include "mojo/shell/public/cpp/application_impl.h"
13 13
14 namespace web_view { 14 namespace web_view {
15 namespace { 15 namespace {
16 16
17 void OnEmbed(bool success, uint16_t connection_id) { 17 void OnEmbed(bool success, uint16_t connection_id) {
18 CHECK(success); 18 CHECK(success);
19 } 19 }
20 20
21 } // namespace 21 } // namespace
22 22
23 WebView::WebView(mojom::WebViewClient* client) : binding_(client) {} 23 WebView::WebView(mojom::WebViewClient* client) : binding_(client) {}
24 WebView::~WebView() {} 24 WebView::~WebView() {}
25 25
26 void WebView::Init(mojo::ApplicationImpl* app, mus::Window* window) { 26 void WebView::Init(mojo::ApplicationImpl* app, mus::Window* window) {
27 mojom::WebViewClientPtr client;
28 mojo::InterfaceRequest<mojom::WebViewClient> client_request =
29 GetProxy(&client);
30 binding_.Bind(std::move(client_request));
31
32 mojom::WebViewFactoryPtr factory; 27 mojom::WebViewFactoryPtr factory;
33 app->ConnectToService("mojo:web_view", &factory); 28 app->ConnectToService("mojo:web_view", &factory);
34 factory->CreateWebView(std::move(client), GetProxy(&web_view_)); 29 factory->CreateWebView(binding_.CreateInterfacePtrAndBind(),
30 GetProxy(&web_view_));
35 31
36 mus::mojom::WindowTreeClientPtr window_tree_client; 32 mus::mojom::WindowTreeClientPtr window_tree_client;
37 web_view_->GetWindowTreeClient(GetProxy(&window_tree_client)); 33 web_view_->GetWindowTreeClient(GetProxy(&window_tree_client));
38 window->Embed(std::move(window_tree_client), 34 window->Embed(std::move(window_tree_client),
39 mus::mojom::WindowTree::kAccessPolicyEmbedRoot, 35 mus::mojom::WindowTree::kAccessPolicyEmbedRoot,
40 base::Bind(&OnEmbed)); 36 base::Bind(&OnEmbed));
41 } 37 }
42 38
43 } // namespace web_view 39 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/frame_devtools_agent.cc ('k') | content/child/navigator_connect/service_port_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698