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

Unified Diff: ui/base/mojo/ui_base_types_struct_traits.h

Issue 2710023007: Make WindowTree::SetModal() take the type. (Closed)
Patch Set: address feedback. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/mojo/ui_base_types.typemap ('k') | ui/base/mojo/window_open_disposition.typemap » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/mojo/ui_base_types_struct_traits.h
diff --git a/ui/base/mojo/ui_base_types_struct_traits.h b/ui/base/mojo/ui_base_types_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..55d57df2d567e4e1f56f5beb5272f4b273c38fef
--- /dev/null
+++ b/ui/base/mojo/ui_base_types_struct_traits.h
@@ -0,0 +1,55 @@
+// 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 UI_BASE_MOJO_UI_BASE_TYPES_STRUCT_TRAITS_H_
+#define UI_BASE_MOJO_UI_BASE_TYPES_STRUCT_TRAITS_H_
+
+#include "mojo/public/cpp/bindings/enum_traits.h"
+#include "ui/base/mojo/ui_base_types.mojom.h"
+#include "ui/base/ui_base_types.h"
+
+namespace mojo {
+
+template <>
+struct EnumTraits<ui::mojom::ModalType, ui::ModalType> {
+ static ui::mojom::ModalType ToMojom(ui::ModalType modal_type) {
+ switch (modal_type) {
+ case ui::MODAL_TYPE_NONE:
+ return ui::mojom::ModalType::NONE;
+ case ui::MODAL_TYPE_WINDOW:
+ return ui::mojom::ModalType::WINDOW;
+ case ui::MODAL_TYPE_CHILD:
+ return ui::mojom::ModalType::CHILD;
+ case ui::MODAL_TYPE_SYSTEM:
+ return ui::mojom::ModalType::SYSTEM;
+ default:
+ NOTREACHED();
+ return ui::mojom::ModalType::NONE;
+ }
+ }
+
+ static bool FromMojom(ui::mojom::ModalType modal_type, ui::ModalType* out) {
+ switch (modal_type) {
+ case ui::mojom::ModalType::NONE:
+ *out = ui::MODAL_TYPE_NONE;
+ return true;
+ case ui::mojom::ModalType::WINDOW:
+ *out = ui::MODAL_TYPE_WINDOW;
+ return true;
+ case ui::mojom::ModalType::CHILD:
+ *out = ui::MODAL_TYPE_CHILD;
+ return true;
+ case ui::mojom::ModalType::SYSTEM:
+ *out = ui::MODAL_TYPE_SYSTEM;
+ return true;
+ default:
+ NOTREACHED();
+ return false;
+ }
+ }
+};
+
+} // namespace mojo
+
+#endif // UI_BASE_MOJO_WINDOW_OPEN_DISPOSITION_STRUCT_TRAITS_H_
« no previous file with comments | « ui/base/mojo/ui_base_types.typemap ('k') | ui/base/mojo/window_open_disposition.typemap » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698