summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorsadrul <sadrul@chromium.org>2015-11-04 13:27:40 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-04 21:28:28 +0000
commitf3109d77b5ed9346e7bcdfaee868a5a61d6b1e1c (patch)
tree38a5a9f3710767c976f930834fad33e4dc351b65 /ui
parent628cd68d58d7c2b3e54a37f4a19bb9b1f49dde45 (diff)
downloadchromium_src-f3109d77b5ed9346e7bcdfaee868a5a61d6b1e1c.zip
chromium_src-f3109d77b5ed9346e7bcdfaee868a5a61d6b1e1c.tar.gz
chromium_src-f3109d77b5ed9346e7bcdfaee868a5a61d6b1e1c.tar.bz2
mus: Re-wire how a bounds change request works.
. A client can request to change the bounds of a window it doesn't own (e.g. a window created by the window-manager). The client is notified if the change request is rejected. . The window-server routes bounds-change requests from clients through the window-manager for windows created by the WM. . Instead of NativeWidgetMus directly requesting the bounds update on the mus::Window, it goes through WindowTreeHostMus, which sends the request to mus to change the size of the mus::Window. . Instead of WindowTreeHostMus directly changing the bounds of the root-window, it lets the base WindowTreeHost implementation take care of updating the root-window's bounds when necessary (e.g. when the host is resized etc.) BUG=none Review URL: https://codereview.chromium.org/1414333009 Cr-Commit-Position: refs/heads/master@{#357903}
Diffstat (limited to 'ui')
-rw-r--r--ui/views/mus/native_widget_mus.cc5
-rw-r--r--ui/views/mus/window_tree_host_mus.cc16
-rw-r--r--ui/views/mus/window_tree_host_mus.h6
3 files changed, 15 insertions, 12 deletions
diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc
index b035a18..f9b43d3 100644
--- a/ui/views/mus/native_widget_mus.cc
+++ b/ui/views/mus/native_widget_mus.cc
@@ -249,11 +249,12 @@ gfx::Rect NativeWidgetMus::GetRestoredBounds() const {
}
void NativeWidgetMus::SetBounds(const gfx::Rect& bounds) {
- window_->RequestBoundsChange(bounds);
+ window_tree_host_->SetBounds(bounds);
}
void NativeWidgetMus::SetSize(const gfx::Size& size) {
- window_->RequestBoundsChange(gfx::Rect(window_->bounds().size()));
+ gfx::Rect bounds = window_tree_host_->GetBounds();
+ SetBounds(gfx::Rect(bounds.origin(), size));
}
void NativeWidgetMus::StackAbove(gfx::NativeView native_view) {
diff --git a/ui/views/mus/window_tree_host_mus.cc b/ui/views/mus/window_tree_host_mus.cc
index fd7e1f1..f4edd4c 100644
--- a/ui/views/mus/window_tree_host_mus.cc
+++ b/ui/views/mus/window_tree_host_mus.cc
@@ -68,6 +68,14 @@ void WindowTreeHostMus::SetShowState(mus::mojom::ShowState show_state) {
////////////////////////////////////////////////////////////////////////////////
// WindowTreeHostMus, aura::WindowTreeHost implementation:
+gfx::Rect WindowTreeHostMus::GetBounds() const {
+ return mus_window_->bounds();
+}
+
+void WindowTreeHostMus::SetBounds(const gfx::Rect& bounds) {
+ mus_window_->SetBounds(bounds);
+}
+
ui::EventSource* WindowTreeHostMus::GetEventSource() {
return this;
}
@@ -86,14 +94,6 @@ void WindowTreeHostMus::HideImpl() {
window()->Hide();
}
-gfx::Rect WindowTreeHostMus::GetBounds() const {
- return mus_window_->bounds();
-}
-
-void WindowTreeHostMus::SetBounds(const gfx::Rect& bounds) {
- window()->SetBounds(gfx::Rect(bounds.size()));
-}
-
gfx::Point WindowTreeHostMus::GetLocationOnNativeScreen() const {
return gfx::Point(0, 0);
}
diff --git a/ui/views/mus/window_tree_host_mus.h b/ui/views/mus/window_tree_host_mus.h
index 6f4d9ad..258ab95 100644
--- a/ui/views/mus/window_tree_host_mus.h
+++ b/ui/views/mus/window_tree_host_mus.h
@@ -44,14 +44,16 @@ class WindowTreeHostMus : public aura::WindowTreeHost,
return ui::EventSource::SendEventToProcessor(event);
}
+ // WindowTreeHost:
+ gfx::Rect GetBounds() const override;
+ void SetBounds(const gfx::Rect& bounds) override;
+
private:
// WindowTreeHost:
ui::EventSource* GetEventSource() override;
gfx::AcceleratedWidget GetAcceleratedWidget() override;
void ShowImpl() override;
void HideImpl() override;
- gfx::Rect GetBounds() const override;
- void SetBounds(const gfx::Rect& bounds) override;
gfx::Point GetLocationOnNativeScreen() const override;
void SetCapture() override;
void ReleaseCapture() override;