diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-04 16:14:46 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-04 16:14:46 +0000 |
commit | 744af52f4b544507fec76520ae863b0a219dd2e8 (patch) | |
tree | 559b7862ca601619e89c02506c7434380c6a077c /ui/aura/window.cc | |
parent | 5bcdf6cd3496e9047ceebadb69dd4ab3096fbde8 (diff) | |
download | chromium_src-744af52f4b544507fec76520ae863b0a219dd2e8.zip chromium_src-744af52f4b544507fec76520ae863b0a219dd2e8.tar.gz chromium_src-744af52f4b544507fec76520ae863b0a219dd2e8.tar.bz2 |
Add some aura::Window debug methods
BUG=None
TEST=None
Review URL: https://chromiumcodereview.appspot.com/10355002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/window.cc')
-rw-r--r-- | ui/aura/window.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 28c8b80..9ad84a3 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/stl_util.h" #include "base/string_util.h" +#include "base/stringprintf.h" #include "ui/aura/client/event_client.h" #include "ui/aura/client/stacking_client.h" #include "ui/aura/client/visibility_client.h" @@ -837,4 +838,24 @@ void Window::UpdateLayerName(const std::string& name) { #endif } +#ifndef NDEBUG +std::string Window::GetDebugInfo() const { + return StringPrintf( + "%s<%d> bounds(%d, %d, %d, %d) %s", + name().empty() ? "Unknown" : name().c_str(), id(), + bounds().x(), bounds().y(), bounds().width(), bounds().height(), + IsVisible() ? "Visible" : "Hidden"); +} + +void Window::PrintWindowHierarchy(int depth) const { + printf("%*s%s\n", depth * 2, "", GetDebugInfo().c_str()); + for (Windows::const_reverse_iterator it = children_.rbegin(), + rend = children_.rend(); + it != rend; ++it) { + Window* child = *it; + child->PrintWindowHierarchy(depth + 1); + } +} +#endif + } // namespace aura |