OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/frame_owner_properties.h" | 5 #include "content/common/frame_owner_properties.h" |
6 | 6 |
7 namespace content { | 7 namespace content { |
8 | 8 |
9 FrameOwnerProperties::FrameOwnerProperties() | 9 FrameOwnerProperties::FrameOwnerProperties() |
10 : scrolling_mode(blink::WebFrameOwnerProperties::ScrollingMode::Auto), | 10 : scrolling_mode(blink::WebFrameOwnerProperties::ScrollingMode::Auto), |
11 margin_width(-1), | 11 margin_width(-1), |
12 margin_height(-1), | 12 margin_height(-1), |
13 allow_fullscreen(false), | 13 allow_fullscreen(false), |
14 allow_payment_request(false) {} | 14 allow_payment_request(false) {} |
15 | 15 |
16 FrameOwnerProperties::FrameOwnerProperties(const FrameOwnerProperties& other) = | 16 FrameOwnerProperties::FrameOwnerProperties(const FrameOwnerProperties& other) = |
17 default; | 17 default; |
18 | 18 |
19 FrameOwnerProperties::FrameOwnerProperties( | |
20 const blink::WebFrameOwnerProperties& web_frame_owner_properties) | |
21 : name(web_frame_owner_properties.name.utf8()), | |
22 scrolling_mode(web_frame_owner_properties.scrollingMode), | |
23 margin_width(web_frame_owner_properties.marginWidth), | |
24 margin_height(web_frame_owner_properties.marginHeight), | |
25 allow_fullscreen(web_frame_owner_properties.allowFullscreen), | |
26 allow_payment_request(web_frame_owner_properties.allowPaymentRequest), | |
27 required_csp(web_frame_owner_properties.requiredCsp.utf8()), | |
28 delegated_permissions( | |
29 web_frame_owner_properties.delegatedPermissions.begin(), | |
30 web_frame_owner_properties.delegatedPermissions.end()) {} | |
31 | |
32 FrameOwnerProperties::~FrameOwnerProperties() {} | 19 FrameOwnerProperties::~FrameOwnerProperties() {} |
33 | 20 |
34 blink::WebFrameOwnerProperties FrameOwnerProperties::ToWebFrameOwnerProperties() | |
35 const { | |
36 blink::WebFrameOwnerProperties result; | |
37 | |
38 result.name = blink::WebString::fromUTF8(name); | |
39 result.scrollingMode = scrolling_mode; | |
40 result.marginWidth = margin_width; | |
41 result.marginHeight = margin_height; | |
42 result.allowFullscreen = allow_fullscreen; | |
43 result.allowPaymentRequest = allow_payment_request; | |
44 result.requiredCsp = blink::WebString::fromUTF8(required_csp); | |
45 result.delegatedPermissions = | |
46 blink::WebVector<blink::mojom::PermissionName>(delegated_permissions); | |
47 | |
48 return result; | |
49 } | |
50 | |
51 bool FrameOwnerProperties::operator==(const FrameOwnerProperties& other) const { | 21 bool FrameOwnerProperties::operator==(const FrameOwnerProperties& other) const { |
52 return name == other.name && | 22 return name == other.name && |
53 scrolling_mode == other.scrolling_mode && | 23 scrolling_mode == other.scrolling_mode && |
54 margin_width == other.margin_width && | 24 margin_width == other.margin_width && |
55 margin_height == other.margin_height && | 25 margin_height == other.margin_height && |
56 allow_fullscreen == other.allow_fullscreen && | 26 allow_fullscreen == other.allow_fullscreen && |
57 allow_payment_request == other.allow_payment_request && | 27 allow_payment_request == other.allow_payment_request && |
58 required_csp == other.required_csp && | 28 required_csp == other.required_csp && |
59 std::equal(delegated_permissions.begin(), delegated_permissions.end(), | 29 std::equal(delegated_permissions.begin(), delegated_permissions.end(), |
60 other.delegated_permissions.begin()); | 30 other.delegated_permissions.begin()); |
61 } | 31 } |
62 | 32 |
63 } // namespace content | 33 } // namespace content |
OLD | NEW |