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

Side by Side Diff: content/common/frame_owner_properties.cc

Issue 2378643002: Propagating csp attribute changes on frameOwnerPropertiesChanged() (Closed)
Patch Set: Enable Experimental switch 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
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 csp("") {}
Mike West 2016/09/29 08:58:53 I think the default initializer would be fine here
14 15
15 FrameOwnerProperties::FrameOwnerProperties(const FrameOwnerProperties& other) = 16 FrameOwnerProperties::FrameOwnerProperties(const FrameOwnerProperties& other) =
16 default; 17 default;
17 18
18 FrameOwnerProperties::FrameOwnerProperties( 19 FrameOwnerProperties::FrameOwnerProperties(
19 const blink::WebFrameOwnerProperties& web_frame_owner_properties) 20 const blink::WebFrameOwnerProperties& web_frame_owner_properties)
20 : scrolling_mode(web_frame_owner_properties.scrollingMode), 21 : scrolling_mode(web_frame_owner_properties.scrollingMode),
21 margin_width(web_frame_owner_properties.marginWidth), 22 margin_width(web_frame_owner_properties.marginWidth),
22 margin_height(web_frame_owner_properties.marginHeight), 23 margin_height(web_frame_owner_properties.marginHeight),
23 allow_fullscreen(web_frame_owner_properties.allowFullscreen), 24 allow_fullscreen(web_frame_owner_properties.allowFullscreen),
25 csp(web_frame_owner_properties.csp.utf8()),
24 delegated_permissions( 26 delegated_permissions(
25 web_frame_owner_properties.delegatedPermissions.begin(), 27 web_frame_owner_properties.delegatedPermissions.begin(),
26 web_frame_owner_properties.delegatedPermissions.end()) {} 28 web_frame_owner_properties.delegatedPermissions.end()) {}
27 29
28 FrameOwnerProperties::~FrameOwnerProperties() {} 30 FrameOwnerProperties::~FrameOwnerProperties() {}
29 31
30 blink::WebFrameOwnerProperties FrameOwnerProperties::ToWebFrameOwnerProperties() 32 blink::WebFrameOwnerProperties FrameOwnerProperties::ToWebFrameOwnerProperties()
31 const { 33 const {
32 blink::WebFrameOwnerProperties result; 34 blink::WebFrameOwnerProperties result;
33 35
34 result.scrollingMode = scrolling_mode; 36 result.scrollingMode = scrolling_mode;
35 result.marginWidth = margin_width; 37 result.marginWidth = margin_width;
36 result.marginHeight = margin_height; 38 result.marginHeight = margin_height;
37 result.allowFullscreen = allow_fullscreen; 39 result.allowFullscreen = allow_fullscreen;
40 result.csp = blink::WebString::fromUTF8(csp);
38 result.delegatedPermissions = 41 result.delegatedPermissions =
39 blink::WebVector<blink::WebPermissionType>(delegated_permissions); 42 blink::WebVector<blink::WebPermissionType>(delegated_permissions);
40 43
41 return result; 44 return result;
42 } 45 }
43 46
44 bool FrameOwnerProperties::operator==(const FrameOwnerProperties& other) const { 47 bool FrameOwnerProperties::operator==(const FrameOwnerProperties& other) const {
45 return scrolling_mode == other.scrolling_mode && 48 return scrolling_mode == other.scrolling_mode &&
46 margin_width == other.margin_width && 49 margin_width == other.margin_width &&
47 margin_height == other.margin_height && 50 margin_height == other.margin_height &&
48 allow_fullscreen == other.allow_fullscreen && 51 allow_fullscreen == other.allow_fullscreen &&
52 csp.compare(other.csp) == 0 &&
Mike West 2016/09/29 08:58:53 `==` should be fine here.
49 std::equal(delegated_permissions.begin(), delegated_permissions.end(), 53 std::equal(delegated_permissions.begin(), delegated_permissions.end(),
50 other.delegated_permissions.begin()); 54 other.delegated_permissions.begin());
51 } 55 }
52 56
53 } // namespace content 57 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698