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

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

Issue 2456843004: Wires up transient windows for aura-mus (Closed)
Patch Set: relative to master 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/window_tree_client.h ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/window_tree_client.cc
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc
index ea33166e55c4aedb7b4ec08431de0b135dc889a7..82bfea417c6ab07b07536e7b5aebb7ed9e07f261 100644
--- a/ui/aura/mus/window_tree_client.cc
+++ b/ui/aura/mus/window_tree_client.cc
@@ -18,6 +18,7 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/capture_client.h"
#include "ui/aura/client/focus_client.h"
+#include "ui/aura/client/transient_window_client.h"
#include "ui/aura/mus/in_flight_change.h"
#include "ui/aura/mus/input_method_mus.h"
#include "ui/aura/mus/property_converter.h"
@@ -161,6 +162,7 @@ WindowTreeClient::WindowTreeClient(
binding_.Bind(std::move(request));
delegate_->GetFocusClient()->AddObserver(this);
delegate_->GetCaptureClient()->AddObserver(this);
+ client::GetTransientWindowClient()->AddObserver(this);
if (window_manager_delegate)
window_manager_delegate->SetWindowManagerClient(this);
}
@@ -194,8 +196,9 @@ WindowTreeClient::~WindowTreeClient() {
for (WindowTreeClientObserver& observer : observers_)
observer.OnDidDestroyClient(this);
- delegate_->GetFocusClient()->RemoveObserver(this);
+ client::GetTransientWindowClient()->RemoveObserver(this);
delegate_->GetCaptureClient()->RemoveObserver(this);
+ delegate_->GetFocusClient()->RemoveObserver(this);
}
void WindowTreeClient::ConnectViaWindowTreeFactory(
@@ -1120,28 +1123,22 @@ void WindowTreeClient::OnClientAreaChanged(
void WindowTreeClient::OnTransientWindowAdded(uint32_t window_id,
uint32_t transient_window_id) {
- // TODO: needs to route to StackingClient.
- /*
- Window* window = GetWindowByServerId(window_id);
- Window* transient_window = GetWindowByServerId(transient_window_id);
+ WindowMus* window = GetWindowByServerId(window_id);
+ WindowMus* transient_window = GetWindowByServerId(transient_window_id);
// window or transient_window or both may be null if a local delete occurs
// with an in flight add from the server.
if (window && transient_window)
- WindowPrivate(window).LocalAddTransientWindow(transient_window);
- */
+ window->AddTransientChildFromServer(transient_window);
}
void WindowTreeClient::OnTransientWindowRemoved(uint32_t window_id,
uint32_t transient_window_id) {
- // TODO: needs to route to StackingClient.
- /*
- Window* window = GetWindowByServerId(window_id);
- Window* transient_window = GetWindowByServerId(transient_window_id);
+ WindowMus* window = GetWindowByServerId(window_id);
+ WindowMus* transient_window = GetWindowByServerId(transient_window_id);
// window or transient_window or both may be null if a local delete occurs
// with an in flight delete from the server.
if (window && transient_window)
- WindowPrivate(window).LocalRemoveTransientWindow(transient_window);
- */
+ window->RemoveTransientChildFromServer(transient_window);
}
void WindowTreeClient::OnWindowHierarchyChanged(
@@ -1765,4 +1762,35 @@ void WindowTreeClient::SetRootWindowBounds(Window* window, gfx::Rect* bounds) {
bounds->set_origin(gfx::Point());
}
+void WindowTreeClient::OnTransientChildWindowAdded(Window* parent,
+ Window* transient_child) {
+ if (WindowMus::Get(parent)->OnTransientChildAdded(
+ WindowMus::Get(transient_child)) == WindowMus::ChangeSource::SERVER) {
+ return;
+ }
+ // The change originated from client code and needs to be sent to the server.
+ DCHECK(tree_);
+ WindowMus* parent_mus = WindowMus::Get(parent);
+ const uint32_t change_id =
+ ScheduleInFlightChange(base::MakeUnique<CrashInFlightChange>(
+ parent_mus, ChangeType::ADD_TRANSIENT_WINDOW));
+ tree_->AddTransientWindow(change_id, parent_mus->server_id(),
+ WindowMus::Get(transient_child)->server_id());
+}
+
+void WindowTreeClient::OnTransientChildWindowRemoved(Window* parent,
+ Window* transient_child) {
+ if (WindowMus::Get(parent)->OnTransientChildRemoved(
+ WindowMus::Get(transient_child)) == WindowMus::ChangeSource::SERVER) {
+ return;
+ }
+ // The change originated from client code and needs to be sent to the server.
+ DCHECK(tree_);
+ WindowMus* child_mus = WindowMus::Get(transient_child);
+ const uint32_t change_id =
+ ScheduleInFlightChange(base::MakeUnique<CrashInFlightChange>(
+ child_mus, ChangeType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT));
+ tree_->RemoveTransientWindowFromParent(change_id, child_mus->server_id());
+}
+
} // namespace aura
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698