Index: components/arc/file_system/file_system_struct_traits.h |
diff --git a/components/arc/file_system/file_system_struct_traits.h b/components/arc/file_system/file_system_struct_traits.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..20ca629857bc19704815a3b061ba0ed831ecad15 |
--- /dev/null |
+++ b/components/arc/file_system/file_system_struct_traits.h |
@@ -0,0 +1,45 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_STRUCT_TRAITS_H_ |
+#define COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_STRUCT_TRAITS_H_ |
+ |
+#include "base/logging.h" |
+#include "components/arc/common/file_system.mojom.h" |
+#include "storage/browser/fileapi/watcher_manager.h" |
+ |
+namespace mojo { |
+ |
+template <> |
+struct EnumTraits<arc::mojom::ChangeType, storage::WatcherManager::ChangeType> { |
+ static arc::mojom::ChangeType ToMojom( |
+ storage::WatcherManager::ChangeType type) { |
+ switch (type) { |
+ case storage::WatcherManager::CHANGED: |
+ return arc::mojom::ChangeType::CHANGED; |
+ case storage::WatcherManager::DELETED: |
+ 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
|
+ } |
+ NOTREACHED(); |
+ return arc::mojom::ChangeType::CHANGED; |
+ } |
+ |
+ static bool FromMojom(arc::mojom::ChangeType mojom_type, |
+ storage::WatcherManager::ChangeType* type) { |
+ switch (mojom_type) { |
+ case arc::mojom::ChangeType::CHANGED: |
+ *type = storage::WatcherManager::CHANGED; |
+ return true; |
+ case arc::mojom::ChangeType::DELETED: |
+ *type = storage::WatcherManager::DELETED; |
+ return true; |
+ } |
+ NOTREACHED(); |
+ return false; |
+ } |
+}; |
+ |
+} // namespace mojo |
+ |
+#endif // COMPONENTS_ARC_FILE_SYSTEM_FILE_SYSTEM_STRUCT_TRAITS_H_ |