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

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

Issue 2830753004: Pipe the devTools FrameId from blink into the browser for headless (Closed)
Patch Set: Changes for dgozman@ Created 3 years, 7 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
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>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 HeadlessBrowserImpl* browser() const; 93 HeadlessBrowserImpl* browser() const;
94 HeadlessBrowserContextImpl* browser_context() const; 94 HeadlessBrowserContextImpl* browser_context() const;
95 95
96 void set_window_tree_host(std::unique_ptr<HeadlessWindowTreeHost> host) { 96 void set_window_tree_host(std::unique_ptr<HeadlessWindowTreeHost> host) {
97 window_tree_host_ = std::move(host); 97 window_tree_host_ = std::move(host);
98 } 98 }
99 HeadlessWindowTreeHost* window_tree_host() const { 99 HeadlessWindowTreeHost* window_tree_host() const {
100 return window_tree_host_.get(); 100 return window_tree_host_.get();
101 } 101 }
102 102
103 // Returns the devtools frame id corresponding to the |frame_tree_node_id|, if
104 // any. Note this relies on an IPC sent from blink during navigation.
105 std::string GetUntrustedDevToolsFrameIdForFrameTreeNodeId(
106 int process_id,
107 int frame_tree_node_id) const;
108
109 int GetRenderProcessId() const;
Charlie Reis 2017/04/26 19:52:56 A WebContents can have multiple processes, so we s
alex clarke (OOO till 29th) 2017/04/27 08:49:44 Done.
110
103 private: 111 private:
104 // Takes ownership of |web_contents|. 112 // Takes ownership of |web_contents|.
105 HeadlessWebContentsImpl(content::WebContents* web_contents, 113 HeadlessWebContentsImpl(content::WebContents* web_contents,
106 HeadlessBrowserContextImpl* browser_context); 114 HeadlessBrowserContextImpl* browser_context);
107 115
108 void InitializeScreen(const gfx::Size& initial_size); 116 void InitializeScreen(const gfx::Size& initial_size);
109 using MojoService = HeadlessWebContents::Builder::MojoService; 117 using MojoService = HeadlessWebContents::Builder::MojoService;
110 118
111 std::unordered_map<content::RenderFrameHost*, std::string> 119 std::unordered_map<content::RenderFrameHost*, std::string>
112 render_frame_host_to_devtools_agent_host_id_; 120 render_frame_host_to_devtools_agent_host_id_;
113 std::unordered_map<std::string, int> devtools_agent_id_to_frame_tree_node_id_; 121 std::unordered_map<std::string, int> devtools_agent_id_to_frame_tree_node_id_;
114 122
115 class Delegate; 123 class Delegate;
116 std::unique_ptr<Delegate> web_contents_delegate_; 124 std::unique_ptr<Delegate> web_contents_delegate_;
117 std::unique_ptr<HeadlessWindowTreeHost> window_tree_host_; 125 std::unique_ptr<HeadlessWindowTreeHost> window_tree_host_;
118 std::unique_ptr<content::WebContents> web_contents_; 126 std::unique_ptr<content::WebContents> web_contents_;
119 scoped_refptr<content::DevToolsAgentHost> agent_host_; 127 scoped_refptr<content::DevToolsAgentHost> agent_host_;
120 std::list<MojoService> mojo_services_; 128 std::list<MojoService> mojo_services_;
121 std::unique_ptr<HeadlessTabSocketImpl> headless_tab_socket_; 129 std::unique_ptr<HeadlessTabSocketImpl> headless_tab_socket_;
122 130
123 HeadlessBrowserContextImpl* browser_context_; // Not owned. 131 HeadlessBrowserContextImpl* browser_context_; // Not owned.
124 content::RenderProcessHost* render_process_host_; // Not owned. 132 content::RenderProcessHost* render_process_host_; // Not owned.
Charlie Reis 2017/04/26 19:52:55 This has a similar problem. It looks like Headles
alex clarke (OOO till 29th) 2017/04/27 08:49:44 Acknowledged.
125 133
126 using ObserverMap = 134 using ObserverMap =
127 std::unordered_map<HeadlessWebContents::Observer*, 135 std::unordered_map<HeadlessWebContents::Observer*,
128 std::unique_ptr<WebContentsObserverAdapter>>; 136 std::unique_ptr<WebContentsObserverAdapter>>;
129 ObserverMap observer_map_; 137 ObserverMap observer_map_;
130 138
131 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContentsImpl); 139 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContentsImpl);
132 }; 140 };
133 141
134 } // namespace headless 142 } // namespace headless
135 143
136 #endif // HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ 144 #endif // HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698