Chromium Code Reviews| Index: headless/lib/browser/headless_browser_context_impl.h |
| diff --git a/headless/lib/browser/headless_browser_context_impl.h b/headless/lib/browser/headless_browser_context_impl.h |
| index fae8f8a86334d1d0af05333ac7814af2491241e1..888df7ad9ce38aacaedbb9bd0a7e12830cc922ac 100644 |
| --- a/headless/lib/browser/headless_browser_context_impl.h |
| +++ b/headless/lib/browser/headless_browser_context_impl.h |
| @@ -6,28 +6,38 @@ |
| #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_CONTEXT_IMPL_H_ |
| #include <memory> |
| +#include <string> |
| +#include <unordered_map> |
| +#include <vector> |
| #include "base/files/file_path.h" |
| #include "content/public/browser/browser_context.h" |
| #include "content/public/browser/content_browser_client.h" |
| #include "content/public/browser/resource_context.h" |
| +#include "headless/lib/browser/headless_browser_context_options.h" |
| #include "headless/lib/browser/headless_url_request_context_getter.h" |
| #include "headless/public/headless_browser.h" |
| #include "headless/public/headless_browser_context.h" |
| namespace headless { |
| +class HeadlessBrowserImpl; |
| class HeadlessResourceContext; |
| +class HeadlessWebContentsImpl; |
| class HeadlessBrowserContextImpl : public HeadlessBrowserContext, |
| public content::BrowserContext { |
| public: |
| - explicit HeadlessBrowserContextImpl(ProtocolHandlerMap protocol_handlers, |
| - HeadlessBrowser::Options* options); |
| + HeadlessBrowserContextImpl(HeadlessBrowserImpl* browser, |
| + HeadlessBrowserContextOptions context_options); |
| ~HeadlessBrowserContextImpl() override; |
| static HeadlessBrowserContextImpl* From( |
| HeadlessBrowserContext* browser_context); |
| + // HeadlessBrowserContext implementation: |
| + HeadlessWebContents::Builder CreateWebContentsBuilder() override; |
| + std::vector<HeadlessWebContents*> GetAllWebContents() override; |
| + |
| // BrowserContext implementation: |
| std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( |
| const base::FilePath& partition_path) override; |
| @@ -54,19 +64,26 @@ class HeadlessBrowserContextImpl : public HeadlessBrowserContext, |
| const base::FilePath& partition_path, |
| bool in_memory) override; |
| - HeadlessBrowser::Options* options() const { return options_; } |
| - void SetOptionsForTesting(HeadlessBrowser::Options* options); |
| + void RegisterWebContents(HeadlessWebContentsImpl*); |
| + void UnregisterWebContents(HeadlessWebContentsImpl*); |
| + |
| + HeadlessBrowserImpl* browser() const; |
| private: |
| // Performs initialization of the HeadlessBrowserContextImpl while IO is still |
| // allowed on the current thread. |
| void InitWhileIOAllowed(); |
| - ProtocolHandlerMap protocol_handlers_; |
| - HeadlessBrowser::Options* options_; // Not owned. |
| + HeadlessBrowserImpl* browser_; // Not owned. |
| + HeadlessBrowserContextOptions context_options_; |
| std::unique_ptr<HeadlessResourceContext> resource_context_; |
| base::FilePath path_; |
| + // web contents are owned by |HeadlessBrowser|, here we are keeping track of |
|
alex clarke (OOO till 29th)
2016/08/03 11:55:19
nit: Web contents are owned by |HeadlessBrowser|,
altimin
2016/08/03 12:46:18
Done.
|
| + // contents corresponding to this context to delete them when context goes |
| + // away. |
| + std::unordered_map<std::string, HeadlessWebContents*> web_contents_map_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserContextImpl); |
| }; |