OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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. | |
4 | |
5 #ifndef COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_STRUCT_TRAITS_H_ | |
6 #define COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_STRUCT_TRAITS_H_ | |
7 | |
8 #include "base/logging.h" | |
9 #include "components/arc/common/file_system.mojom.h" | |
10 #include "storage/browser/fileapi/watcher_manager.h" | |
11 | |
12 namespace mojo { | |
13 | |
14 template <> | |
15 struct EnumTraits<arc::mojom::ChangeType, storage::WatcherManager::ChangeType> { | |
16 static arc::mojom::ChangeType ToMojom( | |
17 storage::WatcherManager::ChangeType type) { | |
18 switch (type) { | |
19 case storage::WatcherManager::CHANGED: | |
20 return arc::mojom::ChangeType::CHANGED; | |
21 case storage::WatcherManager::DELETED: | |
22 return arc::mojom::ChangeType::DELETED; | |
dcheng
2017/03/02 07:26:36
In general, we prefer to out-of-line not-obviously
Shuhei Takahashi
2017/03/02 07:45:44
Hmm, OK, please let me move this definition to out
| |
23 } | |
24 NOTREACHED(); | |
25 return arc::mojom::ChangeType::CHANGED; | |
26 } | |
27 | |
28 static bool FromMojom(arc::mojom::ChangeType mojom_type, | |
29 storage::WatcherManager::ChangeType* type) { | |
30 switch (mojom_type) { | |
31 case arc::mojom::ChangeType::CHANGED: | |
32 *type = storage::WatcherManager::CHANGED; | |
33 return true; | |
34 case arc::mojom::ChangeType::DELETED: | |
35 *type = storage::WatcherManager::DELETED; | |
36 return true; | |
37 } | |
38 NOTREACHED(); | |
39 return false; | |
40 } | |
41 }; | |
42 | |
43 } // namespace mojo | |
44 | |
45 #endif // COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_STRUCT_TRAITS_H_ | |
OLD | NEW |