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

Side by Side Diff: chromeos/dbus/audio_node.cc

Issue 1380103003: Store audio device's active state in preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix string format Created 4 years, 11 months 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
« no previous file with comments | « chromeos/dbus/audio_node.h ('k') | chromeos/dbus/cras_audio_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/dbus/audio_node.h" 5 #include "chromeos/dbus/audio_node.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 14
15 AudioNode::AudioNode() 15 AudioNode::AudioNode()
16 : is_input(false), 16 : is_input(false),
17 id(0), 17 id(0),
18 active(false), 18 active(false),
19 plugged_time(0) { 19 plugged_time(0) {
20 } 20 }
21 21
22 AudioNode::AudioNode(bool is_input, 22 AudioNode::AudioNode(bool is_input,
23 uint64_t id, 23 uint64_t id,
24 uint64_t stable_device_id,
24 std::string device_name, 25 std::string device_name,
25 std::string type, 26 std::string type,
26 std::string name, 27 std::string name,
27 bool active, 28 bool active,
28 uint64_t plugged_time) 29 uint64_t plugged_time)
29 : is_input(is_input), 30 : is_input(is_input),
30 id(id), 31 id(id),
32 stable_device_id(stable_device_id),
31 device_name(device_name), 33 device_name(device_name),
32 type(type), 34 type(type),
33 name(name), 35 name(name),
34 active(active), 36 active(active),
35 plugged_time(plugged_time) {} 37 plugged_time(plugged_time) {}
36 38
37 AudioNode::~AudioNode() {} 39 AudioNode::~AudioNode() {}
38 40
39 std::string AudioNode::ToString() const { 41 std::string AudioNode::ToString() const {
40 std::string result; 42 std::string result;
41 base::StringAppendF(&result, 43 base::StringAppendF(&result,
42 "is_input = %s ", 44 "is_input = %s ",
43 is_input ? "true" : "false"); 45 is_input ? "true" : "false");
44 base::StringAppendF(&result, 46 base::StringAppendF(&result,
45 "id = 0x%" PRIx64 " ", 47 "id = 0x%" PRIx64 " ",
46 id); 48 id);
47 base::StringAppendF(&result, 49 base::StringAppendF(&result, "stable_device_id = 0x%" PRIx64 " ",
48 "device_name = %s ", 50 stable_device_id);
49 device_name.c_str()); 51 base::StringAppendF(&result, "device_name = %s ", device_name.c_str());
50 base::StringAppendF(&result, 52 base::StringAppendF(&result,
51 "type = %s ", 53 "type = %s ",
52 type.c_str()); 54 type.c_str());
53 base::StringAppendF(&result, 55 base::StringAppendF(&result,
54 "name = %s ", 56 "name = %s ",
55 name.c_str()); 57 name.c_str());
56 base::StringAppendF(&result, 58 base::StringAppendF(&result,
57 "active = %s ", 59 "active = %s ",
58 active ? "true" : "false"); 60 active ? "true" : "false");
59 base::StringAppendF(&result, 61 base::StringAppendF(&result,
60 "plugged_time= %s ", 62 "plugged_time= %s ",
61 base::Uint64ToString(plugged_time).c_str()); 63 base::Uint64ToString(plugged_time).c_str());
62 64
63 return result; 65 return result;
64 } 66 }
65 67
66 } // namespace chromeos 68 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/audio_node.h ('k') | chromeos/dbus/cras_audio_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698