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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 class HEADLESS_EXPORT HeadlessBrowserContext::Builder { | 77 class HEADLESS_EXPORT HeadlessBrowserContext::Builder { |
78 public: | 78 public: |
79 Builder(Builder&&); | 79 Builder(Builder&&); |
80 ~Builder(); | 80 ~Builder(); |
81 | 81 |
82 // Set custom network protocol handlers. These can be used to override URL | 82 // Set custom network protocol handlers. These can be used to override URL |
83 // fetching for different network schemes. | 83 // fetching for different network schemes. |
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 // DEPRECATED. Specify JS mojo module bindings to be installed, one per mojom |
87 // Note a single mojom file could potentially define many interfaces. | 87 // file. 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 // TODO(alexclarke): Remove this. |
91 Builder& AddJsMojoBindings(const std::string& mojom_name, | 92 Builder& AddJsMojoBindings(const std::string& mojom_name, |
92 const std::string& js_bindings); | 93 const std::string& js_bindings); |
93 | 94 |
| 95 Builder& AddTabSocketMojoBindings(); |
| 96 |
94 // By default if you add mojo bindings, http and https are disabled because | 97 // 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 | 98 // 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 | 99 // 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 | 100 // 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. | 101 // framework which serves the web content from disk that's likely ok. |
99 // | 102 // |
100 // That said, best pratice is to add a ProtocolHandler to serve the | 103 // 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 | 104 // webcontent over a custom protocol. That way you can be sure that only the |
102 // things you intend have access to mojo. | 105 // things you intend have access to mojo. |
103 Builder& EnableUnsafeNetworkAccessWithMojoBindings( | 106 Builder& EnableUnsafeNetworkAccessWithMojoBindings( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 145 |
143 std::list<MojoBindings> mojo_bindings_; | 146 std::list<MojoBindings> mojo_bindings_; |
144 bool enable_http_and_https_if_mojo_used_; | 147 bool enable_http_and_https_if_mojo_used_; |
145 | 148 |
146 DISALLOW_COPY_AND_ASSIGN(Builder); | 149 DISALLOW_COPY_AND_ASSIGN(Builder); |
147 }; | 150 }; |
148 | 151 |
149 } // namespace headless | 152 } // namespace headless |
150 | 153 |
151 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ | 154 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ |
OLD | NEW |