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> |
11 #include <unordered_map> | 11 #include <unordered_map> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/optional.h" | 14 #include "base/optional.h" |
15 #include "headless/public/headless_export.h" | 15 #include "headless/public/headless_export.h" |
16 #include "headless/public/headless_web_contents.h" | 16 #include "headless/public/headless_web_contents.h" |
17 #include "net/base/host_port_pair.h" | 17 #include "net/base/host_port_pair.h" |
18 #include "net/url_request/url_request_job_factory.h" | 18 #include "net/url_request/url_request_job_factory.h" |
19 | 19 |
20 namespace base { | |
21 class FilePath; | |
22 } // namespace base | |
23 | |
24 namespace net { | |
25 class URLRequestContext; | |
26 } // namespace net | |
27 | |
20 namespace headless { | 28 namespace headless { |
21 class HeadlessBrowserImpl; | 29 class HeadlessBrowserImpl; |
22 class HeadlessBrowserContextOptions; | 30 class HeadlessBrowserContextOptions; |
23 | 31 |
24 using ProtocolHandlerMap = std::unordered_map< | 32 using ProtocolHandlerMap = std::unordered_map< |
25 std::string, | 33 std::string, |
26 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>>; | 34 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>>; |
27 | 35 |
28 // Represents an isolated session with a unique cache, cookies, and other | 36 // Represents an isolated session with a unique cache, cookies, and other |
29 // profile/session related data. | 37 // profile/session related data. |
(...skipping 18 matching lines...) Expand all Loading... | |
48 // See HeadlessBrowser::GetWebContentsForDevToolsAgentHostId. | 56 // See HeadlessBrowser::GetWebContentsForDevToolsAgentHostId. |
49 virtual HeadlessWebContents* GetWebContentsForDevToolsAgentHostId( | 57 virtual HeadlessWebContents* GetWebContentsForDevToolsAgentHostId( |
50 const std::string& devtools_agent_host_id) = 0; | 58 const std::string& devtools_agent_host_id) = 0; |
51 | 59 |
52 // Destroy this BrowserContext and all WebContents associated with it. | 60 // Destroy this BrowserContext and all WebContents associated with it. |
53 virtual void Close() = 0; | 61 virtual void Close() = 0; |
54 | 62 |
55 // GUID for this browser context. | 63 // GUID for this browser context. |
56 virtual const std::string& Id() const = 0; | 64 virtual const std::string& Id() const = 0; |
57 | 65 |
66 // Returns the URLRequestContext associated with this browser context. | |
67 virtual net::URLRequestContext* GetRequestContext() const = 0; | |
Sami
2016/09/23 14:27:29
Not needed anymore?
alex clarke (OOO till 29th)
2016/09/23 16:40:26
Good point, it's gone.
| |
68 | |
58 // TODO(skyostil): Allow saving and restoring contexts (crbug.com/617931). | 69 // TODO(skyostil): Allow saving and restoring contexts (crbug.com/617931). |
59 | 70 |
60 protected: | 71 protected: |
61 HeadlessBrowserContext() {} | 72 HeadlessBrowserContext() {} |
62 | 73 |
63 private: | 74 private: |
64 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContext); | 75 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContext); |
65 }; | 76 }; |
66 | 77 |
67 class HEADLESS_EXPORT HeadlessBrowserContext::Builder { | 78 class HEADLESS_EXPORT HeadlessBrowserContext::Builder { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 | 139 |
129 std::list<MojoBindings> mojo_bindings_; | 140 std::list<MojoBindings> mojo_bindings_; |
130 bool enable_http_and_https_if_mojo_used_; | 141 bool enable_http_and_https_if_mojo_used_; |
131 | 142 |
132 DISALLOW_COPY_AND_ASSIGN(Builder); | 143 DISALLOW_COPY_AND_ASSIGN(Builder); |
133 }; | 144 }; |
134 | 145 |
135 } // namespace headless | 146 } // namespace headless |
136 | 147 |
137 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ | 148 #endif // HEADLESS_PUBLIC_HEADLESS_BROWSER_CONTEXT_H_ |
OLD | NEW |