| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/aura/mus/in_flight_change.h" | 5 #include "ui/aura/mus/in_flight_change.h" |
| 6 | 6 |
| 7 #include "ui/aura/mus/window_mus.h" | 7 #include "ui/aura/mus/window_mus.h" |
| 8 #include "ui/aura/mus/window_port_mus.h" | 8 #include "ui/aura/mus/window_port_mus.h" |
| 9 #include "ui/aura/mus/window_tree_client.h" | 9 #include "ui/aura/mus/window_tree_client.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 | 11 |
| 12 namespace aura { | 12 namespace aura { |
| 13 | 13 |
| 14 // InFlightChange ------------------------------------------------------------- | 14 // InFlightChange ------------------------------------------------------------- |
| 15 | 15 |
| 16 InFlightChange::InFlightChange(WindowMus* window, ChangeType type) | 16 InFlightChange::InFlightChange(WindowMus* window, ChangeType type) |
| 17 : window_(window), change_type_(type) {} | 17 : window_(window), change_type_(type) {} |
| 18 | 18 |
| 19 InFlightChange::~InFlightChange() {} | 19 InFlightChange::~InFlightChange() {} |
| 20 | 20 |
| 21 bool InFlightChange::Matches(const InFlightChange& change) const { | 21 bool InFlightChange::Matches(const InFlightChange& change) const { |
| 22 DCHECK(change.window_ == window_ && change.change_type_ == change_type_); | 22 DCHECK(change.window_ == window_ && change.change_type_ == change_type_); |
| 23 return true; | 23 return true; |
| 24 } | 24 } |
| 25 | 25 |
| 26 void InFlightChange::ChangeFailed() {} | 26 void InFlightChange::ChangeFailed() {} |
| 27 | 27 |
| 28 // InFlightBoundsChange ------------------------------------------------------- | 28 // InFlightBoundsChange ------------------------------------------------------- |
| 29 | 29 |
| 30 InFlightBoundsChange::InFlightBoundsChange(WindowMus* window, | 30 InFlightBoundsChange::InFlightBoundsChange(WindowTreeClient* window_tree_client, |
| 31 WindowMus* window, |
| 31 const gfx::Rect& revert_bounds) | 32 const gfx::Rect& revert_bounds) |
| 32 : InFlightChange(window, ChangeType::BOUNDS), | 33 : InFlightChange(window, ChangeType::BOUNDS), |
| 34 window_tree_client_(window_tree_client), |
| 33 revert_bounds_(revert_bounds) {} | 35 revert_bounds_(revert_bounds) {} |
| 34 | 36 |
| 35 void InFlightBoundsChange::SetRevertValueFrom(const InFlightChange& change) { | 37 void InFlightBoundsChange::SetRevertValueFrom(const InFlightChange& change) { |
| 36 revert_bounds_ = | 38 revert_bounds_ = |
| 37 static_cast<const InFlightBoundsChange&>(change).revert_bounds_; | 39 static_cast<const InFlightBoundsChange&>(change).revert_bounds_; |
| 38 } | 40 } |
| 39 | 41 |
| 40 void InFlightBoundsChange::Revert() { | 42 void InFlightBoundsChange::Revert() { |
| 41 window()->SetBoundsFromServer(revert_bounds_); | 43 window_tree_client_->SetWindowBoundsFromServer(window(), revert_bounds_); |
| 42 } | 44 } |
| 43 | 45 |
| 44 // InFlightDragChange ----------------------------------------------------- | 46 // InFlightDragChange ----------------------------------------------------- |
| 45 | 47 |
| 46 InFlightDragChange::InFlightDragChange(WindowMus* window, ChangeType type) | 48 InFlightDragChange::InFlightDragChange(WindowMus* window, ChangeType type) |
| 47 : InFlightChange(window, type) { | 49 : InFlightChange(window, type) { |
| 48 DCHECK(type == ChangeType::MOVE_LOOP || type == ChangeType::DRAG_LOOP); | 50 DCHECK(type == ChangeType::MOVE_LOOP || type == ChangeType::DRAG_LOOP); |
| 49 } | 51 } |
| 50 | 52 |
| 51 void InFlightDragChange::SetRevertValueFrom(const InFlightChange& change) {} | 53 void InFlightDragChange::SetRevertValueFrom(const InFlightChange& change) {} |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 revert_cursor_ = | 181 revert_cursor_ = |
| 180 static_cast<const InFlightPredefinedCursorChange&>(change).revert_cursor_; | 182 static_cast<const InFlightPredefinedCursorChange&>(change).revert_cursor_; |
| 181 } | 183 } |
| 182 | 184 |
| 183 void InFlightPredefinedCursorChange::Revert() { | 185 void InFlightPredefinedCursorChange::Revert() { |
| 184 window()->SetPredefinedCursorFromServer(revert_cursor_); | 186 window()->SetPredefinedCursorFromServer(revert_cursor_); |
| 185 } | 187 } |
| 186 | 188 |
| 187 // InFlightVisibleChange ------------------------------------------------------- | 189 // InFlightVisibleChange ------------------------------------------------------- |
| 188 | 190 |
| 189 InFlightVisibleChange::InFlightVisibleChange(WindowMus* window, | 191 InFlightVisibleChange::InFlightVisibleChange(WindowTreeClient* client, |
| 192 WindowMus* window, |
| 190 bool revert_value) | 193 bool revert_value) |
| 191 : InFlightChange(window, ChangeType::VISIBLE), | 194 : InFlightChange(window, ChangeType::VISIBLE), |
| 195 window_tree_client_(client), |
| 192 revert_visible_(revert_value) {} | 196 revert_visible_(revert_value) {} |
| 193 | 197 |
| 194 InFlightVisibleChange::~InFlightVisibleChange() {} | 198 InFlightVisibleChange::~InFlightVisibleChange() {} |
| 195 | 199 |
| 196 void InFlightVisibleChange::SetRevertValueFrom(const InFlightChange& change) { | 200 void InFlightVisibleChange::SetRevertValueFrom(const InFlightChange& change) { |
| 197 revert_visible_ = | 201 revert_visible_ = |
| 198 static_cast<const InFlightVisibleChange&>(change).revert_visible_; | 202 static_cast<const InFlightVisibleChange&>(change).revert_visible_; |
| 199 } | 203 } |
| 200 | 204 |
| 201 void InFlightVisibleChange::Revert() { | 205 void InFlightVisibleChange::Revert() { |
| 202 window()->SetVisibleFromServer(revert_visible_); | 206 window_tree_client_->SetWindowVisibleFromServer(window(), revert_visible_); |
| 203 } | 207 } |
| 204 | 208 |
| 205 // InFlightOpacityChange ------------------------------------------------------- | 209 // InFlightOpacityChange ------------------------------------------------------- |
| 206 | 210 |
| 207 InFlightOpacityChange::InFlightOpacityChange(WindowMus* window, | 211 InFlightOpacityChange::InFlightOpacityChange(WindowMus* window, |
| 208 float revert_value) | 212 float revert_value) |
| 209 : InFlightChange(window, ChangeType::OPACITY), | 213 : InFlightChange(window, ChangeType::OPACITY), |
| 210 revert_opacity_(revert_value) {} | 214 revert_opacity_(revert_value) {} |
| 211 | 215 |
| 212 InFlightOpacityChange::~InFlightOpacityChange() {} | 216 InFlightOpacityChange::~InFlightOpacityChange() {} |
| (...skipping 15 matching lines...) Expand all Loading... |
| 228 InFlightSetModalChange::~InFlightSetModalChange() {} | 232 InFlightSetModalChange::~InFlightSetModalChange() {} |
| 229 | 233 |
| 230 void InFlightSetModalChange::SetRevertValueFrom(const InFlightChange& change) {} | 234 void InFlightSetModalChange::SetRevertValueFrom(const InFlightChange& change) {} |
| 231 | 235 |
| 232 void InFlightSetModalChange::Revert() { | 236 void InFlightSetModalChange::Revert() { |
| 233 // TODO: modality is stored in keys in aura. | 237 // TODO: modality is stored in keys in aura. |
| 234 // WindowPrivate(window()).LocalUnsetModal(); | 238 // WindowPrivate(window()).LocalUnsetModal(); |
| 235 } | 239 } |
| 236 | 240 |
| 237 } // namespace aura | 241 } // namespace aura |
| OLD | NEW |