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

Side by Side Diff: ui/aura/mus/window_tree_client.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_client.h ('k') | ui/aura/mus/window_tree_host_mus.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/aura/mus/window_tree_client.h" 5 #include "ui/aura/mus/window_tree_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 has_pointer_watcher_ = true; 802 has_pointer_watcher_ = true;
803 tree_->StartPointerWatcher(want_moves); 803 tree_->StartPointerWatcher(want_moves);
804 } 804 }
805 805
806 void WindowTreeClient::StopPointerWatcher() { 806 void WindowTreeClient::StopPointerWatcher() {
807 DCHECK(has_pointer_watcher_); 807 DCHECK(has_pointer_watcher_);
808 tree_->StopPointerWatcher(); 808 tree_->StopPointerWatcher();
809 has_pointer_watcher_ = false; 809 has_pointer_watcher_ = false;
810 } 810 }
811 811
812 void WindowTreeClient::PerformWindowMove(
813 Window* window,
814 ui::mojom::MoveLoopSource source,
815 const gfx::Point& cursor_location,
816 const base::Callback<void(bool)>& callback) {
817 DCHECK(on_current_move_finished_.is_null());
818 on_current_move_finished_ = callback;
819
820 WindowMus* window_mus = WindowMus::Get(window);
821 current_move_loop_change_ = ScheduleInFlightChange(
822 base::MakeUnique<InFlightDragChange>(window_mus, ChangeType::MOVE_LOOP));
823 // Tell the window manager to take over moving us.
824 tree_->PerformWindowMove(current_move_loop_change_, window_mus->server_id(),
825 source, cursor_location);
826 }
827
828 void WindowTreeClient::CancelWindowMove(Window* window) {
829 tree_->CancelWindowMove(WindowMus::Get(window)->server_id());
830 }
831
832 void WindowTreeClient::AddObserver(WindowTreeClientObserver* observer) { 812 void WindowTreeClient::AddObserver(WindowTreeClientObserver* observer) {
833 observers_.AddObserver(observer); 813 observers_.AddObserver(observer);
834 } 814 }
835 815
836 void WindowTreeClient::RemoveObserver(WindowTreeClientObserver* observer) { 816 void WindowTreeClient::RemoveObserver(WindowTreeClientObserver* observer) {
837 observers_.RemoveObserver(observer); 817 observers_.RemoveObserver(observer);
838 } 818 }
839 819
840 void WindowTreeClient::AddTestObserver(WindowTreeClientTestObserver* observer) { 820 void WindowTreeClient::AddTestObserver(WindowTreeClientTestObserver* observer) {
841 test_observers_.AddObserver(observer); 821 test_observers_.AddObserver(observer);
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 } 1683 }
1704 1684
1705 void WindowTreeClient::OnWindowTreeHostStackAtTop( 1685 void WindowTreeClient::OnWindowTreeHostStackAtTop(
1706 WindowTreeHostMus* window_tree_host) { 1686 WindowTreeHostMus* window_tree_host) {
1707 WindowMus* window = WindowMus::Get(window_tree_host->window()); 1687 WindowMus* window = WindowMus::Get(window_tree_host->window());
1708 const uint32_t change_id = ScheduleInFlightChange( 1688 const uint32_t change_id = ScheduleInFlightChange(
1709 base::MakeUnique<CrashInFlightChange>(window, ChangeType::REORDER)); 1689 base::MakeUnique<CrashInFlightChange>(window, ChangeType::REORDER));
1710 tree_->StackAtTop(change_id, window->server_id()); 1690 tree_->StackAtTop(change_id, window->server_id());
1711 } 1691 }
1712 1692
1693 void WindowTreeClient::OnWindowTreeHostPerformWindowMove(
1694 WindowTreeHostMus* window_tree_host,
1695 ui::mojom::MoveLoopSource source,
1696 const gfx::Point& cursor_location,
1697 const base::Callback<void(bool)>& callback) {
1698 DCHECK(on_current_move_finished_.is_null());
1699 on_current_move_finished_ = callback;
1700
1701 WindowMus* window_mus = WindowMus::Get(window_tree_host->window());
1702 current_move_loop_change_ = ScheduleInFlightChange(
1703 base::MakeUnique<InFlightDragChange>(window_mus, ChangeType::MOVE_LOOP));
1704 // Tell the window manager to take over moving us.
1705 tree_->PerformWindowMove(current_move_loop_change_, window_mus->server_id(),
1706 source, cursor_location);
1707 }
1708
1709 void WindowTreeClient::OnWindowTreeHostCancelWindowMove(
1710 WindowTreeHostMus* window_tree_host) {
1711 tree_->CancelWindowMove(
1712 WindowMus::Get(window_tree_host->window())->server_id());
1713 }
1714
1713 std::unique_ptr<WindowPortMus> WindowTreeClient::CreateWindowPortForTopLevel( 1715 std::unique_ptr<WindowPortMus> WindowTreeClient::CreateWindowPortForTopLevel(
1714 const std::map<std::string, std::vector<uint8_t>>* properties) { 1716 const std::map<std::string, std::vector<uint8_t>>* properties) {
1715 std::unique_ptr<WindowPortMus> window_port = 1717 std::unique_ptr<WindowPortMus> window_port =
1716 base::MakeUnique<WindowPortMus>(this, WindowMusType::TOP_LEVEL); 1718 base::MakeUnique<WindowPortMus>(this, WindowMusType::TOP_LEVEL);
1717 roots_.insert(window_port.get()); 1719 roots_.insert(window_port.get());
1718 1720
1719 window_port->set_server_id(MakeTransportId(client_id_, next_window_id_++)); 1721 window_port->set_server_id(MakeTransportId(client_id_, next_window_id_++));
1720 RegisterWindowMus(window_port.get()); 1722 RegisterWindowMus(window_port.get());
1721 1723
1722 std::unordered_map<std::string, std::vector<uint8_t>> transport_properties; 1724 std::unordered_map<std::string, std::vector<uint8_t>> transport_properties;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1819 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1818 this, capture_synchronizer_.get(), window)); 1820 this, capture_synchronizer_.get(), window));
1819 } 1821 }
1820 1822
1821 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1823 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1822 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1824 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1823 this, focus_synchronizer_.get(), window)); 1825 this, focus_synchronizer_.get(), window));
1824 } 1826 }
1825 1827
1826 } // namespace aura 1828 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | ui/aura/mus/window_tree_host_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698