Update V8 to version 4.6.61.
[chromium-blink-merge.git] / components / html_viewer / html_frame_properties.h
blobcc62a37efb38fae9d8fc020ec1e8a7c5f4160367
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_HTML_VIEWER_HTML_FRAME_PROPERTIES_H_
6 #define COMPONENTS_HTML_VIEWER_HTML_FRAME_PROPERTIES_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"
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
12 namespace blink {
13 class WebFrame;
14 enum class WebSandboxFlags : int;
15 class WebString;
16 enum class WebTreeScopeType;
19 namespace url {
20 class Origin;
23 // Functions used to communicate html specific state for each frame.
24 namespace html_viewer {
26 // Keys used for client properties.
27 extern const char kPropertyFrameName[];
28 extern const char kPropertyFrameOrigin[];
29 extern const char kPropertyFrameSandboxFlags[];
30 extern const char kPropertyFrameTreeScope[];
32 mojo::Array<uint8_t> FrameNameToClientProperty(const blink::WebString& name);
33 blink::WebString FrameNameFromClientProperty(
34 const mojo::Array<uint8_t>& new_data);
36 mojo::Array<uint8_t> FrameTreeScopeToClientProperty(
37 blink::WebTreeScopeType scope_type);
38 bool FrameTreeScopeFromClientProperty(const mojo::Array<uint8_t>& new_data,
39 blink::WebTreeScopeType* scope);
41 mojo::Array<uint8_t> FrameSandboxFlagsToClientProperty(
42 blink::WebSandboxFlags flags);
43 bool FrameSandboxFlagsFromClientProperty(const mojo::Array<uint8_t>& new_data,
44 blink::WebSandboxFlags* flags);
46 mojo::Array<uint8_t> FrameOriginToClientProperty(blink::WebFrame* frame);
47 url::Origin FrameOriginFromClientProperty(const mojo::Array<uint8_t>& data);
49 // Convenience to add |value| to |client_properties| if non-null.
50 void AddToClientPropertiesIfValid(
51 const std::string& name,
52 mojo::Array<uint8_t> value,
53 mojo::Map<mojo::String, mojo::Array<uint8_t>>* client_properties);
55 // Returns |properties[name]| if exists, otherwise a null array.
56 mojo::Array<uint8_t> GetValueFromClientProperties(
57 const std::string& name,
58 const mojo::Map<mojo::String, mojo::Array<uint8_t>>& properties);
60 } // namespace html_viewer
62 #endif // COMPONENTS_HTML_VIEWER_HTML_FRAME_PROPERTIES_H_