OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/oak/oak_pretty_print.h" | |
6 | |
7 #include "base/strings/string_number_conversions.h" | |
8 #include "base/strings/string_util.h" | |
9 #include "base/strings/stringprintf.h" | |
10 #include "base/strings/utf_string_conversions.h" | |
11 #include "ui/gfx/insets.h" | |
12 #include "ui/gfx/rect.h" | |
13 | |
14 namespace oak { | |
15 namespace internal { | |
16 | |
17 base::string16 PropertyWithInteger(const std::string& prefix, int value) { | |
18 return base::ASCIIToUTF16(prefix) + base::IntToString16(value); | |
19 } | |
20 | |
21 base::string16 PropertyWithVoidStar(const std::string& prefix, void* ptr) { | |
22 unsigned int cast_ptr = | |
23 static_cast<unsigned int>(reinterpret_cast<intptr_t>(ptr)); | |
24 return base::ASCIIToUTF16( | |
25 prefix + "0x" + (ptr ? base::StringPrintf("%x", cast_ptr) : "0")); | |
26 } | |
27 | |
28 base::string16 PropertyWithBool(const std::string& prefix, bool value) { | |
29 return base::ASCIIToUTF16(prefix + (value ? "true" : "false")); | |
30 } | |
31 | |
32 base::string16 PropertyWithBounds(const std::string& prefix, | |
33 const gfx::Rect& bounds) { | |
34 return base::ASCIIToUTF16(prefix + bounds.ToString()); | |
35 } | |
36 | |
37 base::string16 PropertyWithInsets(const std::string& prefix, | |
38 const gfx::Insets& insets) { | |
39 return base::ASCIIToUTF16(prefix + insets.ToString()); | |
40 } | |
41 | |
42 } // namespace internal | |
43 } // namespace oak | |
OLD | NEW |