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

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

Issue 2778823002: Simplify WindowManager::OnWmSetBounds (Closed)
Patch Set: Addressed Scott's comment 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 gfx::Rect bounds_in_dip = transit_bounds_in_dip;
1411 // TODO: this needs to trigger scheduling a bounds change on |window|. 1410 window_manager_delegate_->OnWmSetBounds(window->GetWindow(),
1412 result = window_manager_delegate_->OnWmSetBounds(window->GetWindow(), 1411 &bounds_in_dip);
Fady Samuel 2017/03/27 18:16:37 Actually, this doesn't seem to need to be an out p
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 { 1412 } else {
1421 DVLOG(1) << "Unknown window passed to WmSetBounds()."; 1413 DVLOG(1) << "Unknown window passed to WmSetBounds().";
1422 } 1414 }
1423 if (window_manager_internal_client_) 1415 if (window_manager_internal_client_)
1424 window_manager_internal_client_->WmResponse(change_id, result); 1416 window_manager_internal_client_->WmSetBoundsResponse(change_id);
1425 } 1417 }
1426 1418
1427 void WindowTreeClient::WmSetProperty( 1419 void WindowTreeClient::WmSetProperty(
1428 uint32_t change_id, 1420 uint32_t change_id,
1429 Id window_id, 1421 Id window_id,
1430 const std::string& name, 1422 const std::string& name,
1431 const base::Optional<std::vector<uint8_t>>& transit_data) { 1423 const base::Optional<std::vector<uint8_t>>& transit_data) {
1432 WindowMus* window = GetWindowByServerId(window_id); 1424 WindowMus* window = GetWindowByServerId(window_id);
1433 bool result = false; 1425 bool result = false;
1434 if (window) { 1426 if (window) {
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1907 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1916 this, capture_synchronizer_.get(), window)); 1908 this, capture_synchronizer_.get(), window));
1917 } 1909 }
1918 1910
1919 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1911 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1920 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1912 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1921 this, focus_synchronizer_.get(), window)); 1913 this, focus_synchronizer_.get(), window));
1922 } 1914 }
1923 1915
1924 } // namespace aura 1916 } // 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