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

Unified Diff: components/exo/shell_surface.cc

Issue 1419373013: exo: Add support for subcompositor interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@exosphere-xdg-shell
Patch Set: address review feedback Created 5 years, 1 month 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.h » ('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 0e7e90a3634c6a821fa48b17073bd47c5e731e8b..e8a0e604de3d0e34e85527ec937b3490a469e807 100644
--- a/components/exo/shell_surface.cc
+++ b/components/exo/shell_surface.cc
@@ -52,11 +52,14 @@ class CustomFrameView : public views::NonClientFrameView {
ShellSurface::ShellSurface(Surface* surface)
: surface_(surface), show_state_(ui::SHOW_STATE_END) {
surface_->SetSurfaceDelegate(this);
+ surface_->AddSurfaceObserver(this);
}
ShellSurface::~ShellSurface() {
- if (surface_)
+ if (surface_) {
surface_->SetSurfaceDelegate(nullptr);
+ surface_->RemoveSurfaceObserver(this);
+ }
if (widget_)
widget_->CloseNow();
}
@@ -106,13 +109,11 @@ scoped_refptr<base::trace_event::TracedValue> ShellSurface::AsTracedValue()
////////////////////////////////////////////////////////////////////////////////
// SurfaceDelegate overrides:
-void ShellSurface::OnSurfaceDestroying() {
- surface_ = nullptr;
-}
-
void ShellSurface::OnSurfaceCommit() {
- if (widget_ || show_state_ == ui::SHOW_STATE_END)
+ if (widget_ || show_state_ == ui::SHOW_STATE_END) {
+ surface_->CommitSurfaceHierarchy();
return;
+ }
views::Widget::InitParams params;
params.type = views::Widget::InitParams::TYPE_WINDOW;
@@ -131,9 +132,27 @@ void ShellSurface::OnSurfaceCommit() {
widget_->Init(params);
widget_->GetNativeWindow()->set_owned_by_parent(false);
widget_->GetNativeView()->SetName("ShellSurface");
+
+ surface_->CommitSurfaceHierarchy();
+ surface_->SetVisible(true);
+ surface_->SetEnabled(true);
+
widget_->Show();
}
+bool ShellSurface::IsSurfaceSynchronized() const {
+ // A shell surface is always desynchronized.
+ return false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// SurfaceObserver overrides:
+
+void ShellSurface::OnSurfaceDestroying(Surface* surface) {
+ surface->RemoveSurfaceObserver(this);
+ surface_ = nullptr;
+}
+
////////////////////////////////////////////////////////////////////////////////
// views::WidgetDelegate overrides:
« no previous file with comments | « components/exo/shell_surface.h ('k') | components/exo/sub_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698