Index: content/browser/web_contents/web_contents_view_mus.cc |
diff --git a/content/browser/web_contents/web_contents_view_mus.cc b/content/browser/web_contents/web_contents_view_mus.cc |
index 97e45f8c90fdc73a54959ff442d62975f2c6b383..625ff329760a0f23f6855574f16c07197f152822 100644 |
--- a/content/browser/web_contents/web_contents_view_mus.cc |
+++ b/content/browser/web_contents/web_contents_view_mus.cc |
@@ -5,6 +5,8 @@ |
#include "content/browser/web_contents/web_contents_view_mus.h" |
#include "build/build_config.h" |
+#include "components/mus/public/cpp/window.h" |
+#include "components/mus/public/cpp/window_tree_connection.h" |
#include "content/browser/renderer_host/render_widget_host_view_mus.h" |
#include "content/browser/web_contents/web_contents_impl.h" |
#include "content/public/browser/render_widget_host_view.h" |
@@ -17,12 +19,19 @@ namespace content { |
WebContentsViewMus::WebContentsViewMus( |
WebContentsImpl* web_contents, |
+ mus::Window* parent_window, |
scoped_ptr<WebContentsView> platform_view, |
RenderViewHostDelegateView** delegate_view) |
: web_contents_(web_contents), |
platform_view_(platform_view.Pass()), |
platform_view_delegate_view_(*delegate_view) { |
+ DCHECK(parent_window); |
*delegate_view = this; |
+ mus::Window* window = parent_window->connection()->NewWindow(); |
+ window->SetVisible(true); |
+ window->SetBounds(gfx::Rect(300, 300)); |
+ parent_window->AddChild(window); |
+ window_.reset(new mus::ScopedWindowPtr(window)); |
} |
WebContentsViewMus::~WebContentsViewMus() {} |
@@ -44,11 +53,15 @@ gfx::NativeWindow WebContentsViewMus::GetTopLevelNativeWindow() const { |
void WebContentsViewMus::GetContainerBounds(gfx::Rect* out) const { |
// TODO(fsamuel): Get the position right. |
- out->set_size(size_); |
+ *out = window_->window()->bounds(); |
} |
void WebContentsViewMus::SizeContents(const gfx::Size& size) { |
- size_ = size; |
+ gfx::Rect bounds = window_->window()->bounds(); |
+ if (bounds.size() != size) { |
+ bounds.set_size(size); |
+ window_->window()->SetBounds(bounds); |
+ } |
RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); |
if (rwhv) |
rwhv->SetSize(size); |
@@ -59,7 +72,7 @@ void WebContentsViewMus::SetInitialFocus() { |
} |
gfx::Rect WebContentsViewMus::GetViewBounds() const { |
- return gfx::Rect(size_); |
+ return window_->window()->bounds(); |
} |
#if defined(OS_MACOSX) |
@@ -75,7 +88,7 @@ bool WebContentsViewMus::GetAllowOtherViews() const { |
void WebContentsViewMus::CreateView(const gfx::Size& initial_size, |
gfx::NativeView context) { |
platform_view_->CreateView(initial_size, context); |
- size_ = initial_size; |
+ window_->window()->SetBounds(platform_view_->GetViewBounds()); |
} |
RenderWidgetHostViewBase* WebContentsViewMus::CreateViewForWidget( |
@@ -85,7 +98,7 @@ RenderWidgetHostViewBase* WebContentsViewMus::CreateViewForWidget( |
platform_view_->CreateViewForWidget(render_widget_host, true); |
return new RenderWidgetHostViewMus( |
- RenderWidgetHostImpl::From(render_widget_host), |
+ window_->window(), RenderWidgetHostImpl::From(render_widget_host), |
platform_widget->GetWeakPtr()); |
} |