Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "components/mus/ws/window_tree.h" | 5 #include "components/mus/ws/window_tree.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 if (window->opacity() == opacity) | 287 if (window->opacity() == opacity) |
| 288 return true; | 288 return true; |
| 289 Operation op(this, window_server_, OperationType::SET_WINDOW_OPACITY); | 289 Operation op(this, window_server_, OperationType::SET_WINDOW_OPACITY); |
| 290 window->SetOpacity(opacity); | 290 window->SetOpacity(opacity); |
| 291 return true; | 291 return true; |
| 292 } | 292 } |
| 293 | 293 |
| 294 bool WindowTree::SetFocus(const ClientWindowId& window_id) { | 294 bool WindowTree::SetFocus(const ClientWindowId& window_id) { |
| 295 ServerWindow* window = GetWindowByClientId(window_id); | 295 ServerWindow* window = GetWindowByClientId(window_id); |
| 296 ServerWindow* currently_focused = window_server_->GetFocusedWindow(); | 296 ServerWindow* currently_focused = window_server_->GetFocusedWindow(); |
| 297 if (!currently_focused && !window) | 297 if (!currently_focused && !window) { |
| 298 LOG(WARNING) << "SetFocus failure, no focused window to clear."; | |
|
sky
2016/05/16 19:44:27
I think these should be DVLOGs.
James Cook
2016/05/16 20:57:44
How about DLOG? My concern with DVLOG is that no o
James Cook
2016/05/16 21:43:01
Discussed offline, switched to DVLOG.
| |
| 298 return false; | 299 return false; |
| 300 } | |
| 299 | 301 |
| 300 Display* display = GetDisplay(window); | 302 Display* display = GetDisplay(window); |
| 301 if (window && (!display || !window->can_focus() || !window->IsDrawn())) | 303 if (window && (!display || !window->can_focus() || !window->IsDrawn())) { |
| 304 LOG(WARNING) << "SetFocus failure, window cannot be focused."; | |
| 302 return false; | 305 return false; |
| 306 } | |
| 303 | 307 |
| 304 if (!access_policy_->CanSetFocus(window)) | 308 if (!access_policy_->CanSetFocus(window)) { |
| 309 LOG(WARNING) << "SetFocus failure, blocked by access policy."; | |
| 305 return false; | 310 return false; |
| 311 } | |
| 306 | 312 |
| 307 Operation op(this, window_server_, OperationType::SET_FOCUS); | 313 Operation op(this, window_server_, OperationType::SET_FOCUS); |
| 308 return window_server_->SetFocusedWindow(window); | 314 bool success = window_server_->SetFocusedWindow(window); |
| 315 if (!success) { | |
| 316 LOG(WARNING) << "SetFocus failure, could not SetFocusedWindow."; | |
| 317 } | |
| 318 return success; | |
| 309 } | 319 } |
| 310 | 320 |
| 311 bool WindowTree::Embed(const ClientWindowId& window_id, | 321 bool WindowTree::Embed(const ClientWindowId& window_id, |
| 312 mojom::WindowTreeClientPtr client) { | 322 mojom::WindowTreeClientPtr client) { |
| 313 if (!client || !CanEmbed(window_id)) | 323 if (!client || !CanEmbed(window_id)) |
| 314 return false; | 324 return false; |
| 315 ServerWindow* window = GetWindowByClientId(window_id); | 325 ServerWindow* window = GetWindowByClientId(window_id); |
| 316 PrepareForEmbed(window); | 326 PrepareForEmbed(window); |
| 317 // When embedding we don't know the user id of where the TreeClient came | 327 // When embedding we don't know the user id of where the TreeClient came |
| 318 // from. Use an invalid id, which limits what the client is able to do. | 328 // from. Use an invalid id, which limits what the client is able to do. |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1455 } | 1465 } |
| 1456 | 1466 |
| 1457 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( | 1467 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( |
| 1458 const ServerWindow* window) const { | 1468 const ServerWindow* window) const { |
| 1459 WindowTree* tree = window_server_->GetTreeWithRoot(window); | 1469 WindowTree* tree = window_server_->GetTreeWithRoot(window); |
| 1460 return tree && tree != this; | 1470 return tree && tree != this; |
| 1461 } | 1471 } |
| 1462 | 1472 |
| 1463 } // namespace ws | 1473 } // namespace ws |
| 1464 } // namespace mus | 1474 } // namespace mus |
| OLD | NEW |