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

Unified Diff: ui/aura/mus/window_port_mus.cc

Issue 2797263002: Aura-Mus: Implement gutter in the embedder. (Closed)
Patch Set: Addressed sadrul's comments Created 3 years, 8 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
Index: ui/aura/mus/window_port_mus.cc
diff --git a/ui/aura/mus/window_port_mus.cc b/ui/aura/mus/window_port_mus.cc
index a6c5ed02dd4139fc9d7bccd9ca8c67a06434ddf3..1420228e6649ffec6496402e0a3a33443db489e0 100644
--- a/ui/aura/mus/window_port_mus.cc
+++ b/ui/aura/mus/window_port_mus.cc
@@ -44,7 +44,7 @@ WindowPortMus::WindowPortMus(WindowTreeClient* client,
: WindowMus(window_mus_type), window_tree_client_(client) {}
WindowPortMus::~WindowPortMus() {
- SetPrimarySurfaceInfo(cc::SurfaceInfo());
+ client_surface_embedder_.reset();
// DESTROY is only scheduled from DestroyFromServer(), meaning if DESTROY is
// present then the server originated the change.
@@ -328,8 +328,8 @@ void WindowPortMus::SetPrimarySurfaceInfo(const cc::SurfaceInfo& surface_info) {
void WindowPortMus::SetFallbackSurfaceInfo(
const cc::SurfaceInfo& surface_info) {
- DCHECK(client_surface_embedder_);
- client_surface_embedder_->SetFallbackSurfaceInfo(surface_info);
+ fallback_surface_info_ = surface_info;
+ UpdateClientSurfaceEmbedder();
}
void WindowPortMus::DestroyFromServer() {
@@ -477,8 +477,6 @@ void WindowPortMus::OnVisibilityChanged(bool visible) {
change_data.visible = visible;
if (!RemoveChangeByTypeAndData(ServerChangeType::VISIBLE, change_data))
window_tree_client_->OnWindowMusSetVisible(this, visible);
- // We should only embed a client if its visible.
- UpdateClientSurfaceEmbedder();
}
void WindowPortMus::OnDidChangeBounds(const gfx::Rect& old_bounds,
@@ -487,6 +485,8 @@ void WindowPortMus::OnDidChangeBounds(const gfx::Rect& old_bounds,
change_data.bounds_in_dip = new_bounds;
if (!RemoveChangeByTypeAndData(ServerChangeType::BOUNDS, change_data))
window_tree_client_->OnWindowMusBoundsChanged(this, old_bounds, new_bounds);
+ if (client_surface_embedder_)
+ client_surface_embedder_->UpdateSizeAndGutters();
}
std::unique_ptr<ui::PropertyData> WindowPortMus::OnWillChangeProperty(
@@ -536,13 +536,18 @@ void WindowPortMus::UpdatePrimarySurfaceInfo() {
}
void WindowPortMus::UpdateClientSurfaceEmbedder() {
- if (!client_surface_embedder_ && primary_surface_info_.is_valid())
- client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>(window_);
+ bool embeds_surface = window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM ||
+ window_mus_type() == WindowMusType::EMBED_IN_OWNER;
+ if (!embeds_surface)
+ return;
- if (primary_surface_info_.is_valid() && window_->IsVisible())
- client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_);
- else
- client_surface_embedder_.reset();
+ if (!client_surface_embedder_) {
+ client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>(
+ window_, window_tree_client_->normal_client_area_insets_);
+ }
+
+ client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_);
+ client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_);
}
} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698