Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: headless/lib/browser/headless_web_contents_impl.h

Issue 2843773002: HeadlessWebContents Observers for devtools clients attaching/detatching (Closed)
Patch Set: Added a test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | headless/lib/browser/headless_web_contents_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <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 12
13 #include "content/public/browser/devtools_agent_host_observer.h"
13 #include "content/public/browser/render_process_host_observer.h" 14 #include "content/public/browser/render_process_host_observer.h"
14 #include "content/public/browser/web_contents_observer.h" 15 #include "content/public/browser/web_contents_observer.h"
15 #include "headless/lib/browser/headless_window_tree_host.h" 16 #include "headless/lib/browser/headless_window_tree_host.h"
16 #include "headless/public/headless_devtools_target.h" 17 #include "headless/public/headless_devtools_target.h"
17 #include "headless/public/headless_export.h" 18 #include "headless/public/headless_export.h"
18 #include "headless/public/headless_web_contents.h" 19 #include "headless/public/headless_web_contents.h"
19 20
20 namespace content { 21 namespace content {
21 class DevToolsAgentHost; 22 class DevToolsAgentHost;
22 class WebContents; 23 class WebContents;
23 } 24 }
24 25
25 namespace gfx { 26 namespace gfx {
26 class Size; 27 class Size;
27 } 28 }
28 29
29 namespace headless { 30 namespace headless {
30 class HeadlessBrowserImpl; 31 class HeadlessBrowserImpl;
31 class HeadlessTabSocketImpl; 32 class HeadlessTabSocketImpl;
32 class WebContentsObserverAdapter; 33 class WebContentsObserverAdapter;
33 34
34 // Exported for tests. 35 // Exported for tests.
35 class HEADLESS_EXPORT HeadlessWebContentsImpl 36 class HEADLESS_EXPORT HeadlessWebContentsImpl
36 : public HeadlessWebContents, 37 : public HeadlessWebContents,
37 public HeadlessDevToolsTarget, 38 public HeadlessDevToolsTarget,
39 public content::DevToolsAgentHostObserver,
38 public content::RenderProcessHostObserver, 40 public content::RenderProcessHostObserver,
39 public content::WebContentsObserver { 41 public content::WebContentsObserver {
40 public: 42 public:
41 ~HeadlessWebContentsImpl() override; 43 ~HeadlessWebContentsImpl() override;
42 44
43 static HeadlessWebContentsImpl* From(HeadlessWebContents* web_contents); 45 static HeadlessWebContentsImpl* From(HeadlessWebContents* web_contents);
44 46
45 static std::unique_ptr<HeadlessWebContentsImpl> Create( 47 static std::unique_ptr<HeadlessWebContentsImpl> Create(
46 HeadlessWebContents::Builder* builder); 48 HeadlessWebContents::Builder* builder);
47 49
(...skipping 10 matching lines...) Expand all
58 bool GetFrameTreeNodeIdForDevToolsAgentHostId( 60 bool GetFrameTreeNodeIdForDevToolsAgentHostId(
59 const std::string& devtools_agent_host_id, 61 const std::string& devtools_agent_host_id,
60 int* frame_tree_node_id) const override; 62 int* frame_tree_node_id) const override;
61 63
62 // HeadlessDevToolsTarget implementation: 64 // HeadlessDevToolsTarget implementation:
63 bool AttachClient(HeadlessDevToolsClient* client) override; 65 bool AttachClient(HeadlessDevToolsClient* client) override;
64 void ForceAttachClient(HeadlessDevToolsClient* client) override; 66 void ForceAttachClient(HeadlessDevToolsClient* client) override;
65 void DetachClient(HeadlessDevToolsClient* client) override; 67 void DetachClient(HeadlessDevToolsClient* client) override;
66 bool IsAttached() override; 68 bool IsAttached() override;
67 69
68 // RenderProcessHostObserver implementation: 70 // content::DevToolsAgentHostObserver implementation:
71 void DevToolsAgentHostAttached(
72 content::DevToolsAgentHost* agent_host) override;
73 void DevToolsAgentHostDetached(
74 content::DevToolsAgentHost* agent_host) override;
75
76 // content::RenderProcessHostObserver implementation:
69 void RenderProcessExited(content::RenderProcessHost* host, 77 void RenderProcessExited(content::RenderProcessHost* host,
70 base::TerminationStatus status, 78 base::TerminationStatus status,
71 int exit_code) override; 79 int exit_code) override;
72 void RenderProcessHostDestroyed(content::RenderProcessHost* host) override; 80 void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
73 81
74 // content::WebContentsObserver implementation: 82 // content::WebContentsObserver implementation:
75 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; 83 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
76 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; 84 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
77 85
78 content::WebContents* web_contents() const; 86 content::WebContents* web_contents() const;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 std::unordered_map<HeadlessWebContents::Observer*, 127 std::unordered_map<HeadlessWebContents::Observer*,
120 std::unique_ptr<WebContentsObserverAdapter>>; 128 std::unique_ptr<WebContentsObserverAdapter>>;
121 ObserverMap observer_map_; 129 ObserverMap observer_map_;
122 130
123 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContentsImpl); 131 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContentsImpl);
124 }; 132 };
125 133
126 } // namespace headless 134 } // namespace headless
127 135
128 #endif // HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ 136 #endif // HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | headless/lib/browser/headless_web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698