| OLD | NEW |
| 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 "content/browser/renderer_host/render_widget_host_view_mus.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mus.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "components/mus/public/cpp/window.h" | 10 #include "components/mus/public/cpp/window.h" |
| 11 #include "components/mus/public/cpp/window_tree_connection.h" | 11 #include "components/mus/public/cpp/window_tree_connection.h" |
| 12 #include "content/browser/mojo/mojo_shell_client_host.h" | 12 #include "content/browser/mojo/mojo_child_connection.h" |
| 13 #include "content/browser/renderer_host/render_process_host_impl.h" | 13 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 14 #include "content/browser/renderer_host/render_widget_host_impl.h" | 14 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 15 #include "content/common/render_widget_window_tree_client_factory.mojom.h" | 15 #include "content/common/render_widget_window_tree_client_factory.mojom.h" |
| 16 #include "content/public/common/mojo_shell_connection.h" | 16 #include "content/public/common/mojo_shell_connection.h" |
| 17 #include "mojo/shell/public/cpp/connector.h" | 17 #include "mojo/shell/public/cpp/connector.h" |
| 18 #include "ui/aura/client/screen_position_client.h" | 18 #include "ui/aura/client/screen_position_client.h" |
| 19 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 20 #include "ui/base/hit_test.h" | 20 #include "ui/base/hit_test.h" |
| 21 | 21 |
| 22 namespace blink { | 22 namespace blink { |
| 23 struct WebScreenInfo; | 23 struct WebScreenInfo; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 | 27 |
| 28 RenderWidgetHostViewMus::RenderWidgetHostViewMus(mus::Window* parent_window, | 28 RenderWidgetHostViewMus::RenderWidgetHostViewMus(mus::Window* parent_window, |
| 29 RenderWidgetHostImpl* host) | 29 RenderWidgetHostImpl* host) |
| 30 : host_(host), aura_window_(nullptr) { | 30 : host_(host), aura_window_(nullptr) { |
| 31 DCHECK(parent_window); | 31 DCHECK(parent_window); |
| 32 mus::Window* window = parent_window->connection()->NewWindow(); | 32 mus::Window* window = parent_window->connection()->NewWindow(); |
| 33 window->SetVisible(true); | 33 window->SetVisible(true); |
| 34 window->SetBounds(gfx::Rect(300, 300)); | 34 window->SetBounds(gfx::Rect(300, 300)); |
| 35 parent_window->AddChild(window); | 35 parent_window->AddChild(window); |
| 36 mus_window_.reset(new mus::ScopedWindowPtr(window)); | 36 mus_window_.reset(new mus::ScopedWindowPtr(window)); |
| 37 host_->SetView(this); | 37 host_->SetView(this); |
| 38 | 38 |
| 39 // Connect to the renderer, pass it a WindowTreeClient interface request | 39 // Connect to the renderer, pass it a WindowTreeClient interface request |
| 40 // and embed that client inside our mus window. | 40 // and embed that client inside our mus window. |
| 41 mojo::Identity identity = GetMojoIdentity(host_->GetProcess()); | |
| 42 mojom::RenderWidgetWindowTreeClientFactoryPtr factory; | 41 mojom::RenderWidgetWindowTreeClientFactoryPtr factory; |
| 43 MojoShellConnection::Get()->GetConnector()->ConnectToInterface( | 42 GetMojoConnection(host_->GetProcess())->GetInterface(&factory); |
| 44 identity, &factory); | |
| 45 | 43 |
| 46 mus::mojom::WindowTreeClientPtr window_tree_client; | 44 mus::mojom::WindowTreeClientPtr window_tree_client; |
| 47 factory->CreateWindowTreeClientForRenderWidget( | 45 factory->CreateWindowTreeClientForRenderWidget( |
| 48 host_->GetRoutingID(), mojo::GetProxy(&window_tree_client)); | 46 host_->GetRoutingID(), mojo::GetProxy(&window_tree_client)); |
| 49 mus_window_->window()->Embed(std::move(window_tree_client)); | 47 mus_window_->window()->Embed(std::move(window_tree_client)); |
| 50 } | 48 } |
| 51 | 49 |
| 52 RenderWidgetHostViewMus::~RenderWidgetHostViewMus() {} | 50 RenderWidgetHostViewMus::~RenderWidgetHostViewMus() {} |
| 53 | 51 |
| 54 void RenderWidgetHostViewMus::InternalSetBounds(const gfx::Rect& rect) { | 52 void RenderWidgetHostViewMus::InternalSetBounds(const gfx::Rect& rect) { |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 void RenderWidgetHostViewMus::SetParentNativeViewAccessible( | 324 void RenderWidgetHostViewMus::SetParentNativeViewAccessible( |
| 327 gfx::NativeViewAccessible accessible_parent) {} | 325 gfx::NativeViewAccessible accessible_parent) {} |
| 328 | 326 |
| 329 gfx::NativeViewId RenderWidgetHostViewMus::GetParentForWindowlessPlugin() | 327 gfx::NativeViewId RenderWidgetHostViewMus::GetParentForWindowlessPlugin() |
| 330 const { | 328 const { |
| 331 return gfx::NativeViewId(); | 329 return gfx::NativeViewId(); |
| 332 } | 330 } |
| 333 #endif | 331 #endif |
| 334 | 332 |
| 335 } // namespace content | 333 } // namespace content |
| OLD | NEW |