| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 visible_ = value; | 281 visible_ = value; |
| 282 for (auto& observer : observers_) | 282 for (auto& observer : observers_) |
| 283 observer.OnWindowVisibilityChanged(this); | 283 observer.OnWindowVisibilityChanged(this); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void ServerWindow::SetOpacity(float value) { | 286 void ServerWindow::SetOpacity(float value) { |
| 287 if (value == opacity_) | 287 if (value == opacity_) |
| 288 return; | 288 return; |
| 289 float old_opacity = opacity_; | 289 float old_opacity = opacity_; |
| 290 opacity_ = value; | 290 opacity_ = value; |
| 291 delegate_->OnScheduleWindowPaint(this); | |
| 292 for (auto& observer : observers_) | 291 for (auto& observer : observers_) |
| 293 observer.OnWindowOpacityChanged(this, old_opacity, opacity_); | 292 observer.OnWindowOpacityChanged(this, old_opacity, opacity_); |
| 294 } | 293 } |
| 295 | 294 |
| 296 void ServerWindow::SetPredefinedCursor(ui::mojom::Cursor value) { | 295 void ServerWindow::SetPredefinedCursor(ui::mojom::Cursor value) { |
| 297 if (value == cursor_id_) | 296 if (value == cursor_id_) |
| 298 return; | 297 return; |
| 299 cursor_id_ = value; | 298 cursor_id_ = value; |
| 300 for (auto& observer : observers_) | 299 for (auto& observer : observers_) |
| 301 observer.OnWindowPredefinedCursorChanged(this, value); | 300 observer.OnWindowPredefinedCursorChanged(this, value); |
| 302 } | 301 } |
| 303 | 302 |
| 304 void ServerWindow::SetNonClientCursor(ui::mojom::Cursor value) { | 303 void ServerWindow::SetNonClientCursor(ui::mojom::Cursor value) { |
| 305 if (value == non_client_cursor_id_) | 304 if (value == non_client_cursor_id_) |
| 306 return; | 305 return; |
| 307 non_client_cursor_id_ = value; | 306 non_client_cursor_id_ = value; |
| 308 for (auto& observer : observers_) | 307 for (auto& observer : observers_) |
| 309 observer.OnWindowNonClientCursorChanged(this, value); | 308 observer.OnWindowNonClientCursorChanged(this, value); |
| 310 } | 309 } |
| 311 | 310 |
| 312 void ServerWindow::SetTransform(const gfx::Transform& transform) { | 311 void ServerWindow::SetTransform(const gfx::Transform& transform) { |
| 313 if (transform_ == transform) | 312 if (transform_ == transform) |
| 314 return; | 313 return; |
| 315 | 314 |
| 316 transform_ = transform; | 315 transform_ = transform; |
| 317 delegate_->OnScheduleWindowPaint(this); | |
| 318 } | 316 } |
| 319 | 317 |
| 320 void ServerWindow::SetProperty(const std::string& name, | 318 void ServerWindow::SetProperty(const std::string& name, |
| 321 const std::vector<uint8_t>* value) { | 319 const std::vector<uint8_t>* value) { |
| 322 auto it = properties_.find(name); | 320 auto it = properties_.find(name); |
| 323 if (it != properties_.end()) { | 321 if (it != properties_.end()) { |
| 324 if (value && it->second == *value) | 322 if (value && it->second == *value) |
| 325 return; | 323 return; |
| 326 } else if (!value) { | 324 } else if (!value) { |
| 327 // This property isn't set in |properties_| and |value| is nullptr, so | 325 // This property isn't set in |properties_| and |value| is nullptr, so |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 compositor_frame_sink_manager_ = | 372 compositor_frame_sink_manager_ = |
| 375 base::MakeUnique<ServerWindowCompositorFrameSinkManager>(this); | 373 base::MakeUnique<ServerWindowCompositorFrameSinkManager>(this); |
| 376 return compositor_frame_sink_manager_.get(); | 374 return compositor_frame_sink_manager_.get(); |
| 377 } | 375 } |
| 378 | 376 |
| 379 void ServerWindow::SetUnderlayOffset(const gfx::Vector2d& offset) { | 377 void ServerWindow::SetUnderlayOffset(const gfx::Vector2d& offset) { |
| 380 if (offset == underlay_offset_) | 378 if (offset == underlay_offset_) |
| 381 return; | 379 return; |
| 382 | 380 |
| 383 underlay_offset_ = offset; | 381 underlay_offset_ = offset; |
| 384 delegate_->OnScheduleWindowPaint(this); | |
| 385 } | 382 } |
| 386 | 383 |
| 387 void ServerWindow::OnEmbeddedAppDisconnected() { | 384 void ServerWindow::OnEmbeddedAppDisconnected() { |
| 388 for (auto& observer : observers_) | 385 for (auto& observer : observers_) |
| 389 observer.OnWindowEmbeddedAppDisconnected(this); | 386 observer.OnWindowEmbeddedAppDisconnected(this); |
| 390 } | 387 } |
| 391 | 388 |
| 392 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) | 389 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
| 393 std::string ServerWindow::GetDebugWindowHierarchy() const { | 390 std::string ServerWindow::GetDebugWindowHierarchy() const { |
| 394 std::string result; | 391 std::string result; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 } | 458 } |
| 462 | 459 |
| 463 // static | 460 // static |
| 464 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { | 461 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { |
| 465 return &window->stacking_target_; | 462 return &window->stacking_target_; |
| 466 } | 463 } |
| 467 | 464 |
| 468 } // namespace ws | 465 } // namespace ws |
| 469 | 466 |
| 470 } // namespace ui | 467 } // namespace ui |
| OLD | NEW |