Roll src/third_party/WebKit f0fc3a1:b92951d (svn 201688:201689)
[chromium-blink-merge.git] / chromeos / dbus / audio_node.cc
blobe025e9dd2ee3ea69a555de6b80c0f9cf13ee71ae
1 // Copyright (c) 2013 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.
5 #include "chromeos/dbus/audio_node.h"
7 #include "base/format_macros.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h"
11 namespace chromeos {
13 AudioNode::AudioNode()
14 : is_input(false),
15 id(0),
16 active(false),
17 plugged_time(0) {
20 AudioNode::AudioNode(bool is_input,
21 uint64 id,
22 std::string device_name,
23 std::string type,
24 std::string name,
25 bool active,
26 uint64 plugged_time)
27 : is_input(is_input),
28 id(id),
29 device_name(device_name),
30 type(type),
31 name(name),
32 active(active),
33 plugged_time(plugged_time) {
36 std::string AudioNode::ToString() const {
37 std::string result;
38 base::StringAppendF(&result,
39 "is_input = %s ",
40 is_input ? "true" : "false");
41 base::StringAppendF(&result,
42 "id = 0x%" PRIx64 " ",
43 id);
44 base::StringAppendF(&result,
45 "device_name = %s ",
46 device_name.c_str());
47 base::StringAppendF(&result,
48 "type = %s ",
49 type.c_str());
50 base::StringAppendF(&result,
51 "name = %s ",
52 name.c_str());
53 base::StringAppendF(&result,
54 "active = %s ",
55 active ? "true" : "false");
56 base::StringAppendF(&result,
57 "plugged_time= %s ",
58 base::Uint64ToString(plugged_time).c_str());
60 return result;
63 } // namespace chromeos