| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/ui/ws/server_window.h" | 5 #include "services/ui/ws/server_window.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 void ServerWindow::AddObserver(ServerWindowObserver* observer) { | 71 void ServerWindow::AddObserver(ServerWindowObserver* observer) { |
| 72 observers_.AddObserver(observer); | 72 observers_.AddObserver(observer); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void ServerWindow::RemoveObserver(ServerWindowObserver* observer) { | 75 void ServerWindow::RemoveObserver(ServerWindowObserver* observer) { |
| 76 DCHECK(observers_.HasObserver(observer)); | 76 DCHECK(observers_.HasObserver(observer)); |
| 77 observers_.RemoveObserver(observer); | 77 observers_.RemoveObserver(observer); |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool ServerWindow::HasObserver(ServerWindowObserver* observer) { |
| 81 return observers_.HasObserver(observer); |
| 82 } |
| 83 |
| 80 void ServerWindow::CreateSurface(mojom::SurfaceType surface_type, | 84 void ServerWindow::CreateSurface(mojom::SurfaceType surface_type, |
| 81 mojo::InterfaceRequest<mojom::Surface> request, | 85 mojo::InterfaceRequest<mojom::Surface> request, |
| 82 mojom::SurfaceClientPtr client) { | 86 mojom::SurfaceClientPtr client) { |
| 83 GetOrCreateSurfaceManager()->CreateSurface(surface_type, std::move(request), | 87 GetOrCreateSurfaceManager()->CreateSurface(surface_type, std::move(request), |
| 84 std::move(client)); | 88 std::move(client)); |
| 85 } | 89 } |
| 86 | 90 |
| 87 void ServerWindow::Add(ServerWindow* child) { | 91 void ServerWindow::Add(ServerWindow* child) { |
| 88 // We assume validation checks happened already. | 92 // We assume validation checks happened already. |
| 89 DCHECK(child); | 93 DCHECK(child); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 bool ServerWindow::IsDrawn() const { | 357 bool ServerWindow::IsDrawn() const { |
| 354 const ServerWindow* root = delegate_->GetRootWindow(this); | 358 const ServerWindow* root = delegate_->GetRootWindow(this); |
| 355 if (!root || !root->visible()) | 359 if (!root || !root->visible()) |
| 356 return false; | 360 return false; |
| 357 const ServerWindow* window = this; | 361 const ServerWindow* window = this; |
| 358 while (window && window != root && window->visible()) | 362 while (window && window != root && window->visible()) |
| 359 window = window->parent(); | 363 window = window->parent(); |
| 360 return root == window; | 364 return root == window; |
| 361 } | 365 } |
| 362 | 366 |
| 363 void ServerWindow::DestroySurfacesScheduledForDestruction() { | |
| 364 if (!surface_manager_) | |
| 365 return; | |
| 366 ServerWindowSurface* surface = surface_manager_->GetDefaultSurface(); | |
| 367 if (surface) | |
| 368 surface->DestroySurfacesScheduledForDestruction(); | |
| 369 | |
| 370 surface = surface_manager_->GetUnderlaySurface(); | |
| 371 if (surface) | |
| 372 surface->DestroySurfacesScheduledForDestruction(); | |
| 373 } | |
| 374 | |
| 375 ServerWindowSurfaceManager* ServerWindow::GetOrCreateSurfaceManager() { | 367 ServerWindowSurfaceManager* ServerWindow::GetOrCreateSurfaceManager() { |
| 376 if (!surface_manager_.get()) | 368 if (!surface_manager_.get()) |
| 377 surface_manager_ = base::MakeUnique<ServerWindowSurfaceManager>(this); | 369 surface_manager_ = base::MakeUnique<ServerWindowSurfaceManager>(this); |
| 378 return surface_manager_.get(); | 370 return surface_manager_.get(); |
| 379 } | 371 } |
| 380 | 372 |
| 381 void ServerWindow::SetUnderlayOffset(const gfx::Vector2d& offset) { | 373 void ServerWindow::SetUnderlayOffset(const gfx::Vector2d& offset) { |
| 382 if (offset == underlay_offset_) | 374 if (offset == underlay_offset_) |
| 383 return; | 375 return; |
| 384 | 376 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 } | 455 } |
| 464 | 456 |
| 465 // static | 457 // static |
| 466 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { | 458 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { |
| 467 return &window->stacking_target_; | 459 return &window->stacking_target_; |
| 468 } | 460 } |
| 469 | 461 |
| 470 } // namespace ws | 462 } // namespace ws |
| 471 | 463 |
| 472 } // namespace ui | 464 } // namespace ui |
| OLD | NEW |