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 #ifndef HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ | 5 #ifndef HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ |
6 #define HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ | 6 #define HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 Builder& SetProtocolHandlers(ProtocolHandlerMap protocol_handlers); | 84 Builder& SetProtocolHandlers(ProtocolHandlerMap protocol_handlers); |
85 | 85 |
86 // Specify JS mojo module bindings to be installed, one per mojom file. | 86 // Specify JS mojo module bindings to be installed, one per mojom file. |
87 // Note a single mojom file could potentially define many interfaces. | 87 // Note a single mojom file could potentially define many interfaces. |
88 // |mojom_name| the name including path of the .mojom file. | 88 // |mojom_name| the name including path of the .mojom file. |
89 // |js_bindings| compiletime generated javascript bindings. Typically loaded | 89 // |js_bindings| compiletime generated javascript bindings. Typically loaded |
90 // from gen/path/name.mojom.js. | 90 // from gen/path/name.mojom.js. |
91 Builder& AddJsMojoBindings(const std::string& mojom_name, | 91 Builder& AddJsMojoBindings(const std::string& mojom_name, |
92 const std::string& js_bindings); | 92 const std::string& js_bindings); |
93 | 93 |
| 94 Builder& AddTabSocketMojoBindings(); |
| 95 |
94 // By default if you add mojo bindings, http and https are disabled because | 96 // By default if you add mojo bindings, http and https are disabled because |
95 // its almost certinly unsafe for arbitary sites on the internet to have | 97 // its almost certinly unsafe for arbitary sites on the internet to have |
96 // access to these bindings. If you know what you're doing it may be OK to | 98 // access to these bindings. If you know what you're doing it may be OK to |
97 // turn them back on. E.g. if headless_lib is being used in a testing | 99 // turn them back on. E.g. if headless_lib is being used in a testing |
98 // framework which serves the web content from disk that's likely ok. | 100 // framework which serves the web content from disk that's likely ok. |
99 // | 101 // |
100 // That said, best pratice is to add a ProtocolHandler to serve the | 102 // That said, best pratice is to add a ProtocolHandler to serve the |
101 // webcontent over a custom protocol. That way you can be sure that only the | 103 // webcontent over a custom protocol. That way you can be sure that only the |
102 // things you intend have access to mojo. | 104 // things you intend have access to mojo. |
103 Builder& EnableUnsafeNetworkAccessWithMojoBindings( | 105 Builder& EnableUnsafeNetworkAccessWithMojoBindings( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 144 |
143 std::list<MojoBindings> mojo_bindings_; | 145 std::list<MojoBindings> mojo_bindings_; |
144 bool enable_http_and_https_if_mojo_used_; | 146 bool enable_http_and_https_if_mojo_used_; |
145 | 147 |
146 DISALLOW_COPY_AND_ASSIGN(Builder); | 148 DISALLOW_COPY_AND_ASSIGN(Builder); |
147 }; | 149 }; |
148 | 150 |
149 } // namespace headless | 151 } // namespace headless |
150 | 152 |
151 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ | 153 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ |
OLD | NEW |