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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
ash / components / arc / volume_mounter / volume_mounter_mojom_traits.cc [blame]
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/components/arc/volume_mounter/volume_mounter_mojom_traits.h"
#include "base/notreached.h"
namespace mojo {
arc::mojom::DeviceType
EnumTraits<arc::mojom::DeviceType, ash::DeviceType>::ToMojom(
ash::DeviceType device_type) {
switch (device_type) {
case ash::DeviceType::kUSB:
return arc::mojom::DeviceType::DEVICE_TYPE_USB;
case ash::DeviceType::kSD:
return arc::mojom::DeviceType::DEVICE_TYPE_SD;
case ash::DeviceType::kUnknown:
case ash::DeviceType::kOpticalDisc:
case ash::DeviceType::kMobile:
case ash::DeviceType::kDVD:
// Android doesn't recognize this device natively. So, propagating
// UNKNOWN and let Android decides how to handle this.
return arc::mojom::DeviceType::DEVICE_TYPE_UNKNOWN;
}
NOTREACHED();
}
bool EnumTraits<arc::mojom::DeviceType, ash::DeviceType>::FromMojom(
arc::mojom::DeviceType input,
ash::DeviceType* out) {
switch (input) {
case arc::mojom::DeviceType::DEVICE_TYPE_USB:
*out = ash::DeviceType::kUSB;
return true;
case arc::mojom::DeviceType::DEVICE_TYPE_SD:
*out = ash::DeviceType::kSD;
return true;
case arc::mojom::DeviceType::DEVICE_TYPE_UNKNOWN:
*out = ash::DeviceType::kUnknown;
return true;
}
NOTREACHED();
}
arc::mojom::MountEvent
EnumTraits<arc::mojom::MountEvent, ash::disks::DiskMountManager::MountEvent>::
ToMojom(ash::disks::DiskMountManager::MountEvent mount_event) {
switch (mount_event) {
case ash::disks::DiskMountManager::MountEvent::MOUNTING:
return arc::mojom::MountEvent::MOUNTING;
case ash::disks::DiskMountManager::MountEvent::UNMOUNTING:
return arc::mojom::MountEvent::UNMOUNTING;
}
NOTREACHED();
}
bool EnumTraits<arc::mojom::MountEvent,
ash::disks::DiskMountManager::MountEvent>::
FromMojom(arc::mojom::MountEvent input,
ash::disks::DiskMountManager::MountEvent* out) {
switch (input) {
case arc::mojom::MountEvent::MOUNTING:
*out = ash::disks::DiskMountManager::MountEvent::MOUNTING;
return true;
case arc::mojom::MountEvent::UNMOUNTING:
*out = ash::disks::DiskMountManager::MountEvent::UNMOUNTING;
return true;
}
NOTREACHED();
}
} // namespace mojo