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

Side by Side Diff: ui/aura/mus/window_tree_client.cc

Issue 2633233003: aura-mus: Implement stacking in DesktopWindowTreeHostMus. (Closed)
Patch Set: Reword comment. Created 3 years, 11 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_client_test_observer.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 20 matching lines...) Expand all
31 #include "ui/aura/mus/in_flight_change.h" 31 #include "ui/aura/mus/in_flight_change.h"
32 #include "ui/aura/mus/input_method_mus.h" 32 #include "ui/aura/mus/input_method_mus.h"
33 #include "ui/aura/mus/mus_context_factory.h" 33 #include "ui/aura/mus/mus_context_factory.h"
34 #include "ui/aura/mus/property_converter.h" 34 #include "ui/aura/mus/property_converter.h"
35 #include "ui/aura/mus/property_utils.h" 35 #include "ui/aura/mus/property_utils.h"
36 #include "ui/aura/mus/window_manager_delegate.h" 36 #include "ui/aura/mus/window_manager_delegate.h"
37 #include "ui/aura/mus/window_mus.h" 37 #include "ui/aura/mus/window_mus.h"
38 #include "ui/aura/mus/window_port_mus.h" 38 #include "ui/aura/mus/window_port_mus.h"
39 #include "ui/aura/mus/window_tree_client_delegate.h" 39 #include "ui/aura/mus/window_tree_client_delegate.h"
40 #include "ui/aura/mus/window_tree_client_observer.h" 40 #include "ui/aura/mus/window_tree_client_observer.h"
41 #include "ui/aura/mus/window_tree_client_test_observer.h"
41 #include "ui/aura/mus/window_tree_host_mus.h" 42 #include "ui/aura/mus/window_tree_host_mus.h"
42 #include "ui/aura/window.h" 43 #include "ui/aura/window.h"
43 #include "ui/aura/window_delegate.h" 44 #include "ui/aura/window_delegate.h"
44 #include "ui/aura/window_tracker.h" 45 #include "ui/aura/window_tracker.h"
45 #include "ui/base/ui_base_types.h" 46 #include "ui/base/ui_base_types.h"
46 #include "ui/display/display.h" 47 #include "ui/display/display.h"
47 #include "ui/display/screen.h" 48 #include "ui/display/screen.h"
48 #include "ui/events/event.h" 49 #include "ui/events/event.h"
49 #include "ui/gfx/geometry/dip_util.h" 50 #include "ui/gfx/geometry/dip_util.h"
50 #include "ui/gfx/geometry/insets.h" 51 #include "ui/gfx/geometry/insets.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 return pair.second.get(); 321 return pair.second.get();
321 } 322 }
322 } 323 }
323 return nullptr; 324 return nullptr;
324 } 325 }
325 326
326 uint32_t WindowTreeClient::ScheduleInFlightChange( 327 uint32_t WindowTreeClient::ScheduleInFlightChange(
327 std::unique_ptr<InFlightChange> change) { 328 std::unique_ptr<InFlightChange> change) {
328 DCHECK(!change->window() || 329 DCHECK(!change->window() ||
329 windows_.count(change->window()->server_id()) > 0); 330 windows_.count(change->window()->server_id()) > 0);
331 ChangeType t = change->change_type();
330 const uint32_t change_id = next_change_id_++; 332 const uint32_t change_id = next_change_id_++;
331 in_flight_map_[change_id] = std::move(change); 333 in_flight_map_[change_id] = std::move(change);
334 for (auto& observer : test_observers_)
335 observer.OnChangeStarted(change_id, t);
332 return change_id; 336 return change_id;
333 } 337 }
334 338
335 bool WindowTreeClient::ApplyServerChangeToExistingInFlightChange( 339 bool WindowTreeClient::ApplyServerChangeToExistingInFlightChange(
336 const InFlightChange& change) { 340 const InFlightChange& change) {
337 InFlightChange* existing_change = GetOldestInFlightChangeMatching(change); 341 InFlightChange* existing_change = GetOldestInFlightChangeMatching(change);
338 if (!existing_change) 342 if (!existing_change)
339 return false; 343 return false;
340 344
341 existing_change->SetRevertValueFrom(change); 345 existing_change->SetRevertValueFrom(change);
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 } 830 }
827 831
828 void WindowTreeClient::AddObserver(WindowTreeClientObserver* observer) { 832 void WindowTreeClient::AddObserver(WindowTreeClientObserver* observer) {
829 observers_.AddObserver(observer); 833 observers_.AddObserver(observer);
830 } 834 }
831 835
832 void WindowTreeClient::RemoveObserver(WindowTreeClientObserver* observer) { 836 void WindowTreeClient::RemoveObserver(WindowTreeClientObserver* observer) {
833 observers_.RemoveObserver(observer); 837 observers_.RemoveObserver(observer);
834 } 838 }
835 839
840 void WindowTreeClient::AddTestObserver(WindowTreeClientTestObserver* observer) {
841 test_observers_.AddObserver(observer);
842 }
843
844 void WindowTreeClient::RemoveTestObserver(
845 WindowTreeClientTestObserver* observer) {
846 test_observers_.RemoveObserver(observer);
847 }
848
836 void WindowTreeClient::SetCanAcceptDrops(Id window_id, bool can_accept_drops) { 849 void WindowTreeClient::SetCanAcceptDrops(Id window_id, bool can_accept_drops) {
837 DCHECK(tree_); 850 DCHECK(tree_);
838 tree_->SetCanAcceptDrops(window_id, can_accept_drops); 851 tree_->SetCanAcceptDrops(window_id, can_accept_drops);
839 } 852 }
840 853
841 void WindowTreeClient::SetCanAcceptEvents(Id window_id, 854 void WindowTreeClient::SetCanAcceptEvents(Id window_id,
842 bool can_accept_events) { 855 bool can_accept_events) {
843 DCHECK(tree_); 856 DCHECK(tree_);
844 tree_->SetCanAcceptEvents(window_id, can_accept_events); 857 tree_->SetCanAcceptEvents(window_id, can_accept_events);
845 } 858 }
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 drag_drop_controller_->OnPerformDragDropCompleted(action_taken); 1299 drag_drop_controller_->OnPerformDragDropCompleted(action_taken);
1287 } 1300 }
1288 } 1301 }
1289 1302
1290 void WindowTreeClient::OnChangeCompleted(uint32_t change_id, bool success) { 1303 void WindowTreeClient::OnChangeCompleted(uint32_t change_id, bool success) {
1291 std::unique_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); 1304 std::unique_ptr<InFlightChange> change(std::move(in_flight_map_[change_id]));
1292 in_flight_map_.erase(change_id); 1305 in_flight_map_.erase(change_id);
1293 if (!change) 1306 if (!change)
1294 return; 1307 return;
1295 1308
1309 for (auto& observer : test_observers_)
1310 observer.OnChangeCompleted(change_id, change->change_type(), success);
1311
1296 if (!success) 1312 if (!success)
1297 change->ChangeFailed(); 1313 change->ChangeFailed();
1298 1314
1299 InFlightChange* next_change = GetOldestInFlightChangeMatching(*change); 1315 InFlightChange* next_change = GetOldestInFlightChangeMatching(*change);
1300 if (next_change) { 1316 if (next_change) {
1301 if (!success) 1317 if (!success)
1302 next_change->SetRevertValueFrom(*change); 1318 next_change->SetRevertValueFrom(*change);
1303 } else if (!success) { 1319 } else if (!success) {
1304 change->Revert(); 1320 change->Revert();
1305 } 1321 }
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 tree_->SetHitTestMask(WindowMus::Get(window_tree_host->window())->server_id(), 1629 tree_->SetHitTestMask(WindowMus::Get(window_tree_host->window())->server_id(),
1614 out_rect); 1630 out_rect);
1615 } 1631 }
1616 1632
1617 void WindowTreeClient::OnWindowTreeHostDeactivateWindow( 1633 void WindowTreeClient::OnWindowTreeHostDeactivateWindow(
1618 WindowTreeHostMus* window_tree_host) { 1634 WindowTreeHostMus* window_tree_host) {
1619 tree_->DeactivateWindow( 1635 tree_->DeactivateWindow(
1620 WindowMus::Get(window_tree_host->window())->server_id()); 1636 WindowMus::Get(window_tree_host->window())->server_id());
1621 } 1637 }
1622 1638
1639 void WindowTreeClient::OnWindowTreeHostStackAtTop(
1640 WindowTreeHostMus* window_tree_host) {
1641 WindowMus* window = WindowMus::Get(window_tree_host->window());
1642 const uint32_t change_id = ScheduleInFlightChange(
1643 base::MakeUnique<CrashInFlightChange>(window, ChangeType::REORDER));
1644 tree_->StackAtTop(change_id, window->server_id());
1645 }
1646
1623 std::unique_ptr<WindowPortMus> WindowTreeClient::CreateWindowPortForTopLevel( 1647 std::unique_ptr<WindowPortMus> WindowTreeClient::CreateWindowPortForTopLevel(
1624 const std::map<std::string, std::vector<uint8_t>>* properties) { 1648 const std::map<std::string, std::vector<uint8_t>>* properties) {
1625 std::unique_ptr<WindowPortMus> window_port = 1649 std::unique_ptr<WindowPortMus> window_port =
1626 base::MakeUnique<WindowPortMus>(this, WindowMusType::TOP_LEVEL); 1650 base::MakeUnique<WindowPortMus>(this, WindowMusType::TOP_LEVEL);
1627 roots_.insert(window_port.get()); 1651 roots_.insert(window_port.get());
1628 1652
1629 window_port->set_server_id(MakeTransportId(client_id_, next_window_id_++)); 1653 window_port->set_server_id(MakeTransportId(client_id_, next_window_id_++));
1630 RegisterWindowMus(window_port.get()); 1654 RegisterWindowMus(window_port.get());
1631 1655
1632 std::unordered_map<std::string, std::vector<uint8_t>> transport_properties; 1656 std::unordered_map<std::string, std::vector<uint8_t>> transport_properties;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1751 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1728 this, capture_synchronizer_.get(), window)); 1752 this, capture_synchronizer_.get(), window));
1729 } 1753 }
1730 1754
1731 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1755 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1732 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1756 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1733 this, focus_synchronizer_.get(), window)); 1757 this, focus_synchronizer_.get(), window));
1734 } 1758 }
1735 1759
1736 } // namespace aura 1760 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | ui/aura/mus/window_tree_client_test_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698