Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_view_mus.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_view_mus.cc b/content/browser/renderer_host/render_widget_host_view_mus.cc |
| index e3710354421139cd1eec7483f6e329692625df93..045ad5dd9409c7cff873d64be28b587b5f44da29 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_mus.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_mus.cc |
| @@ -4,7 +4,13 @@ |
| #include "content/browser/renderer_host/render_widget_host_view_mus.h" |
| +#include "components/mus/public/cpp/window.h" |
| +#include "components/mus/public/cpp/window_tree_connection.h" |
| +#include "content/browser/mojo/mojo_shell_client_host.h" |
| +#include "content/browser/renderer_host/render_process_host_impl.h" |
| #include "content/browser/renderer_host/render_widget_host_impl.h" |
| +#include "content/public/common/mojo_shell_connection.h" |
| +#include "mojo/application/public/cpp/application_impl.h" |
| namespace blink { |
| struct WebScreenInfo; |
| @@ -13,10 +19,24 @@ struct WebScreenInfo; |
| namespace content { |
| RenderWidgetHostViewMus::RenderWidgetHostViewMus( |
| + mus::Window* parent_window, |
| RenderWidgetHostImpl* host, |
| base::WeakPtr<RenderWidgetHostViewBase> platform_view) |
| : host_(host), platform_view_(platform_view) { |
| + DCHECK(parent_window); |
| + mus::Window* window = parent_window->connection()->NewWindow(); |
| + window->SetVisible(true); |
| + window->SetBounds(parent_window->bounds()); |
| + parent_window->AddChild(window); |
| + window_.reset(new mus::ScopedWindowPtr(window)); |
| host_->SetView(this); |
| + |
| + //if (!host_->GetProcess()->IsReady()) { |
|
Fady Samuel
2015/11/24 04:42:38
Delete this.
|
| + // host_->GetProcess()->AddObserver(this); |
| + // return; |
| + //} |
| + |
| + //EmbedClient(); |
| } |
| RenderWidgetHostViewMus::~RenderWidgetHostViewMus() {} |
| @@ -36,18 +56,21 @@ bool RenderWidgetHostViewMus::IsShowing() { |
| } |
| void RenderWidgetHostViewMus::SetSize(const gfx::Size& size) { |
| - size_ = size; |
| - host_->WasResized(); |
| + gfx::Rect bounds = window_->window()->bounds(); |
| + bounds.set_size(size); |
| + SetBounds(bounds); |
| } |
| void RenderWidgetHostViewMus::SetBounds(const gfx::Rect& rect) { |
| - SetSize(rect.size()); |
| + window_->window()->SetBounds(rect); |
| + host_->WasResized(); |
| } |
| void RenderWidgetHostViewMus::Focus() { |
| // TODO(fsamuel): Request focus for the associated Mus::Window |
| // We need to be careful how we propagate focus as we navigate to and |
| // from interstitials. |
| + window_->window()->SetFocus(); |
| } |
| bool RenderWidgetHostViewMus::HasFocus() const { |
| @@ -60,7 +83,7 @@ bool RenderWidgetHostViewMus::IsSurfaceAvailableForCopy() const { |
| } |
| gfx::Rect RenderWidgetHostViewMus::GetViewBounds() const { |
| - return gfx::Rect(size_); |
| + return window_->window()->bounds(); |
| } |
| gfx::Vector2dF RenderWidgetHostViewMus::GetLastScrollOffset() const { |
| @@ -91,6 +114,12 @@ void RenderWidgetHostViewMus::SetTooltipText( |
| // TOOD(fsamuel): Ask window manager for tooltip? |
| } |
| +void RenderWidgetHostViewMus::EmbedWindowTreeClient( |
| + mus::mojom::WindowTreeClientPtr tree_client) { |
| + fprintf(stderr, ">>>%s\n", __PRETTY_FUNCTION__); |
| + window_->window()->Embed(tree_client.Pass()); |
| +} |
| + |
| void RenderWidgetHostViewMus::InitAsChild(gfx::NativeView parent_view) { |
| platform_view_->InitAsChild(parent_view); |
| } |
| @@ -111,11 +140,11 @@ void RenderWidgetHostViewMus::InitAsFullscreen( |
| } |
| gfx::NativeView RenderWidgetHostViewMus::GetNativeView() const { |
| - return gfx::NativeView(); |
| + return platform_view_->GetNativeView(); |
| } |
| gfx::NativeViewId RenderWidgetHostViewMus::GetNativeViewId() const { |
| - return gfx::NativeViewId(); |
| + return platform_view_->GetNativeViewId(); |
| } |
| gfx::NativeViewAccessible RenderWidgetHostViewMus::GetNativeViewAccessible() { |
| @@ -212,7 +241,7 @@ bool RenderWidgetHostViewMus::GetScreenColorProfile( |
| } |
| gfx::Rect RenderWidgetHostViewMus::GetBoundsInRootWindow() { |
| - return GetViewBounds(); |
| + return platform_view_->GetBoundsInRootWindow(); |
| } |
| #if defined(OS_MACOSX) |