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

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

Issue 2778823002: Simplify WindowManager::OnWmSetBounds (Closed)
Patch Set: Update expectations for DragTestInteractive.DragTest Created 3 years, 8 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_manager_delegate.h ('k') | ui/aura/test/aura_test_base.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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 void WindowTreeClient::WmDisplayModified(const display::Display& display) { 1394 void WindowTreeClient::WmDisplayModified(const display::Display& display) {
1395 DCHECK(window_manager_delegate_); 1395 DCHECK(window_manager_delegate_);
1396 // TODO(sky): this should likely route to WindowTreeHost. 1396 // TODO(sky): this should likely route to WindowTreeHost.
1397 window_manager_delegate_->OnWmDisplayModified(display); 1397 window_manager_delegate_->OnWmDisplayModified(display);
1398 } 1398 }
1399 1399
1400 void WindowTreeClient::WmSetBounds(uint32_t change_id, 1400 void WindowTreeClient::WmSetBounds(uint32_t change_id,
1401 Id window_id, 1401 Id window_id,
1402 const gfx::Rect& transit_bounds_in_pixels) { 1402 const gfx::Rect& transit_bounds_in_pixels) {
1403 WindowMus* window = GetWindowByServerId(window_id); 1403 WindowMus* window = GetWindowByServerId(window_id);
1404 bool result = false;
1405 if (window) { 1404 if (window) {
1406 float device_scale_factor = ScaleFactorForDisplay(window->GetWindow()); 1405 float device_scale_factor = ScaleFactorForDisplay(window->GetWindow());
1407 DCHECK(window_manager_delegate_); 1406 DCHECK(window_manager_delegate_);
1408 gfx::Rect transit_bounds_in_dip = 1407 gfx::Rect transit_bounds_in_dip =
1409 gfx::ConvertRectToDIP(device_scale_factor, transit_bounds_in_pixels); 1408 gfx::ConvertRectToDIP(device_scale_factor, transit_bounds_in_pixels);
1410 gfx::Rect bounds_in_dip = transit_bounds_in_dip; 1409 window_manager_delegate_->OnWmSetBounds(window->GetWindow(),
1411 // TODO: this needs to trigger scheduling a bounds change on |window|. 1410 transit_bounds_in_dip);
1412 result = window_manager_delegate_->OnWmSetBounds(window->GetWindow(),
1413 &bounds_in_dip);
1414 if (result) {
1415 // If the resulting bounds differ return false. Returning false ensures
1416 // the client applies the bounds we set below.
1417 result = bounds_in_dip == transit_bounds_in_dip;
1418 window->SetBoundsFromServer(bounds_in_dip);
1419 }
1420 } else { 1411 } else {
1421 DVLOG(1) << "Unknown window passed to WmSetBounds()."; 1412 DVLOG(1) << "Unknown window passed to WmSetBounds().";
1422 } 1413 }
1423 if (window_manager_internal_client_) 1414 if (window_manager_internal_client_)
1424 window_manager_internal_client_->WmResponse(change_id, result); 1415 window_manager_internal_client_->WmSetBoundsResponse(change_id);
1425 } 1416 }
1426 1417
1427 void WindowTreeClient::WmSetProperty( 1418 void WindowTreeClient::WmSetProperty(
1428 uint32_t change_id, 1419 uint32_t change_id,
1429 Id window_id, 1420 Id window_id,
1430 const std::string& name, 1421 const std::string& name,
1431 const base::Optional<std::vector<uint8_t>>& transit_data) { 1422 const base::Optional<std::vector<uint8_t>>& transit_data) {
1432 WindowMus* window = GetWindowByServerId(window_id); 1423 WindowMus* window = GetWindowByServerId(window_id);
1433 bool result = false; 1424 bool result = false;
1434 if (window) { 1425 if (window) {
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1906 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1916 this, capture_synchronizer_.get(), window)); 1907 this, capture_synchronizer_.get(), window));
1917 } 1908 }
1918 1909
1919 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1910 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1920 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1911 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1921 this, focus_synchronizer_.get(), window)); 1912 this, focus_synchronizer_.get(), window));
1922 } 1913 }
1923 1914
1924 } // namespace aura 1915 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_manager_delegate.h ('k') | ui/aura/test/aura_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698