Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: components/exo/shell_surface.cc

Issue 1490223002: exo: Use aura::Windows instead of views::Views as exo::Surfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and update unit tests Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/exo/shell_surface.h ('k') | components/exo/sub_surface_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « components/exo/shell_surface.h ('k') | components/exo/sub_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698