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

Side by Side Diff: third_party/WebKit/public/platform/ReferrerPolicyEnumTraits.h

Issue 2363573002: Move ViewHostMsg_CreateWindow to mojom (Closed)
Patch Set: . Created 4 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 ReferrerPolicyEnumTraits_h
6 #define ReferrerPolicyEnumTraits_h
7
8 #include "base/logging.h"
9 #include "mojo/public/cpp/bindings/enum_traits.h"
10 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
11 #include "third_party/WebKit/public/platform/referrer.mojom-shared.h"
12
13 namespace mojo {
14
15 template <>
16 struct EnumTraits<::blink::mojom::ReferrerPolicy, ::blink::WebReferrerPolicy> {
17 static ::blink::mojom::ReferrerPolicy ToMojom(::blink::WebReferrerPolicy pol icy)
18 {
19 switch (policy) {
20 case ::blink::WebReferrerPolicyAlways:
21 return ::blink::mojom::ReferrerPolicy::ALWAYS;
22 case ::blink::WebReferrerPolicyDefault:
23 return ::blink::mojom::ReferrerPolicy::DEFAULT;
24 case ::blink::WebReferrerPolicyNoReferrerWhenDowngrade:
25 return ::blink::mojom::ReferrerPolicy::NO_REFERRER_WHEN_DOWNGRADE;
26 case ::blink::WebReferrerPolicyNever:
27 return ::blink::mojom::ReferrerPolicy::NEVER;
28 case ::blink::WebReferrerPolicyOrigin:
29 return ::blink::mojom::ReferrerPolicy::ORIGIN;
30 case ::blink::WebReferrerPolicyOriginWhenCrossOrigin:
31 return ::blink::mojom::ReferrerPolicy::ORIGIN_WHEN_CROSS_ORIGIN;
32 case ::blink::WebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOri gin:
33 return ::blink::mojom::ReferrerPolicy::NO_REFERRER_WHEN_DOWNGRADE_OR IGIN_WHEN_CROSS_ORIGIN;
34 default:
35 NOTREACHED();
36 return ::blink::mojom::ReferrerPolicy::DEFAULT;
37 }
38 }
39
40 static bool FromMojom(::blink::mojom::ReferrerPolicy policy, ::blink::WebRef errerPolicy* out)
41 {
42 switch (policy) {
43 case ::blink::mojom::ReferrerPolicy::ALWAYS:
44 *out = ::blink::WebReferrerPolicyAlways;
45 return true;
46 case ::blink::mojom::ReferrerPolicy::DEFAULT:
47 *out = ::blink::WebReferrerPolicyDefault;
48 return true;
49 case ::blink::mojom::ReferrerPolicy::NO_REFERRER_WHEN_DOWNGRADE:
50 *out = ::blink::WebReferrerPolicyNoReferrerWhenDowngrade;
51 return true;
52 case ::blink::mojom::ReferrerPolicy::NEVER:
53 *out = ::blink::WebReferrerPolicyNever;
54 return true;
55 case ::blink::mojom::ReferrerPolicy::ORIGIN:
56 *out = ::blink::WebReferrerPolicyOrigin;
57 return true;
58 case ::blink::mojom::ReferrerPolicy::ORIGIN_WHEN_CROSS_ORIGIN:
59 *out = ::blink::WebReferrerPolicyOriginWhenCrossOrigin;
60 return true;
61 case ::blink::mojom::ReferrerPolicy::NO_REFERRER_WHEN_DOWNGRADE_ORIGIN_W HEN_CROSS_ORIGIN:
62 *out = ::blink::WebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCr ossOrigin;
63 return true;
64 default:
65 NOTREACHED();
66 return false;
67 }
68 }
69 };
70
71 } // namespace mojo
72
73 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/public/platform/OWNERS ('k') | third_party/WebKit/public/platform/referrer.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698