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

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

Issue 2445163002: Make aura work with mus (Closed)
Patch Set: NON_EXPORTED_BASE_CLASS Created 4 years, 2 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
« no previous file with comments | « ui/aura/mus/in_flight_change.h ('k') | ui/aura/mus/input_method_mus.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/in_flight_change.cc
diff --git a/services/ui/public/cpp/in_flight_change.cc b/ui/aura/mus/in_flight_change.cc
similarity index 67%
copy from services/ui/public/cpp/in_flight_change.cc
copy to ui/aura/mus/in_flight_change.cc
index 1eef7487789daaa3a4d6d5dbef03158140e05de4..aa70fb0413afa783b66bb27ae6ce16f84ef4d65c 100644
--- a/services/ui/public/cpp/in_flight_change.cc
+++ b/ui/aura/mus/in_flight_change.cc
@@ -2,16 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "services/ui/public/cpp/in_flight_change.h"
+#include "ui/aura/mus/in_flight_change.h"
-#include "services/ui/public/cpp/window_private.h"
-#include "services/ui/public/cpp/window_tree_client.h"
+#include "ui/aura/mus/window_mus.h"
+#include "ui/aura/mus/window_port_mus.h"
+#include "ui/aura/mus/window_tree_client.h"
+#include "ui/aura/window.h"
-namespace ui {
+namespace aura {
// InFlightChange -------------------------------------------------------------
-InFlightChange::InFlightChange(Window* window, ChangeType type)
+InFlightChange::InFlightChange(WindowMus* window, ChangeType type)
: window_(window), change_type_(type) {}
InFlightChange::~InFlightChange() {}
@@ -25,7 +27,7 @@ void InFlightChange::ChangeFailed() {}
// InFlightBoundsChange -------------------------------------------------------
-InFlightBoundsChange::InFlightBoundsChange(Window* window,
+InFlightBoundsChange::InFlightBoundsChange(WindowMus* window,
const gfx::Rect& revert_bounds)
: InFlightChange(window, ChangeType::BOUNDS),
revert_bounds_(revert_bounds) {}
@@ -36,12 +38,12 @@ void InFlightBoundsChange::SetRevertValueFrom(const InFlightChange& change) {
}
void InFlightBoundsChange::Revert() {
- WindowPrivate(window()).LocalSetBounds(window()->bounds(), revert_bounds_);
+ window()->SetBoundsFromServer(revert_bounds_);
}
// InFlightDragChange -----------------------------------------------------
-InFlightDragChange::InFlightDragChange(Window* window, ChangeType type)
+InFlightDragChange::InFlightDragChange(WindowMus* window, ChangeType type)
: InFlightChange(window, type) {
DCHECK(type == ChangeType::MOVE_LOOP || type == ChangeType::DRAG_LOOP);
}
@@ -52,7 +54,7 @@ void InFlightDragChange::Revert() {}
// CrashInFlightChange --------------------------------------------------------
-CrashInFlightChange::CrashInFlightChange(Window* window, ChangeType type)
+CrashInFlightChange::CrashInFlightChange(WindowMus* window, ChangeType type)
: InFlightChange(window, type) {}
CrashInFlightChange::~CrashInFlightChange() {}
@@ -74,11 +76,9 @@ void CrashInFlightChange::Revert() {
InFlightWindowTreeClientChange::InFlightWindowTreeClientChange(
WindowTreeClient* client,
- Window* revert_value,
+ WindowMus* revert_value,
ChangeType type)
- : InFlightChange(nullptr, type),
- client_(client),
- revert_window_(nullptr) {
+ : InFlightChange(nullptr, type), client_(client), revert_window_(nullptr) {
SetRevertWindow(revert_value);
}
@@ -92,22 +92,24 @@ void InFlightWindowTreeClientChange::SetRevertValueFrom(
.revert_window_);
}
-void InFlightWindowTreeClientChange::SetRevertWindow(Window* window) {
+void InFlightWindowTreeClientChange::SetRevertWindow(WindowMus* window) {
if (revert_window_)
- revert_window_->RemoveObserver(this);
+ revert_window_->GetWindow()->RemoveObserver(this);
revert_window_ = window;
if (revert_window_)
- revert_window_->AddObserver(this);
+ revert_window_->GetWindow()->AddObserver(this);
}
-void InFlightWindowTreeClientChange::OnWindowDestroying(Window* window) {
+void InFlightWindowTreeClientChange::OnWindowDestroyed(Window* window) {
+ // NOTE: this has to be in OnWindowDestroyed() as FocusClients typically
+ // change focus in OnWindowDestroying().
SetRevertWindow(nullptr);
}
// InFlightCaptureChange ------------------------------------------------------
-InFlightCaptureChange::InFlightCaptureChange(
- WindowTreeClient* client, Window* revert_value)
+InFlightCaptureChange::InFlightCaptureChange(WindowTreeClient* client,
+ WindowMus* revert_value)
: InFlightWindowTreeClientChange(client,
revert_value,
ChangeType::CAPTURE) {}
@@ -115,33 +117,30 @@ InFlightCaptureChange::InFlightCaptureChange(
InFlightCaptureChange::~InFlightCaptureChange() {}
void InFlightCaptureChange::Revert() {
- client()->LocalSetCapture(revert_window());
+ client()->SetCaptureFromServer(revert_window());
}
// InFlightFocusChange --------------------------------------------------------
-InFlightFocusChange::InFlightFocusChange(
- WindowTreeClient* client,
- Window* revert_value)
- : InFlightWindowTreeClientChange(client,
- revert_value,
- ChangeType::FOCUS) {}
+InFlightFocusChange::InFlightFocusChange(WindowTreeClient* client,
+ WindowMus* revert_value)
+ : InFlightWindowTreeClientChange(client, revert_value, ChangeType::FOCUS) {}
InFlightFocusChange::~InFlightFocusChange() {}
void InFlightFocusChange::Revert() {
- client()->LocalSetFocus(revert_window());
+ client()->SetFocusFromServer(revert_window());
}
// InFlightPropertyChange -----------------------------------------------------
InFlightPropertyChange::InFlightPropertyChange(
- Window* window,
+ WindowMus* window,
const std::string& property_name,
- const mojo::Array<uint8_t>& revert_value)
+ std::unique_ptr<std::vector<uint8_t>> revert_value)
: InFlightChange(window, ChangeType::PROPERTY),
property_name_(property_name),
- revert_value_(revert_value.Clone()) {}
+ revert_value_(std::move(revert_value)) {}
InFlightPropertyChange::~InFlightPropertyChange() {}
@@ -151,20 +150,25 @@ bool InFlightPropertyChange::Matches(const InFlightChange& change) const {
}
void InFlightPropertyChange::SetRevertValueFrom(const InFlightChange& change) {
- revert_value_ =
- static_cast<const InFlightPropertyChange&>(change).revert_value_.Clone();
+ const InFlightPropertyChange& property_change =
+ static_cast<const InFlightPropertyChange&>(change);
+ if (property_change.revert_value_) {
+ revert_value_ =
+ base::MakeUnique<std::vector<uint8_t>>(*property_change.revert_value_);
+ } else {
+ revert_value_.reset();
+ }
}
void InFlightPropertyChange::Revert() {
- WindowPrivate(window())
- .LocalSetSharedProperty(property_name_, std::move(revert_value_));
+ window()->SetPropertyFromServer(property_name_, revert_value_.get());
}
// InFlightPredefinedCursorChange ---------------------------------------------
InFlightPredefinedCursorChange::InFlightPredefinedCursorChange(
- Window* window,
- mojom::Cursor revert_value)
+ WindowMus* window,
+ ui::mojom::Cursor revert_value)
: InFlightChange(window, ChangeType::PREDEFINED_CURSOR),
revert_cursor_(revert_value) {}
@@ -177,12 +181,12 @@ void InFlightPredefinedCursorChange::SetRevertValueFrom(
}
void InFlightPredefinedCursorChange::Revert() {
- WindowPrivate(window()).LocalSetPredefinedCursor(revert_cursor_);
+ window()->SetPredefinedCursorFromServer(revert_cursor_);
}
// InFlightVisibleChange -------------------------------------------------------
-InFlightVisibleChange::InFlightVisibleChange(Window* window,
+InFlightVisibleChange::InFlightVisibleChange(WindowMus* window,
bool revert_value)
: InFlightChange(window, ChangeType::VISIBLE),
revert_visible_(revert_value) {}
@@ -195,12 +199,13 @@ void InFlightVisibleChange::SetRevertValueFrom(const InFlightChange& change) {
}
void InFlightVisibleChange::Revert() {
- WindowPrivate(window()).LocalSetVisible(revert_visible_);
+ window()->SetVisibleFromServer(revert_visible_);
}
// InFlightOpacityChange -------------------------------------------------------
-InFlightOpacityChange::InFlightOpacityChange(Window* window, float revert_value)
+InFlightOpacityChange::InFlightOpacityChange(WindowMus* window,
+ float revert_value)
: InFlightChange(window, ChangeType::OPACITY),
revert_opacity_(revert_value) {}
@@ -212,12 +217,12 @@ void InFlightOpacityChange::SetRevertValueFrom(const InFlightChange& change) {
}
void InFlightOpacityChange::Revert() {
- WindowPrivate(window()).LocalSetOpacity(revert_opacity_);
+ window()->SetOpacityFromServer(revert_opacity_);
}
// InFlightSetModalChange ------------------------------------------------------
-InFlightSetModalChange::InFlightSetModalChange(Window* window)
+InFlightSetModalChange::InFlightSetModalChange(WindowMus* window)
: InFlightChange(window, ChangeType::SET_MODAL) {}
InFlightSetModalChange::~InFlightSetModalChange() {}
@@ -225,7 +230,8 @@ InFlightSetModalChange::~InFlightSetModalChange() {}
void InFlightSetModalChange::SetRevertValueFrom(const InFlightChange& change) {}
void InFlightSetModalChange::Revert() {
- WindowPrivate(window()).LocalUnsetModal();
+ // TODO: modality is stored in keys in aura.
+ // WindowPrivate(window()).LocalUnsetModal();
}
-} // namespace ui
+} // namespace aura
« no previous file with comments | « ui/aura/mus/in_flight_change.h ('k') | ui/aura/mus/input_method_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698