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..639d9a4bf795d1213182f3a02013b8b151e75033 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,9 +19,16 @@ 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); |
} |
@@ -36,18 +49,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 +76,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 +107,11 @@ void RenderWidgetHostViewMus::SetTooltipText( |
// TOOD(fsamuel): Ask window manager for tooltip? |
} |
+void RenderWidgetHostViewMus::Embed( |
+ mus::mojom::WindowTreeClientPtr tree_client) { |
+ window_->window()->Embed(tree_client.Pass()); |
+} |
+ |
void RenderWidgetHostViewMus::InitAsChild(gfx::NativeView parent_view) { |
platform_view_->InitAsChild(parent_view); |
} |
@@ -99,6 +120,10 @@ RenderWidgetHost* RenderWidgetHostViewMus::GetRenderWidgetHost() const { |
return host_; |
} |
+RenderWidgetHostViewMus* RenderWidgetHostViewMus::AsMusView() { |
+ return this; |
+} |
+ |
void RenderWidgetHostViewMus::InitAsPopup( |
RenderWidgetHostView* parent_host_view, |
const gfx::Rect& bounds) { |
@@ -111,11 +136,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 +237,7 @@ bool RenderWidgetHostViewMus::GetScreenColorProfile( |
} |
gfx::Rect RenderWidgetHostViewMus::GetBoundsInRootWindow() { |
- return GetViewBounds(); |
+ return platform_view_->GetBoundsInRootWindow(); |
} |
#if defined(OS_MACOSX) |