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

Unified Diff: ui/base/window_open_disposition_enum_traits.h

Issue 2353003004: Move ViewHostMsg_CreateWindow to mojom (Closed)
Patch Set: . Created 4 years, 3 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/window_open_disposition.typemap ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/window_open_disposition_enum_traits.h
diff --git a/ui/base/window_open_disposition_enum_traits.h b/ui/base/window_open_disposition_enum_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..7e29d321b2bf8699f1de3af125c18145c6d83477
--- /dev/null
+++ b/ui/base/window_open_disposition_enum_traits.h
@@ -0,0 +1,83 @@
+// Copyright 2016 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.
+
+#include "base/logging.h"
+#include "mojo/public/cpp/bindings/enum_traits.h"
+#include "ui/base/window_open_disposition.h"
+#include "ui/base/window_open_disposition.mojom.h"
+
+namespace mojo {
+
+template <>
+struct EnumTraits<ui::mojom::WindowOpenDisposition, WindowOpenDisposition> {
+ static ui::mojom::WindowOpenDisposition ToMojom(
+ WindowOpenDisposition disposition) {
+ switch (disposition) {
+ case WindowOpenDisposition::UNKNOWN:
+ return ui::mojom::WindowOpenDisposition::UNKNOWN;
+ case WindowOpenDisposition::CURRENT_TAB:
+ return ui::mojom::WindowOpenDisposition::CURRENT_TAB;
+ case WindowOpenDisposition::SINGLETON_TAB:
+ return ui::mojom::WindowOpenDisposition::SINGLETON_TAB;
+ case WindowOpenDisposition::NEW_FOREGROUND_TAB:
+ return ui::mojom::WindowOpenDisposition::NEW_FOREGROUND_TAB;
+ case WindowOpenDisposition::NEW_BACKGROUND_TAB:
+ return ui::mojom::WindowOpenDisposition::NEW_BACKGROUND_TAB;
+ case WindowOpenDisposition::NEW_POPUP:
+ return ui::mojom::WindowOpenDisposition::NEW_POPUP;
+ case WindowOpenDisposition::NEW_WINDOW:
+ return ui::mojom::WindowOpenDisposition::NEW_WINDOW;
+ case WindowOpenDisposition::SAVE_TO_DISK:
+ return ui::mojom::WindowOpenDisposition::SAVE_TO_DISK;
+ case WindowOpenDisposition::OFF_THE_RECORD:
+ return ui::mojom::WindowOpenDisposition::OFF_THE_RECORD;
+ case WindowOpenDisposition::IGNORE_ACTION:
+ return ui::mojom::WindowOpenDisposition::IGNORE_ACTION;
+ default:
+ NOTREACHED();
+ return ui::mojom::WindowOpenDisposition::UNKNOWN;
+ }
+ }
+
+ static bool FromMojom(ui::mojom::WindowOpenDisposition disposition,
+ WindowOpenDisposition* out) {
+ switch (disposition) {
+ case ui::mojom::WindowOpenDisposition::UNKNOWN:
+ *out = WindowOpenDisposition::UNKNOWN;
+ return true;
+ case ui::mojom::WindowOpenDisposition::CURRENT_TAB:
+ *out = WindowOpenDisposition::CURRENT_TAB;
+ return true;
+ case ui::mojom::WindowOpenDisposition::SINGLETON_TAB:
+ *out = WindowOpenDisposition::SINGLETON_TAB;
+ return true;
+ case ui::mojom::WindowOpenDisposition::NEW_FOREGROUND_TAB:
+ *out = WindowOpenDisposition::NEW_FOREGROUND_TAB;
+ return true;
+ case ui::mojom::WindowOpenDisposition::NEW_BACKGROUND_TAB:
+ *out = WindowOpenDisposition::NEW_BACKGROUND_TAB;
+ return true;
+ case ui::mojom::WindowOpenDisposition::NEW_POPUP:
+ *out = WindowOpenDisposition::NEW_POPUP;
+ return true;
+ case ui::mojom::WindowOpenDisposition::NEW_WINDOW:
+ *out = WindowOpenDisposition::NEW_WINDOW;
+ return true;
+ case ui::mojom::WindowOpenDisposition::SAVE_TO_DISK:
+ *out = WindowOpenDisposition::SAVE_TO_DISK;
+ return true;
+ case ui::mojom::WindowOpenDisposition::OFF_THE_RECORD:
+ *out = WindowOpenDisposition::OFF_THE_RECORD;
+ return true;
+ case ui::mojom::WindowOpenDisposition::IGNORE_ACTION:
+ *out = WindowOpenDisposition::IGNORE_ACTION;
+ return true;
+ default:
+ NOTREACHED();
+ return false;
+ }
+ }
+};
+
+} // namespace mojo
« no previous file with comments | « ui/base/window_open_disposition.typemap ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698