cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / web_view / public / cpp / web_view.cc
blob11c7d35429d8462866d07491e07c1fe6481ff28e
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.
5 #include "components/web_view/public/cpp/web_view.h"
7 #include "components/view_manager/public/cpp/view.h"
8 #include "mojo/application/public/cpp/application_impl.h"
10 namespace web_view {
12 WebView::WebView(mojom::WebViewClient* client) : binding_(client) {}
13 WebView::~WebView() {}
15 void WebView::Init(mojo::ApplicationImpl* app, mojo::View* view) {
16 view->SetAccessPolicy(mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT);
18 mojo::URLRequestPtr request(mojo::URLRequest::New());
19 request->url = "mojo:web_view";
21 mojom::WebViewClientPtr client;
22 mojo::InterfaceRequest<mojom::WebViewClient> client_request =
23 GetProxy(&client);
24 binding_.Bind(client_request.Pass());
26 mojom::WebViewFactoryPtr factory;
27 app->ConnectToService(request.Pass(), &factory);
28 factory->CreateWebView(client.Pass(), GetProxy(&web_view_));
30 mojo::ViewTreeClientPtr view_tree_client;
31 web_view_->GetViewTreeClient(GetProxy(&view_tree_client));
32 view->Embed(view_tree_client.Pass());
35 } // namespace web_view