Don't preload rarely seen large images
[chromium-blink-merge.git] / chromeos / audio / audio_device.h
blob67dca1cf338a04335be31cd510619681ef4ac0f4
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 #ifndef CHROMEOS_AUDIO_AUDIO_DEVICE_H_
6 #define CHROMEOS_AUDIO_AUDIO_DEVICE_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/audio_node.h"
16 namespace chromeos {
18 // Ordered from the highest priority to the lowest.
19 enum AudioDeviceType {
20 AUDIO_TYPE_HEADPHONE,
21 AUDIO_TYPE_MIC,
22 AUDIO_TYPE_USB,
23 AUDIO_TYPE_BLUETOOTH,
24 AUDIO_TYPE_HDMI,
25 AUDIO_TYPE_INTERNAL_SPEAKER,
26 AUDIO_TYPE_INTERNAL_MIC,
27 AUDIO_TYPE_KEYBOARD_MIC,
28 AUDIO_TYPE_AOKR,
29 AUDIO_TYPE_POST_MIX_LOOPBACK,
30 AUDIO_TYPE_POST_DSP_LOOPBACK,
31 AUDIO_TYPE_OTHER,
34 struct CHROMEOS_EXPORT AudioDevice {
35 AudioDevice();
36 explicit AudioDevice(const AudioNode& node);
37 std::string ToString() const;
39 // Converts between the string type sent via D-Bus and AudioDeviceType.
40 // Static so they can be used by tests.
41 static std::string GetTypeString(chromeos::AudioDeviceType type);
42 static chromeos::AudioDeviceType GetAudioType(const std::string& node_type);
44 bool is_input;
45 uint64 id;
46 std::string display_name;
47 std::string device_name;
48 AudioDeviceType type;
49 uint8 priority;
50 bool active;
51 uint64 plugged_time;
54 typedef std::vector<AudioDevice> AudioDeviceList;
55 typedef std::map<uint64, AudioDevice> AudioDeviceMap;
57 struct AudioDeviceCompare {
58 // Rules used to discern which device is higher,
59 // 1.) Device Type:
60 // [Headphones/USB/Bluetooh > HDMI > Internal Speakers]
61 // [External Mic/USB Mic/Bluetooth > Internal Mic]
62 // 2.) Device Plugged in Time:
63 // [Later > Earlier]
64 bool operator()(const chromeos::AudioDevice& a,
65 const chromeos::AudioDevice& b) const {
66 if (a.priority < b.priority) {
67 return true;
68 } else if (b.priority < a.priority) {
69 return false;
70 } else if (a.plugged_time < b.plugged_time) {
71 return true;
72 } else {
73 return false;
78 } // namespace chromeos
80 #endif // CHROMEOS_AUDIO_AUDIO_DEVICE_H_