| 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/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 void ViewHierarchyChanged( | 94 void ViewHierarchyChanged( |
| 95 const views::View::ViewHierarchyChangedDetails& details) override { | 95 const views::View::ViewHierarchyChangedDetails& details) override { |
| 96 if (details.is_add && GetWidget() && !content_area_) { | 96 if (details.is_add && GetWidget() && !content_area_) { |
| 97 aura::Window* window = GetWidget()->GetNativeWindow(); | 97 aura::Window* window = GetWidget()->GetNativeWindow(); |
| 98 content_area_ = new aura::Window(nullptr); | 98 content_area_ = new aura::Window(nullptr); |
| 99 content_area_->Init(ui::LAYER_NOT_DRAWN); | 99 content_area_->Init(ui::LAYER_NOT_DRAWN); |
| 100 window->AddChild(content_area_); | 100 window->AddChild(content_area_); |
| 101 | 101 |
| 102 ui::mojom::WindowTreeClientPtr client; | 102 ui::mojom::WindowTreeClientPtr client; |
| 103 view_->GetWindowTreeClient(GetProxy(&client)); | 103 view_->GetWindowTreeClient(MakeRequest(&client)); |
| 104 const uint32_t embed_flags = 0; // Nothing special. | 104 const uint32_t embed_flags = 0; // Nothing special. |
| 105 aura::WindowPortMus::Get(content_area_) | 105 aura::WindowPortMus::Get(content_area_) |
| 106 ->Embed(std::move(client), embed_flags, base::Bind(&EmbedCallback)); | 106 ->Embed(std::move(client), embed_flags, base::Bind(&EmbedCallback)); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 // navigation::mojom::ViewClient: | 110 // navigation::mojom::ViewClient: |
| 111 void OpenURL(navigation::mojom::OpenURLParamsPtr params) override {} | 111 void OpenURL(navigation::mojom::OpenURLParamsPtr params) override {} |
| 112 void LoadingStateChanged(bool is_loading) override {} | 112 void LoadingStateChanged(bool is_loading) override {} |
| 113 void NavigationStateChanged(const GURL& url, | 113 void NavigationStateChanged(const GURL& url, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (reuse && !windows_.empty()) { | 185 if (reuse && !windows_.empty()) { |
| 186 windows_.back()->Activate(); | 186 windows_.back()->Activate(); |
| 187 return; | 187 return; |
| 188 } | 188 } |
| 189 | 189 |
| 190 navigation::mojom::ViewFactoryPtr view_factory; | 190 navigation::mojom::ViewFactoryPtr view_factory; |
| 191 context()->connector()->ConnectToInterface("navigation", &view_factory); | 191 context()->connector()->ConnectToInterface("navigation", &view_factory); |
| 192 navigation::mojom::ViewPtr view; | 192 navigation::mojom::ViewPtr view; |
| 193 navigation::mojom::ViewClientPtr view_client; | 193 navigation::mojom::ViewClientPtr view_client; |
| 194 navigation::mojom::ViewClientRequest view_client_request = | 194 navigation::mojom::ViewClientRequest view_client_request = |
| 195 GetProxy(&view_client); | 195 MakeRequest(&view_client); |
| 196 view_factory->CreateView(std::move(view_client), GetProxy(&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 |