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

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

Issue 2454973003: Wires up modality for aura-mus (Closed)
Patch Set: cleanup 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
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 407a99b7ea7d6ca6639be5adb53263bff5678e63..7dbbf771cfc5fdc8eeee26ef777d16e03518df08 100644
--- a/ui/aura/mus/window_tree_client.cc
+++ b/ui/aura/mus/window_tree_client.cc
@@ -31,6 +31,7 @@
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_tracker.h"
+#include "ui/base/ui_base_types.h"
#include "ui/events/event.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/size.h"
@@ -115,6 +116,10 @@ class EventAckHandler : public base::MessageLoop::NestingObserver {
DISALLOW_COPY_AND_ASSIGN(EventAckHandler);
};
+bool IsInternalProperty(const void* key) {
+ return key == client::kModalKey;
+}
+
} // namespace
struct WindowTreeClient::CurrentDragState {
@@ -498,6 +503,24 @@ void WindowTreeClient::OnConnectionLost() {
delegate_->OnLostConnection(this);
}
+bool WindowTreeClient::HandleInternalPropertyChanged(WindowMus* window,
+ const void* key) {
+ if (key != client::kModalKey)
msw 2016/10/27 18:37:37 q: check !IsInternalProperty(key) for extensibilit
sky 2016/10/27 19:30:06 Ya, I figured once we have more than one property
+ return false;
+
+ if (window->GetWindow()->GetProperty(client::kModalKey) ==
+ ui::MODAL_TYPE_NONE) {
+ return true;
msw 2016/10/27 18:37:37 Should this be clearing modality if the window was
sky 2016/10/27 19:30:06 Yes, but again because the mojom API is basically
+ }
+
+ const uint32_t change_id =
+ ScheduleInFlightChange(base::MakeUnique<InFlightSetModalChange>(window));
+ // TODO: this is subtly different that explicitly specifying a type.
+ // http://crbug.com/660073.
+ tree_->SetModal(change_id, window->server_id());
+ return true;
+}
+
void WindowTreeClient::OnEmbedImpl(ui::mojom::WindowTree* window_tree,
ClientSpecificId client_id,
ui::mojom::WindowDataPtr root_data,
@@ -704,6 +727,9 @@ void WindowTreeClient::OnWindowMusSetVisible(WindowMus* window, bool visible) {
std::unique_ptr<WindowPortPropertyData>
WindowTreeClient::OnWindowMusWillChangeProperty(WindowMus* window,
const void* key) {
+ if (IsInternalProperty(key))
+ return nullptr;
+
std::unique_ptr<WindowPortPropertyDataMus> data(
base::MakeUnique<WindowPortPropertyDataMus>());
if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport(
@@ -718,8 +744,12 @@ void WindowTreeClient::OnWindowMusPropertyChanged(
WindowMus* window,
const void* key,
std::unique_ptr<WindowPortPropertyData> data) {
+ if (HandleInternalPropertyChanged(window, key))
msw 2016/10/27 18:37:37 optional nit: combine with the !data early return
sky 2016/10/27 19:30:06 Done.
+ return;
+
if (!data)
return;
+
WindowPortPropertyDataMus* data_mus =
static_cast<WindowPortPropertyDataMus*>(data.get());

Powered by Google App Engine
This is Rietveld 408576698