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_WEB_CONTENTS_IMPL_H_ | 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ |
6 #define HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ | 6 #define HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ |
7 | 7 |
| 8 #include "headless/public/headless_devtools_target.h" |
8 #include "headless/public/headless_web_contents.h" | 9 #include "headless/public/headless_web_contents.h" |
9 | 10 |
10 #include <memory> | 11 #include <memory> |
11 #include <unordered_map> | 12 #include <unordered_map> |
12 | 13 |
13 namespace aura { | 14 namespace aura { |
14 class Window; | 15 class Window; |
15 } | 16 } |
16 | 17 |
17 namespace content { | 18 namespace content { |
| 19 class BrowserContext; |
| 20 class DevToolsAgentHost; |
18 class WebContents; | 21 class WebContents; |
19 class BrowserContext; | |
20 } | 22 } |
21 | 23 |
22 namespace gfx { | 24 namespace gfx { |
23 class Size; | 25 class Size; |
24 } | 26 } |
25 | 27 |
26 namespace headless { | 28 namespace headless { |
| 29 class HeadlessDevToolsHostImpl; |
27 class WebContentsObserverAdapter; | 30 class WebContentsObserverAdapter; |
28 | 31 |
29 class HeadlessWebContentsImpl : public HeadlessWebContents { | 32 class HeadlessWebContentsImpl : public HeadlessWebContents, |
| 33 public HeadlessDevToolsTarget { |
30 public: | 34 public: |
31 HeadlessWebContentsImpl(content::BrowserContext* context, | 35 HeadlessWebContentsImpl(content::BrowserContext* context, |
32 aura::Window* parent_window, | 36 aura::Window* parent_window, |
33 const gfx::Size& initial_size); | 37 const gfx::Size& initial_size); |
34 ~HeadlessWebContentsImpl() override; | 38 ~HeadlessWebContentsImpl() override; |
35 | 39 |
36 // HeadlessWebContents implementation: | 40 // HeadlessWebContents implementation: |
37 void AddObserver(Observer* observer) override; | 41 void AddObserver(Observer* observer) override; |
38 void RemoveObserver(Observer* observer) override; | 42 void RemoveObserver(Observer* observer) override; |
| 43 HeadlessDevToolsTarget* GetDevToolsTarget() override; |
| 44 |
| 45 // HeadlessDevToolsTarget implementation: |
| 46 void AttachClient(HeadlessDevToolsClient* client) override; |
| 47 void DetachClient(HeadlessDevToolsClient* client) override; |
39 | 48 |
40 content::WebContents* web_contents() const; | 49 content::WebContents* web_contents() const; |
41 bool OpenURL(const GURL& url); | 50 bool OpenURL(const GURL& url); |
42 | 51 |
43 private: | 52 private: |
44 class Delegate; | 53 class Delegate; |
45 std::unique_ptr<Delegate> web_contents_delegate_; | 54 std::unique_ptr<Delegate> web_contents_delegate_; |
46 std::unique_ptr<content::WebContents> web_contents_; | 55 std::unique_ptr<content::WebContents> web_contents_; |
| 56 scoped_refptr<content::DevToolsAgentHost> agent_host_; |
47 | 57 |
48 using ObserverMap = | 58 using ObserverMap = |
49 std::unordered_map<HeadlessWebContents::Observer*, | 59 std::unordered_map<HeadlessWebContents::Observer*, |
50 std::unique_ptr<WebContentsObserverAdapter>>; | 60 std::unique_ptr<WebContentsObserverAdapter>>; |
51 ObserverMap observer_map_; | 61 ObserverMap observer_map_; |
52 | 62 |
53 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContentsImpl); | 63 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContentsImpl); |
54 }; | 64 }; |
55 | 65 |
56 } // namespace headless | 66 } // namespace headless |
57 | 67 |
58 #endif // HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ | 68 #endif // HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |