Index: ui/views/mus/native_widget_mus.cc |
diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc |
index 8c882176eaea533f57f34cf8d633eca373f21dc4..a5f81ecb289915218d25d2f46c42a8eda1bf19f1 100644 |
--- a/ui/views/mus/native_widget_mus.cc |
+++ b/ui/views/mus/native_widget_mus.cc |
@@ -7,6 +7,7 @@ |
#include "base/callback.h" |
#include "base/macros.h" |
#include "base/message_loop/message_loop.h" |
+#include "base/run_loop.h" |
#include "base/threading/thread_task_runner_handle.h" |
#include "components/bitmap_uploader/bitmap_uploader.h" |
#include "components/mus/public/cpp/property_type_converters.h" |
@@ -29,6 +30,7 @@ |
#include "ui/base/view_prop.h" |
#include "ui/display/display.h" |
#include "ui/display/screen.h" |
+#include "ui/display/screen.h" |
#include "ui/events/event.h" |
#include "ui/gfx/canvas.h" |
#include "ui/gfx/path.h" |
@@ -328,7 +330,7 @@ SkBitmap AppIconFromDelegate(WidgetDelegate* delegate) { |
return app_icon.GetRepresentation(1.f).sk_bitmap(); |
} |
-// Handles acknowledgement of an input event, either immediately when a nested |
+// Handles acknowledgment of an input event, either immediately when a nested |
// message loop starts, or upon destruction. |
class EventAckHandler : public base::MessageLoop::NestingObserver { |
public: |
@@ -438,6 +440,13 @@ class NativeWidgetMus::MusWindowObserver : public mus::WindowObserver { |
DCHECK_EQ(window, mus_window()); |
window_tree_host()->SetBounds(new_bounds); |
} |
+ void OnWindowBoundsChanged(mus::Window* window, |
+ const gfx::Rect& old_bounds, |
+ const gfx::Rect& new_bounds) override { |
+ Widget* widget = NativeWidgetMus::GetWidgetForWindow(window); |
+ if (widget) |
+ widget->OnNativeWidgetMove(); |
+ } |
void OnWindowFocusChanged(mus::Window* gained_focus, |
mus::Window* lost_focus) override { |
if (gained_focus == mus_window()) |
@@ -804,14 +813,14 @@ void NativeWidgetMus::ViewRemoved(View* view) { |
// used safely in a world where we separate things with mojo. They should be |
// removed; not ported. |
void NativeWidgetMus::SetNativeWindowProperty(const char* name, void* value) { |
- // TODO(beng): push properties to mus::Window. |
- // NOTIMPLEMENTED(); |
+ native_window_properties_[name] = value; |
} |
void* NativeWidgetMus::GetNativeWindowProperty(const char* name) const { |
- // TODO(beng): pull properties to mus::Window. |
- // NOTIMPLEMENTED(); |
- return nullptr; |
+ auto it = native_window_properties_.find(name); |
+ if (it == native_window_properties_.end()) |
+ return nullptr; |
+ return it->second; |
} |
TooltipManager* NativeWidgetMus::GetTooltipManager() const { |
@@ -1166,12 +1175,16 @@ Widget::MoveLoopResult NativeWidgetMus::RunMoveLoop( |
const gfx::Vector2d& drag_offset, |
Widget::MoveLoopSource source, |
Widget::MoveLoopEscapeBehavior escape_behavior) { |
- // NOTIMPLEMENTED(); |
- return Widget::MOVE_LOOP_CANCELED; |
+ ReleaseCapture(); |
+ |
+ gfx::Point cursor_location = |
+ display::Screen::GetScreen()->GetCursorScreenPoint(); |
+ bool success = window_->PerformWindowMove(cursor_location); |
+ return success ? Widget::MOVE_LOOP_SUCCESSFUL : Widget::MOVE_LOOP_CANCELED; |
} |
void NativeWidgetMus::EndMoveLoop() { |
- // NOTIMPLEMENTED(); |
+ window_->CancelWindowMove(); |
} |
void NativeWidgetMus::SetVisibilityChangedAnimationsEnabled(bool value) { |