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 "components/mus/ws/server_window.h" | 5 #include "components/mus/ws/server_window.h" |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "components/mus/common/transient_window_utils.h" | 10 #include "components/mus/common/transient_window_utils.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 ServerWindow::ServerWindow(ServerWindowDelegate* delegate, | 23 ServerWindow::ServerWindow(ServerWindowDelegate* delegate, |
24 const WindowId& id, | 24 const WindowId& id, |
25 const Properties& properties) | 25 const Properties& properties) |
26 : delegate_(delegate), | 26 : delegate_(delegate), |
27 id_(id), | 27 id_(id), |
28 parent_(nullptr), | 28 parent_(nullptr), |
29 stacking_target_(nullptr), | 29 stacking_target_(nullptr), |
30 transient_parent_(nullptr), | 30 transient_parent_(nullptr), |
31 visible_(false), | 31 visible_(false), |
| 32 cursor_id_(mojom::CURSOR_NULL), |
32 opacity_(1), | 33 opacity_(1), |
33 can_focus_(true), | 34 can_focus_(true), |
34 properties_(properties), | 35 properties_(properties), |
35 // Don't notify newly added observers during notification. This causes | 36 // Don't notify newly added observers during notification. This causes |
36 // problems for code that adds an observer as part of an observer | 37 // problems for code that adds an observer as part of an observer |
37 // notification (such as ServerWindowDrawTracker). | 38 // notification (such as ServerWindowDrawTracker). |
38 observers_( | 39 observers_( |
39 base::ObserverList<ServerWindowObserver>::NOTIFY_EXISTING_ONLY) { | 40 base::ObserverList<ServerWindowObserver>::NOTIFY_EXISTING_ONLY) { |
40 DCHECK(delegate); // Must provide a delegate. | 41 DCHECK(delegate); // Must provide a delegate. |
41 } | 42 } |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 OnWindowVisibilityChanged(this)); | 255 OnWindowVisibilityChanged(this)); |
255 } | 256 } |
256 | 257 |
257 void ServerWindow::SetOpacity(float value) { | 258 void ServerWindow::SetOpacity(float value) { |
258 if (value == opacity_) | 259 if (value == opacity_) |
259 return; | 260 return; |
260 opacity_ = value; | 261 opacity_ = value; |
261 delegate_->OnScheduleWindowPaint(this); | 262 delegate_->OnScheduleWindowPaint(this); |
262 } | 263 } |
263 | 264 |
| 265 void ServerWindow::SetPredefinedCursor(mus::mojom::Cursor value) { |
| 266 if (value == cursor_id_) |
| 267 return; |
| 268 cursor_id_ = value; |
| 269 FOR_EACH_OBSERVER( |
| 270 ServerWindowObserver, observers_, |
| 271 OnWindowPredefinedCursorChanged(this, static_cast<int32_t>(value))); |
| 272 } |
| 273 |
264 void ServerWindow::SetTransform(const gfx::Transform& transform) { | 274 void ServerWindow::SetTransform(const gfx::Transform& transform) { |
265 if (transform_ == transform) | 275 if (transform_ == transform) |
266 return; | 276 return; |
267 | 277 |
268 transform_ = transform; | 278 transform_ = transform; |
269 delegate_->OnScheduleWindowPaint(this); | 279 delegate_->OnScheduleWindowPaint(this); |
270 } | 280 } |
271 | 281 |
272 void ServerWindow::SetProperty(const std::string& name, | 282 void ServerWindow::SetProperty(const std::string& name, |
273 const std::vector<uint8_t>* value) { | 283 const std::vector<uint8_t>* value) { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 } | 416 } |
407 | 417 |
408 // static | 418 // static |
409 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { | 419 ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) { |
410 return &window->stacking_target_; | 420 return &window->stacking_target_; |
411 } | 421 } |
412 | 422 |
413 } // namespace ws | 423 } // namespace ws |
414 | 424 |
415 } // namespace mus | 425 } // namespace mus |
OLD | NEW |