summaryrefslogtreecommitdiffstats
path: root/ui/oak/oak_pretty_print.cc
blob: 3b5cdb0258031eb29eb234a27b364aa27a2e79e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/oak/oak_pretty_print.h"

#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/rect.h"

namespace oak {
namespace internal {

string16 PropertyWithInteger(const std::string& prefix, int value) {
  return ASCIIToUTF16(prefix) + base::IntToString16(value);
}

string16 PropertyWithVoidStar(const std::string& prefix, void* ptr) {
  unsigned int cast_ptr =
      static_cast<unsigned int>(reinterpret_cast<intptr_t>(ptr));
  return ASCIIToUTF16(
      prefix + "0x" + (ptr ? base::StringPrintf("%x", cast_ptr) : "0"));
}

string16 PropertyWithBool(const std::string& prefix, bool value) {
  return ASCIIToUTF16(prefix + (value ? "true" : "false"));
}

string16 PropertyWithBounds(const std::string& prefix,
                            const gfx::Rect& bounds) {
  return ASCIIToUTF16(prefix + bounds.ToString());
}

string16 PropertyWithInsets(const std::string& prefix,
                            const gfx::Insets& insets) {
  return ASCIIToUTF16(prefix + insets.ToString());
}

}  // namespace internal
}  // namespace oak