Chromium Code Reviews| 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 "base/debug/stack_trace.h" | |
| 8 | |
| 7 #include "components/mus/public/cpp/window.h" | 9 #include "components/mus/public/cpp/window.h" |
| 8 #include "components/mus/public/cpp/window_tree_connection.h" | 10 #include "components/mus/public/cpp/window_tree_connection.h" |
| 9 #include "content/browser/mojo/mojo_shell_client_host.h" | 11 #include "content/browser/mojo/mojo_shell_client_host.h" |
| 10 #include "content/browser/renderer_host/render_process_host_impl.h" | 12 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 11 #include "content/browser/renderer_host/render_widget_host_impl.h" | 13 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 12 #include "content/common/render_widget_window_tree_client_factory.mojom.h" | 14 #include "content/common/render_widget_window_tree_client_factory.mojom.h" |
| 13 #include "content/public/common/mojo_shell_connection.h" | 15 #include "content/public/common/mojo_shell_connection.h" |
| 14 #include "mojo/application/public/cpp/application_impl.h" | 16 #include "mojo/application/public/cpp/application_impl.h" |
| 15 | 17 |
| 16 namespace blink { | 18 namespace blink { |
| 17 struct WebScreenInfo; | 19 struct WebScreenInfo; |
| 18 } | 20 } |
| 19 | 21 |
| 20 namespace content { | 22 namespace content { |
| 21 | 23 |
| 24 void DoNothing(bool result) { | |
| 25 fprintf(stderr, "EEE %s %d\n", __func__, __LINE__); | |
| 26 } | |
| 27 | |
| 22 RenderWidgetHostViewMus::RenderWidgetHostViewMus( | 28 RenderWidgetHostViewMus::RenderWidgetHostViewMus( |
| 23 mus::Window* parent_window, | 29 mus::Window* parent_window, |
| 24 RenderWidgetHostImpl* host, | 30 RenderWidgetHostImpl* host, |
| 25 base::WeakPtr<RenderWidgetHostViewBase> platform_view) | 31 base::WeakPtr<RenderWidgetHostViewBase> platform_view) |
| 26 : host_(host), platform_view_(platform_view) { | 32 : host_(host), platform_view_(platform_view) { |
| 33 // base::debug::StackTrace().Print(); | |
| 34 // | |
| 27 DCHECK(parent_window); | 35 DCHECK(parent_window); |
| 28 mus::Window* window = parent_window->connection()->NewWindow(); | 36 mus::Window* window = parent_window->connection()->NewWindow(); |
| 29 window->SetVisible(true); | 37 window->SetVisible(true); |
| 30 window->SetBounds(gfx::Rect(300, 300)); | 38 window->SetBounds(gfx::Rect(300, 300)); |
| 31 parent_window->AddChild(window); | 39 parent_window->AddChild(window); |
| 32 window_.reset(new mus::ScopedWindowPtr(window)); | 40 window_.reset(new mus::ScopedWindowPtr(window)); |
| 33 host_->SetView(this); | 41 host_->SetView(this); |
| 34 | 42 |
| 35 // Connect to the renderer, pass it a WindowTreeClient interface request | 43 // Connect to the renderer, pass it a WindowTreeClient interface request |
| 36 // and embed that client inside our mus window. | 44 // and embed that client inside our mus window. |
| 37 std::string url = GetMojoApplicationInstanceURL(host_->GetProcess()); | 45 std::string url = GetMojoApplicationInstanceURL(host_->GetProcess()); |
| 38 mojom::RenderWidgetWindowTreeClientFactoryPtr factory; | 46 mojom::RenderWidgetWindowTreeClientFactoryPtr factory; |
| 39 MojoShellConnection::Get()->GetApplication()->ConnectToService(url, &factory); | 47 MojoShellConnection::Get()->GetApplication()->ConnectToService(url, &factory); |
| 40 | 48 |
| 41 mus::mojom::WindowTreeClientPtr window_tree_client; | 49 mus::mojom::WindowTreeClientPtr window_tree_client; |
| 42 factory->CreateWindowTreeClientForRenderWidget( | 50 factory->CreateWindowTreeClientForRenderWidget( |
| 43 host_->GetRoutingID(), mojo::GetProxy(&window_tree_client)); | 51 host_->GetRoutingID(), mojo::GetProxy(&window_tree_client), |
| 52 DoNothing); | |
|
Peng
2015/11/26 22:13:04
Looks like in the browser process, this function i
Fady Samuel
2015/11/27 00:26:21
Mojo IPCs and Chrome IPCs can be issued out of ord
| |
| 53 fprintf(stderr, "EEE %s %d\n", __func__, __LINE__); | |
| 54 factory.WaitForIncomingResponse(); | |
|
Peng
2015/11/27 15:08:03
I think WaitForImcomingResponse() should block cur
| |
| 55 fprintf(stderr, "EEE %s %d\n", __func__, __LINE__); | |
| 44 window_->window()->Embed(window_tree_client.Pass()); | 56 window_->window()->Embed(window_tree_client.Pass()); |
| 45 } | 57 } |
| 46 | 58 |
| 47 RenderWidgetHostViewMus::~RenderWidgetHostViewMus() {} | 59 RenderWidgetHostViewMus::~RenderWidgetHostViewMus() {} |
| 48 | 60 |
| 49 void RenderWidgetHostViewMus::Show() { | 61 void RenderWidgetHostViewMus::Show() { |
| 50 // TODO(fsamuel): Update visibility in Mus. | 62 // TODO(fsamuel): Update visibility in Mus. |
| 51 // There is some interstitial complexity that we'll need to figure out here. | 63 // There is some interstitial complexity that we'll need to figure out here. |
| 52 host_->WasShown(ui::LatencyInfo()); | 64 host_->WasShown(ui::LatencyInfo()); |
| 53 } | 65 } |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 void RenderWidgetHostViewMus::SetParentNativeViewAccessible( | 308 void RenderWidgetHostViewMus::SetParentNativeViewAccessible( |
| 297 gfx::NativeViewAccessible accessible_parent) {} | 309 gfx::NativeViewAccessible accessible_parent) {} |
| 298 | 310 |
| 299 gfx::NativeViewId RenderWidgetHostViewMus::GetParentForWindowlessPlugin() | 311 gfx::NativeViewId RenderWidgetHostViewMus::GetParentForWindowlessPlugin() |
| 300 const { | 312 const { |
| 301 return gfx::NativeViewId(); | 313 return gfx::NativeViewId(); |
| 302 } | 314 } |
| 303 #endif | 315 #endif |
| 304 | 316 |
| 305 } // namespace content | 317 } // namespace content |
| OLD | NEW |