| Index: components/exo/shell_surface.cc
|
| diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc
|
| index dd6caba000c691fc0dc518366e4c58e35e326902..cf11569eddcc4e7b05cfd54c775f857efd404cc8 100644
|
| --- a/components/exo/shell_surface.cc
|
| +++ b/components/exo/shell_surface.cc
|
| @@ -67,8 +67,8 @@ views::Widget::InitParams CreateWidgetInitParams(
|
| ShellSurface::ShellSurface(Surface* surface) : surface_(surface) {
|
| surface_->SetSurfaceDelegate(this);
|
| surface_->AddSurfaceObserver(this);
|
| - surface_->SetVisible(true);
|
| - surface_->SetEnabled(true);
|
| + surface_->Show();
|
| + set_owned_by_client();
|
| }
|
|
|
| ShellSurface::~ShellSurface() {
|
| @@ -93,6 +93,8 @@ void ShellSurface::SetToplevel() {
|
| widget_.reset(new views::Widget);
|
| widget_->Init(params);
|
| widget_->GetNativeWindow()->set_owned_by_parent(false);
|
| + widget_->GetNativeWindow()->SetName("ExoShellSurface");
|
| + widget_->GetNativeWindow()->AddChild(surface_);
|
|
|
| // The position of a standard top level shell surface is managed by Ash.
|
| ash::wm::GetWindowState(widget_->GetNativeWindow())
|
| @@ -112,6 +114,8 @@ void ShellSurface::SetMaximized() {
|
| widget_.reset(new views::Widget);
|
| widget_->Init(params);
|
| widget_->GetNativeWindow()->set_owned_by_parent(false);
|
| + widget_->GetNativeWindow()->SetName("ExoShellSurface");
|
| + widget_->GetNativeWindow()->AddChild(surface_);
|
| }
|
|
|
| void ShellSurface::SetFullscreen() {
|
| @@ -127,6 +131,8 @@ void ShellSurface::SetFullscreen() {
|
| widget_.reset(new views::Widget);
|
| widget_->Init(params);
|
| widget_->GetNativeWindow()->set_owned_by_parent(false);
|
| + widget_->GetNativeWindow()->SetName("ExoShellSurface");
|
| + widget_->GetNativeWindow()->AddChild(surface_);
|
| }
|
|
|
| void ShellSurface::SetTitle(const base::string16& title) {
|
| @@ -161,10 +167,14 @@ scoped_refptr<base::trace_event::TracedValue> ShellSurface::AsTracedValue()
|
| void ShellSurface::OnSurfaceCommit() {
|
| surface_->CommitSurfaceHierarchy();
|
| if (widget_) {
|
| + // Update surface bounds and widget size.
|
| + gfx::Point origin;
|
| + views::View::ConvertPointToWidget(this, &origin);
|
| + surface_->SetBounds(gfx::Rect(origin, surface_->layer()->size()));
|
| widget_->SetSize(widget_->non_client_view()->GetPreferredSize());
|
|
|
| // Show widget if not already visible.
|
| - if (!widget_->GetNativeWindow()->TargetVisibility())
|
| + if (!widget_->IsClosed() && !widget_->IsVisible())
|
| widget_->Show();
|
| }
|
| }
|
| @@ -198,7 +208,7 @@ const views::Widget* ShellSurface::GetWidget() const {
|
| }
|
|
|
| views::View* ShellSurface::GetContentsView() {
|
| - return surface_;
|
| + return this;
|
| }
|
|
|
| views::NonClientFrameView* ShellSurface::CreateNonClientFrameView(
|
| @@ -206,4 +216,11 @@ views::NonClientFrameView* ShellSurface::CreateNonClientFrameView(
|
| return new CustomFrameView(widget);
|
| }
|
|
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// views::Views overrides:
|
| +
|
| +gfx::Size ShellSurface::GetPreferredSize() const {
|
| + return surface_ ? surface_->GetPreferredSize() : gfx::Size();
|
| +}
|
| +
|
| } // namespace exo
|
|
|