OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mash/webtest/webtest.h" | 5 #include "mash/webtest/webtest.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 void Webtest::Launch(uint32_t what, mojom::LaunchMode how) { | 183 void Webtest::Launch(uint32_t what, mojom::LaunchMode how) { |
184 bool reuse = how == mojom::LaunchMode::REUSE || | 184 bool reuse = how == mojom::LaunchMode::REUSE || |
185 how == mojom::LaunchMode::DEFAULT; | 185 how == mojom::LaunchMode::DEFAULT; |
186 if (reuse && !windows_.empty()) { | 186 if (reuse && !windows_.empty()) { |
187 windows_.back()->Activate(); | 187 windows_.back()->Activate(); |
188 return; | 188 return; |
189 } | 189 } |
190 | 190 |
191 navigation::mojom::ViewFactoryPtr view_factory; | 191 navigation::mojom::ViewFactoryPtr view_factory; |
192 context()->connector()->ConnectToInterface("navigation", &view_factory); | 192 context()->connector()->BindInterface("navigation", &view_factory); |
193 navigation::mojom::ViewPtr view; | 193 navigation::mojom::ViewPtr view; |
194 navigation::mojom::ViewClientPtr view_client; | 194 navigation::mojom::ViewClientPtr view_client; |
195 navigation::mojom::ViewClientRequest view_client_request(&view_client); | 195 navigation::mojom::ViewClientRequest view_client_request(&view_client); |
196 view_factory->CreateView(std::move(view_client), MakeRequest(&view)); | 196 view_factory->CreateView(std::move(view_client), MakeRequest(&view)); |
197 UI* ui = new UI(this, std::move(view), std::move(view_client_request)); | 197 UI* ui = new UI(this, std::move(view), std::move(view_client_request)); |
198 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( | 198 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( |
199 ui, nullptr, gfx::Rect(50, 10, 600, 600)); | 199 ui, nullptr, gfx::Rect(50, 10, 600, 600)); |
200 ui->NavigateTo(GURL("http://www.theverge.com/")); | 200 ui->NavigateTo(GURL("http://www.theverge.com/")); |
201 window->Show(); | 201 window->Show(); |
202 AddWindow(window); | 202 AddWindow(window); |
203 } | 203 } |
204 | 204 |
205 void Webtest::Create(const service_manager::Identity& remote_identity, | 205 void Webtest::Create(const service_manager::Identity& remote_identity, |
206 mojom::LaunchableRequest request) { | 206 mojom::LaunchableRequest request) { |
207 bindings_.AddBinding(this, std::move(request)); | 207 bindings_.AddBinding(this, std::move(request)); |
208 } | 208 } |
209 | 209 |
210 } // namespace webtest | 210 } // namespace webtest |
211 } // namespace mash | 211 } // namespace mash |
OLD | NEW |