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

Side by Side Diff: ui/views/mus/desktop_window_tree_host_mus.cc

Issue 2657003004: aura-mus: Hook up PerformWindowMove(). (Closed)
Patch Set: Fold PerformWindowMove and CancelWindowMove. Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/aura/mus/window_tree_host_mus_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/mus/desktop_window_tree_host_mus.h" 5 #include "ui/views/mus/desktop_window_tree_host_mus.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h"
8 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
9 #include "ui/aura/client/aura_constants.h" 11 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/cursor_client.h" 12 #include "ui/aura/client/cursor_client.h"
11 #include "ui/aura/client/drag_drop_client.h" 13 #include "ui/aura/client/drag_drop_client.h"
12 #include "ui/aura/client/focus_client.h" 14 #include "ui/aura/client/focus_client.h"
13 #include "ui/aura/client/transient_window_client.h" 15 #include "ui/aura/client/transient_window_client.h"
14 #include "ui/aura/env.h" 16 #include "ui/aura/env.h"
15 #include "ui/aura/mus/window_port_mus.h" 17 #include "ui/aura/mus/window_port_mus.h"
16 #include "ui/aura/mus/window_tree_host_mus.h" 18 #include "ui/aura/mus/window_tree_host_mus.h"
17 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // definitely in a different mojo service. Each app is fairly locked down. 163 // definitely in a different mojo service. Each app is fairly locked down.
162 delegate->CommitMouseEventsEnabled(enabled); 164 delegate->CommitMouseEventsEnabled(enabled);
163 NOTIMPLEMENTED(); 165 NOTIMPLEMENTED();
164 } 166 }
165 167
166 private: 168 private:
167 aura::Window* window_; 169 aura::Window* window_;
168 170
169 DISALLOW_COPY_AND_ASSIGN(NativeCursorManagerMus); 171 DISALLOW_COPY_AND_ASSIGN(NativeCursorManagerMus);
170 }; 172 };
173
174 void OnMoveLoopEnd(bool* out_success,
175 base::Closure quit_closure,
176 bool in_success) {
177 *out_success = in_success;
178 quit_closure.Run();
179 }
180
171 } // namespace 181 } // namespace
172 182
173 DesktopWindowTreeHostMus::DesktopWindowTreeHostMus( 183 DesktopWindowTreeHostMus::DesktopWindowTreeHostMus(
174 internal::NativeWidgetDelegate* native_widget_delegate, 184 internal::NativeWidgetDelegate* native_widget_delegate,
175 DesktopNativeWidgetAura* desktop_native_widget_aura, 185 DesktopNativeWidgetAura* desktop_native_widget_aura,
176 const std::map<std::string, std::vector<uint8_t>>* mus_properties) 186 const std::map<std::string, std::vector<uint8_t>>* mus_properties)
177 : aura::WindowTreeHostMus(MusClient::Get()->window_tree_client(), 187 : aura::WindowTreeHostMus(MusClient::Get()->window_tree_client(),
178 mus_properties), 188 mus_properties),
179 native_widget_delegate_(native_widget_delegate), 189 native_widget_delegate_(native_widget_delegate),
180 desktop_native_widget_aura_(desktop_native_widget_aura), 190 desktop_native_widget_aura_(desktop_native_widget_aura),
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 void DesktopWindowTreeHostMus::ClearNativeFocus() { 586 void DesktopWindowTreeHostMus::ClearNativeFocus() {
577 aura::client::FocusClient* client = aura::client::GetFocusClient(window()); 587 aura::client::FocusClient* client = aura::client::GetFocusClient(window());
578 if (client && window()->Contains(client->GetFocusedWindow())) 588 if (client && window()->Contains(client->GetFocusedWindow()))
579 client->ResetFocusWithinActiveWindow(window()); 589 client->ResetFocusWithinActiveWindow(window());
580 } 590 }
581 591
582 Widget::MoveLoopResult DesktopWindowTreeHostMus::RunMoveLoop( 592 Widget::MoveLoopResult DesktopWindowTreeHostMus::RunMoveLoop(
583 const gfx::Vector2d& drag_offset, 593 const gfx::Vector2d& drag_offset,
584 Widget::MoveLoopSource source, 594 Widget::MoveLoopSource source,
585 Widget::MoveLoopEscapeBehavior escape_behavior) { 595 Widget::MoveLoopEscapeBehavior escape_behavior) {
586 NOTIMPLEMENTED(); 596 static_cast<internal::NativeWidgetPrivate*>(
587 return Widget::MOVE_LOOP_CANCELED; 597 desktop_native_widget_aura_)->ReleaseCapture();
598
599 base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
600 base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
601 base::RunLoop run_loop;
602
603 ui::mojom::MoveLoopSource mus_source =
604 source == Widget::MOVE_LOOP_SOURCE_MOUSE
605 ? ui::mojom::MoveLoopSource::MOUSE
606 : ui::mojom::MoveLoopSource::TOUCH;
607
608 bool success = false;
609 gfx::Point cursor_location =
610 display::Screen::GetScreen()->GetCursorScreenPoint();
611 WindowTreeHostMus::PerformWindowMove(
612 mus_source, cursor_location,
613 base::Bind(OnMoveLoopEnd, &success, run_loop.QuitClosure()));
614
615 run_loop.Run();
616
617 return success ? Widget::MOVE_LOOP_SUCCESSFUL : Widget::MOVE_LOOP_CANCELED;
588 } 618 }
589 619
590 void DesktopWindowTreeHostMus::EndMoveLoop() { 620 void DesktopWindowTreeHostMus::EndMoveLoop() {
591 NOTIMPLEMENTED(); 621 WindowTreeHostMus::CancelWindowMove();
592 } 622 }
593 623
594 void DesktopWindowTreeHostMus::SetVisibilityChangedAnimationsEnabled( 624 void DesktopWindowTreeHostMus::SetVisibilityChangedAnimationsEnabled(
595 bool value) { 625 bool value) {
596 window()->SetProperty(aura::client::kAnimationsDisabledKey, !value); 626 window()->SetProperty(aura::client::kAnimationsDisabledKey, !value);
597 } 627 }
598 628
599 NonClientFrameView* DesktopWindowTreeHostMus::CreateNonClientFrameView() { 629 NonClientFrameView* DesktopWindowTreeHostMus::CreateNonClientFrameView() {
600 if (!ShouldSendClientAreaToServer()) 630 if (!ShouldSendClientAreaToServer())
601 return nullptr; 631 return nullptr;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 aura::client::FocusClient* focus_client, 762 aura::client::FocusClient* focus_client,
733 aura::Window* window) { 763 aura::Window* window) {
734 if (window == this->window()) { 764 if (window == this->window()) {
735 desktop_native_widget_aura_->HandleActivationChanged(true); 765 desktop_native_widget_aura_->HandleActivationChanged(true);
736 } else if (is_active_) { 766 } else if (is_active_) {
737 desktop_native_widget_aura_->HandleActivationChanged(false); 767 desktop_native_widget_aura_->HandleActivationChanged(false);
738 } 768 }
739 } 769 }
740 770
741 } // namespace views 771 } // namespace views
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_host_mus_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698