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

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

Issue 1455833005: Convert ConnectToApplication to take a params class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 1 month 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "components/mus/public/cpp/window.h" 8 #include "components/mus/public/cpp/window.h"
9 #include "mojo/application/public/cpp/application_impl.h" 9 #include "mojo/application/public/cpp/application_impl.h"
10 10
11 namespace web_view { 11 namespace web_view {
12 namespace { 12 namespace {
13 13
14 void OnEmbed(bool success, uint16 connection_id) { 14 void OnEmbed(bool success, uint16 connection_id) {
15 CHECK(success); 15 CHECK(success);
16 } 16 }
17 17
18 } // namespace 18 } // namespace
19 19
20 WebView::WebView(mojom::WebViewClient* client) : binding_(client) {} 20 WebView::WebView(mojom::WebViewClient* client) : binding_(client) {}
21 WebView::~WebView() {} 21 WebView::~WebView() {}
22 22
23 void WebView::Init(mojo::ApplicationImpl* app, mus::Window* window) { 23 void WebView::Init(mojo::ApplicationImpl* app, mus::Window* window) {
24 mojo::URLRequestPtr request(mojo::URLRequest::New());
25 request->url = "mojo:web_view";
26
27 mojom::WebViewClientPtr client; 24 mojom::WebViewClientPtr client;
28 mojo::InterfaceRequest<mojom::WebViewClient> client_request = 25 mojo::InterfaceRequest<mojom::WebViewClient> client_request =
29 GetProxy(&client); 26 GetProxy(&client);
30 binding_.Bind(client_request.Pass()); 27 binding_.Bind(client_request.Pass());
31 28
32 mojom::WebViewFactoryPtr factory; 29 mojom::WebViewFactoryPtr factory;
33 app->ConnectToService(request.Pass(), &factory); 30 app->ConnectToService("mojo:web_view", &factory);
34 factory->CreateWebView(client.Pass(), GetProxy(&web_view_)); 31 factory->CreateWebView(client.Pass(), GetProxy(&web_view_));
35 32
36 mus::mojom::WindowTreeClientPtr window_tree_client; 33 mus::mojom::WindowTreeClientPtr window_tree_client;
37 web_view_->GetWindowTreeClient(GetProxy(&window_tree_client)); 34 web_view_->GetWindowTreeClient(GetProxy(&window_tree_client));
38 window->Embed(window_tree_client.Pass(), 35 window->Embed(window_tree_client.Pass(),
39 mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, 36 mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT,
40 base::Bind(&OnEmbed)); 37 base::Bind(&OnEmbed));
41 } 38 }
42 39
43 } // namespace web_view 40 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/frame_devtools_agent.cc ('k') | content/browser/mojo/mojo_shell_client_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698