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

Side by Side Diff: views/debug_utils.cc

Issue 8735009: views: Move some random files from views/ to ui/views/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « views/debug_utils.h ('k') | views/drag_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "views/debug_utils.h"
6
7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h"
9 #include "views/view.h"
10
11 #ifndef NDEBUG
12 #include <iostream>
13 #endif
14
15 namespace views {
16
17 #ifndef NDEBUG
18
19 namespace {
20 void PrintViewHierarchyImp(const View* view, int indent) {
21 std::wostringstream buf;
22 int ind = indent;
23 while (ind-- > 0)
24 buf << L' ';
25 buf << UTF8ToWide(view->GetClassName());
26 buf << L' ';
27 buf << view->id();
28 buf << L' ';
29 buf << view->x() << L"," << view->y() << L",";
30 buf << view->bounds().right() << L"," << view->bounds().bottom();
31 buf << L' ';
32 buf << view;
33
34 VLOG(1) << buf.str();
35 std::cout << buf.str() << std::endl;
36
37 for (int i = 0, count = view->child_count(); i < count; ++i)
38 PrintViewHierarchyImp(view->GetChildViewAt(i), indent + 2);
39 }
40
41 void PrintFocusHierarchyImp(const View* view, int indent) {
42 std::wostringstream buf;
43 int ind = indent;
44 while (ind-- > 0)
45 buf << L' ';
46 buf << UTF8ToWide(view->GetClassName());
47 buf << L' ';
48 buf << view->id();
49 buf << L' ';
50 buf << view->GetClassName().c_str();
51 buf << L' ';
52 buf << view;
53
54 VLOG(1) << buf.str();
55 std::cout << buf.str() << std::endl;
56
57 if (view->child_count() > 0)
58 PrintFocusHierarchyImp(view->GetChildViewAt(0), indent + 2);
59
60 const View* next_focusable = view->GetNextFocusableView();
61 if (next_focusable)
62 PrintFocusHierarchyImp(next_focusable, indent);
63 }
64 } // namespace
65
66 void PrintViewHierarchy(const View* view) {
67 PrintViewHierarchyImp(view, 0);
68 }
69
70 void PrintFocusHierarchy(const View* view) {
71 PrintFocusHierarchyImp(view, 0);
72 }
73
74 } // namespace views
75
76 #endif // NDEBUG
OLDNEW
« no previous file with comments | « views/debug_utils.h ('k') | views/drag_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698