OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 } | 596 } |
597 | 597 |
598 void* Window::GetNativeWindowProperty(const char* key) const { | 598 void* Window::GetNativeWindowProperty(const char* key) const { |
599 return reinterpret_cast<void*>(GetPropertyInternal(key, 0)); | 599 return reinterpret_cast<void*>(GetPropertyInternal(key, 0)); |
600 } | 600 } |
601 | 601 |
602 void Window::OnDeviceScaleFactorChanged(float device_scale_factor) { | 602 void Window::OnDeviceScaleFactorChanged(float device_scale_factor) { |
603 port_->OnDeviceScaleFactorChanged(device_scale_factor); | 603 port_->OnDeviceScaleFactorChanged(device_scale_factor); |
604 } | 604 } |
605 | 605 |
606 #if !defined(NDEBUG) | |
607 std::string Window::GetDebugInfo() const { | 606 std::string Window::GetDebugInfo() const { |
608 return base::StringPrintf( | 607 return base::StringPrintf( |
609 "%s<%d> bounds(%d, %d, %d, %d) %s %s opacity=%.1f", | 608 "%s<%d> bounds(%d, %d, %d, %d) %s %s opacity=%.1f", |
610 GetName().empty() ? "Unknown" : GetName().c_str(), id(), bounds().x(), | 609 GetName().empty() ? "Unknown" : GetName().c_str(), id(), bounds().x(), |
611 bounds().y(), bounds().width(), bounds().height(), | 610 bounds().y(), bounds().width(), bounds().height(), |
612 visible_ ? "WindowVisible" : "WindowHidden", | 611 visible_ ? "WindowVisible" : "WindowHidden", |
613 layer() | 612 layer() |
614 ? (layer()->GetTargetVisibility() ? "LayerVisible" : "LayerHidden") | 613 ? (layer()->GetTargetVisibility() ? "LayerVisible" : "LayerHidden") |
615 : "NoLayer", | 614 : "NoLayer", |
616 layer() ? layer()->opacity() : 1.0f); | 615 layer() ? layer()->opacity() : 1.0f); |
617 } | 616 } |
618 | 617 |
619 void Window::PrintWindowHierarchy(int depth) const { | 618 void Window::PrintWindowHierarchy(int depth) const { |
620 VLOG(0) << base::StringPrintf( | 619 VLOG(0) << base::StringPrintf( |
621 "%*s%s", depth * 2, "", GetDebugInfo().c_str()); | 620 "%*s%s", depth * 2, "", GetDebugInfo().c_str()); |
622 for (Windows::const_iterator it = children_.begin(); | 621 for (Windows::const_iterator it = children_.begin(); |
623 it != children_.end(); ++it) { | 622 it != children_.end(); ++it) { |
624 Window* child = *it; | 623 Window* child = *it; |
625 child->PrintWindowHierarchy(depth + 1); | 624 child->PrintWindowHierarchy(depth + 1); |
626 } | 625 } |
627 } | 626 } |
628 #endif | |
629 | 627 |
630 void Window::RemoveOrDestroyChildren() { | 628 void Window::RemoveOrDestroyChildren() { |
631 while (!children_.empty()) { | 629 while (!children_.empty()) { |
632 Window* child = children_[0]; | 630 Window* child = children_[0]; |
633 if (child->owned_by_parent_) { | 631 if (child->owned_by_parent_) { |
634 delete child; | 632 delete child; |
635 // Deleting the child so remove it from out children_ list. | 633 // Deleting the child so remove it from out children_ list. |
636 DCHECK(std::find(children_.begin(), children_.end(), child) == | 634 DCHECK(std::find(children_.begin(), children_.end(), child) == |
637 children_.end()); | 635 children_.end()); |
638 } else { | 636 } else { |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 layer_name = "Unnamed Window"; | 1081 layer_name = "Unnamed Window"; |
1084 | 1082 |
1085 if (id_ != -1) | 1083 if (id_ != -1) |
1086 layer_name += " " + base::IntToString(id_); | 1084 layer_name += " " + base::IntToString(id_); |
1087 | 1085 |
1088 layer()->set_name(layer_name); | 1086 layer()->set_name(layer_name); |
1089 #endif | 1087 #endif |
1090 } | 1088 } |
1091 | 1089 |
1092 } // namespace aura | 1090 } // namespace aura |
OLD | NEW |