OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ | 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ |
6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ | 6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ |
7 | 7 |
8 #include "headless/public/headless_browser.h" | 8 #include "headless/public/headless_browser.h" |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 28 matching lines...) Expand all Loading... |
39 HeadlessWebContents* CreateWebContents(const GURL& initial_url, | 39 HeadlessWebContents* CreateWebContents(const GURL& initial_url, |
40 const gfx::Size& size) override; | 40 const gfx::Size& size) override; |
41 scoped_refptr<base::SingleThreadTaskRunner> BrowserMainThread() | 41 scoped_refptr<base::SingleThreadTaskRunner> BrowserMainThread() |
42 const override; | 42 const override; |
43 scoped_refptr<base::SingleThreadTaskRunner> BrowserFileThread() | 43 scoped_refptr<base::SingleThreadTaskRunner> BrowserFileThread() |
44 const override; | 44 const override; |
45 | 45 |
46 void Shutdown() override; | 46 void Shutdown() override; |
47 | 47 |
48 std::vector<HeadlessWebContents*> GetAllWebContents() override; | 48 std::vector<HeadlessWebContents*> GetAllWebContents() override; |
| 49 HeadlessWebContents* GetWebContentsForDevtoolsAgentHostId( |
| 50 const std::string& devtools_agent_host_id) override; |
49 | 51 |
50 void set_browser_main_parts(HeadlessBrowserMainParts* browser_main_parts); | 52 void set_browser_main_parts(HeadlessBrowserMainParts* browser_main_parts); |
51 HeadlessBrowserMainParts* browser_main_parts() const; | 53 HeadlessBrowserMainParts* browser_main_parts() const; |
52 | 54 |
53 void RunOnStartCallback(); | 55 void RunOnStartCallback(); |
54 | 56 |
55 HeadlessBrowser::Options* options() { return &options_; } | 57 HeadlessBrowser::Options* options() { return &options_; } |
56 | 58 |
57 HeadlessWebContents* CreateWebContents(HeadlessWebContents::Builder* builder); | 59 HeadlessWebContents* CreateWebContents(HeadlessWebContents::Builder* builder); |
58 HeadlessWebContentsImpl* RegisterWebContents( | 60 HeadlessWebContentsImpl* RegisterWebContents( |
59 std::unique_ptr<HeadlessWebContentsImpl> web_contents); | 61 std::unique_ptr<HeadlessWebContentsImpl> web_contents); |
60 | 62 |
61 // Close given |web_contents| and delete it. | 63 // Close given |web_contents| and delete it. |
62 void DestroyWebContents(HeadlessWebContentsImpl* web_contents); | 64 void DestroyWebContents(HeadlessWebContentsImpl* web_contents); |
63 | 65 |
64 // Customize the options used by this headless browser instance. Note that | 66 // Customize the options used by this headless browser instance. Note that |
65 // options which take effect before the message loop has been started (e.g., | 67 // options which take effect before the message loop has been started (e.g., |
66 // custom message pumps) cannot be set via this method. | 68 // custom message pumps) cannot be set via this method. |
67 void SetOptionsForTesting(HeadlessBrowser::Options options); | 69 void SetOptionsForTesting(HeadlessBrowser::Options options); |
68 | 70 |
69 protected: | 71 protected: |
70 base::Callback<void(HeadlessBrowser*)> on_start_callback_; | 72 base::Callback<void(HeadlessBrowser*)> on_start_callback_; |
71 HeadlessBrowser::Options options_; | 73 HeadlessBrowser::Options options_; |
72 HeadlessBrowserMainParts* browser_main_parts_; // Not owned. | 74 HeadlessBrowserMainParts* browser_main_parts_; // Not owned. |
73 std::unique_ptr<aura::WindowTreeHost> window_tree_host_; | 75 std::unique_ptr<aura::WindowTreeHost> window_tree_host_; |
74 std::unique_ptr<aura::client::WindowTreeClient> window_tree_client_; | 76 std::unique_ptr<aura::client::WindowTreeClient> window_tree_client_; |
75 | 77 |
76 std::unordered_map<HeadlessWebContents*, std::unique_ptr<HeadlessWebContents>> | 78 std::unordered_map<std::string, std::unique_ptr<HeadlessWebContents>> |
77 web_contents_; | 79 web_contents_map_; |
78 | 80 |
79 private: | 81 private: |
80 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserImpl); | 82 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserImpl); |
81 }; | 83 }; |
82 | 84 |
83 } // namespace headless | 85 } // namespace headless |
84 | 86 |
85 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ | 87 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ |
OLD | NEW |