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

Side by Side Diff: services/ui/public/cpp/window_tree_client.cc

Issue 2548513002: Update bool WindowManager::OnWmSetBounds() to match with its desirable behavior. (Closed)
Patch Set: Remove if condition statetment in Window::SetBounds(const gfx::Rect& new_bounds). Created 4 years 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
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 "services/ui/public/cpp/window_tree_client.h" 5 #include "services/ui/public/cpp/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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 1309
1310 void WindowTreeClient::WmDisplayModified(const display::Display& display) { 1310 void WindowTreeClient::WmDisplayModified(const display::Display& display) {
1311 DCHECK(window_manager_delegate_); 1311 DCHECK(window_manager_delegate_);
1312 window_manager_delegate_->OnWmDisplayModified(display); 1312 window_manager_delegate_->OnWmDisplayModified(display);
1313 } 1313 }
1314 1314
1315 void WindowTreeClient::WmSetBounds(uint32_t change_id, 1315 void WindowTreeClient::WmSetBounds(uint32_t change_id,
1316 Id window_id, 1316 Id window_id,
1317 const gfx::Rect& transit_bounds) { 1317 const gfx::Rect& transit_bounds) {
1318 Window* window = GetWindowByServerId(window_id); 1318 Window* window = GetWindowByServerId(window_id);
1319 bool result = false;
1320 if (window) { 1319 if (window) {
1321 DCHECK(window_manager_delegate_); 1320 DCHECK(window_manager_delegate_);
1322 gfx::Rect transit_bounds_in_dip = gfx::ConvertRectToDIP( 1321 gfx::Rect transit_bounds_in_dip = gfx::ConvertRectToDIP(
1323 ScaleFactorForDisplay(window->display_id()), transit_bounds); 1322 ScaleFactorForDisplay(window->display_id()), transit_bounds);
1324 gfx::Rect bounds = transit_bounds_in_dip; 1323 window_manager_delegate_->OnWmSetBounds(window, transit_bounds_in_dip);
1325 result = window_manager_delegate_->OnWmSetBounds(window, &bounds);
1326 if (result) {
1327 // If the resulting bounds differ return false. Returning false ensures
1328 // the client applies the bounds we set below.
1329 result = bounds == transit_bounds_in_dip;
1330 window->SetBounds(bounds);
1331 }
1332 } 1324 }
1325
1326 // Returning false ensures the client applies the bounds we set above in the
mfomitchev 2016/12/08 20:44:23 "the bounds which the |window_manager_delegate_| s
1327 // delegate.
1333 if (window_manager_internal_client_) 1328 if (window_manager_internal_client_)
1334 window_manager_internal_client_->WmResponse(change_id, result); 1329 window_manager_internal_client_->WmResponse(change_id, false);
1335 } 1330 }
1336 1331
1337 void WindowTreeClient::WmSetProperty( 1332 void WindowTreeClient::WmSetProperty(
1338 uint32_t change_id, 1333 uint32_t change_id,
1339 Id window_id, 1334 Id window_id,
1340 const std::string& name, 1335 const std::string& name,
1341 const base::Optional<std::vector<uint8_t>>& transit_data) { 1336 const base::Optional<std::vector<uint8_t>>& transit_data) {
1342 Window* window = GetWindowByServerId(window_id); 1337 Window* window = GetWindowByServerId(window_id);
1343 bool result = false; 1338 bool result = false;
1344 if (window) { 1339 if (window) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 // TODO(riajiang): Figure out if |offset| needs to be converted. 1472 // TODO(riajiang): Figure out if |offset| needs to be converted.
1478 // (http://crbugs.com/646932) 1473 // (http://crbugs.com/646932)
1479 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( 1474 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
1480 server_id(window), offset.x(), offset.y(), 1475 server_id(window), offset.x(), offset.y(),
1481 gfx::ConvertInsetsToDIP(ScaleFactorForDisplay(window->display_id()), 1476 gfx::ConvertInsetsToDIP(ScaleFactorForDisplay(window->display_id()),
1482 hit_area)); 1477 hit_area));
1483 } 1478 }
1484 } 1479 }
1485 1480
1486 } // namespace ui 1481 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698