OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_HTML_VIEWER_HTML_FRAME_PROPERTIES_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_HTML_FRAME_PROPERTIES_H_ |
6 #define COMPONENTS_HTML_VIEWER_HTML_FRAME_PROPERTIES_H_ | 6 #define COMPONENTS_HTML_VIEWER_HTML_FRAME_PROPERTIES_H_ |
7 | 7 |
8 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" | 8 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" |
9 #include "third_party/mojo/src/mojo/public/cpp/bindings/map.h" | 9 #include "third_party/mojo/src/mojo/public/cpp/bindings/map.h" |
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h" | 10 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 class WebFrame; | 13 class WebFrame; |
| 14 struct WebFrameOwnerProperties; |
14 enum class WebSandboxFlags : int; | 15 enum class WebSandboxFlags : int; |
15 class WebString; | 16 class WebString; |
16 enum class WebTreeScopeType; | 17 enum class WebTreeScopeType; |
17 } | 18 } |
18 | 19 |
19 namespace url { | 20 namespace url { |
20 class Origin; | 21 class Origin; |
21 } | 22 } |
22 | 23 |
23 // Functions used to communicate html specific state for each frame. | 24 // Functions used to communicate html specific state for each frame. |
24 namespace html_viewer { | 25 namespace html_viewer { |
25 | 26 |
26 // Keys used for client properties. | 27 // Keys used for client properties. |
27 extern const char kPropertyFrameName[]; | 28 extern const char kPropertyFrameName[]; |
28 extern const char kPropertyFrameOrigin[]; | 29 extern const char kPropertyFrameOrigin[]; |
29 extern const char kPropertyFrameSandboxFlags[]; | 30 extern const char kPropertyFrameSandboxFlags[]; |
30 extern const char kPropertyFrameTreeScope[]; | 31 extern const char kPropertyFrameTreeScope[]; |
| 32 extern const char kPropertyFrameOwnerProperties[]; |
31 | 33 |
32 mojo::Array<uint8_t> FrameNameToClientProperty(const blink::WebString& name); | 34 mojo::Array<uint8_t> FrameNameToClientProperty(const blink::WebString& name); |
33 blink::WebString FrameNameFromClientProperty( | 35 blink::WebString FrameNameFromClientProperty( |
34 const mojo::Array<uint8_t>& new_data); | 36 const mojo::Array<uint8_t>& new_data); |
35 | 37 |
36 mojo::Array<uint8_t> FrameTreeScopeToClientProperty( | 38 mojo::Array<uint8_t> FrameTreeScopeToClientProperty( |
37 blink::WebTreeScopeType scope_type); | 39 blink::WebTreeScopeType scope_type); |
38 bool FrameTreeScopeFromClientProperty(const mojo::Array<uint8_t>& new_data, | 40 bool FrameTreeScopeFromClientProperty(const mojo::Array<uint8_t>& new_data, |
39 blink::WebTreeScopeType* scope); | 41 blink::WebTreeScopeType* scope); |
40 | 42 |
41 mojo::Array<uint8_t> FrameSandboxFlagsToClientProperty( | 43 mojo::Array<uint8_t> FrameSandboxFlagsToClientProperty( |
42 blink::WebSandboxFlags flags); | 44 blink::WebSandboxFlags flags); |
43 bool FrameSandboxFlagsFromClientProperty(const mojo::Array<uint8_t>& new_data, | 45 bool FrameSandboxFlagsFromClientProperty(const mojo::Array<uint8_t>& new_data, |
44 blink::WebSandboxFlags* flags); | 46 blink::WebSandboxFlags* flags); |
45 | 47 |
| 48 mojo::Array<uint8_t> FrameOwnerPropertiesToClientProperty( |
| 49 const blink::WebFrameOwnerProperties& owner_properties); |
| 50 |
46 url::Origin FrameOrigin(blink::WebFrame* frame); | 51 url::Origin FrameOrigin(blink::WebFrame* frame); |
47 mojo::Array<uint8_t> FrameOriginToClientProperty(blink::WebFrame* frame); | 52 mojo::Array<uint8_t> FrameOriginToClientProperty(blink::WebFrame* frame); |
48 url::Origin FrameOriginFromClientProperty(const mojo::Array<uint8_t>& data); | 53 url::Origin FrameOriginFromClientProperty(const mojo::Array<uint8_t>& data); |
| 54 bool FrameOwnerPropertiesFromClientProperty( |
| 55 const mojo::Array<uint8_t>& data, |
| 56 blink::WebFrameOwnerProperties* owner_properties); |
49 | 57 |
50 // Convenience to add |value| to |client_properties| if non-null. | 58 // Convenience to add |value| to |client_properties| if non-null. |
51 void AddToClientPropertiesIfValid( | 59 void AddToClientPropertiesIfValid( |
52 const std::string& name, | 60 const std::string& name, |
53 mojo::Array<uint8_t> value, | 61 mojo::Array<uint8_t> value, |
54 mojo::Map<mojo::String, mojo::Array<uint8_t>>* client_properties); | 62 mojo::Map<mojo::String, mojo::Array<uint8_t>>* client_properties); |
55 | 63 |
56 // Returns |properties[name]| if exists, otherwise a null array. | 64 // Returns |properties[name]| if exists, otherwise a null array. |
57 mojo::Array<uint8_t> GetValueFromClientProperties( | 65 mojo::Array<uint8_t> GetValueFromClientProperties( |
58 const std::string& name, | 66 const std::string& name, |
59 const mojo::Map<mojo::String, mojo::Array<uint8_t>>& properties); | 67 const mojo::Map<mojo::String, mojo::Array<uint8_t>>& properties); |
60 | 68 |
61 } // namespace html_viewer | 69 } // namespace html_viewer |
62 | 70 |
63 #endif // COMPONENTS_HTML_VIEWER_HTML_FRAME_PROPERTIES_H_ | 71 #endif // COMPONENTS_HTML_VIEWER_HTML_FRAME_PROPERTIES_H_ |
OLD | NEW |