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

Unified Diff: components/exo/notification_surface.cc

Issue 2169513003: exo: Add notification surface to manager after commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nit, update dtor and only AddSurface when there are contents Created 4 years, 5 months 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/notification_surface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/notification_surface.cc
diff --git a/components/exo/notification_surface.cc b/components/exo/notification_surface.cc
index cb41a194dc8d1a515a5da46dfcbd6a6f9d39a3c0..c31aae9aa660cc6a51c327c9034235309d0d9b8d 100644
--- a/components/exo/notification_surface.cc
+++ b/components/exo/notification_surface.cc
@@ -85,11 +85,9 @@ NotificationSurface::NotificationSurface(NotificationSurfaceManager* manager,
window_->Init(ui::LAYER_NOT_DRAWN);
window_->set_owned_by_parent(false);
- // TODO(xiyuan): Fix after Surface no longer has an auar::Window.
+ // TODO(xiyuan): Fix after Surface no longer has an aura::Window.
window_->AddChild(surface_->window());
surface_->window()->Show();
-
- manager_->AddSurface(this);
}
NotificationSurface::~NotificationSurface() {
@@ -97,7 +95,8 @@ NotificationSurface::~NotificationSurface() {
surface_->SetSurfaceDelegate(nullptr);
surface_->RemoveSurfaceObserver(this);
}
- manager_->RemoveSurface(this);
+ if (added_to_manager_)
+ manager_->RemoveSurface(this);
}
gfx::Size NotificationSurface::GetSize() const {
@@ -113,6 +112,12 @@ void NotificationSurface::OnSurfaceCommit() {
bounds.set_size(surface_->content_size());
window_->SetBounds(bounds);
}
+
+ // Defer AddSurface until there are contents to show.
+ if (!added_to_manager_ && !surface_->content_size().IsEmpty()) {
+ added_to_manager_ = true;
+ manager_->AddSurface(this);
+ }
}
bool NotificationSurface::IsSurfaceSynchronized() const {
« no previous file with comments | « components/exo/notification_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698