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

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

Issue 2896763002: Implement window management devtools commands for headless. (Closed)
Patch Set: nit and rebase 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 93
94 HeadlessBrowserImpl* browser() const; 94 HeadlessBrowserImpl* browser() const;
95 HeadlessBrowserContextImpl* browser_context() const; 95 HeadlessBrowserContextImpl* browser_context() const;
96 96
97 void set_window_tree_host(std::unique_ptr<HeadlessWindowTreeHost> host) { 97 void set_window_tree_host(std::unique_ptr<HeadlessWindowTreeHost> host) {
98 window_tree_host_ = std::move(host); 98 window_tree_host_ = std::move(host);
99 } 99 }
100 HeadlessWindowTreeHost* window_tree_host() const { 100 HeadlessWindowTreeHost* window_tree_host() const {
101 return window_tree_host_.get(); 101 return window_tree_host_.get();
102 } 102 }
103 int window_id() const { return window_id_; }
104 void set_window_state(const std::string& state) {
105 DCHECK(state == "normal" || state == "minimized" || state == "maximized" ||
106 state == "fullscreen");
107 window_state_ = state;
108 }
109 const std::string& window_state() const { return window_state_; }
103 110
104 private: 111 private:
105 // Takes ownership of |web_contents|. 112 // Takes ownership of |web_contents|.
106 HeadlessWebContentsImpl(content::WebContents* web_contents, 113 HeadlessWebContentsImpl(content::WebContents* web_contents,
107 HeadlessBrowserContextImpl* browser_context); 114 HeadlessBrowserContextImpl* browser_context);
108 115
109 void InitializeScreen(const gfx::Size& initial_size); 116 void InitializeScreen(const gfx::Size& initial_size);
110 using MojoService = HeadlessWebContents::Builder::MojoService; 117 using MojoService = HeadlessWebContents::Builder::MojoService;
111 118
112 class Delegate; 119 class Delegate;
113 std::unique_ptr<Delegate> web_contents_delegate_; 120 std::unique_ptr<Delegate> web_contents_delegate_;
114 std::unique_ptr<HeadlessWindowTreeHost> window_tree_host_; 121 std::unique_ptr<HeadlessWindowTreeHost> window_tree_host_;
122 int window_id_ = 0;
123 std::string window_state_;
115 std::unique_ptr<content::WebContents> web_contents_; 124 std::unique_ptr<content::WebContents> web_contents_;
116 scoped_refptr<content::DevToolsAgentHost> agent_host_; 125 scoped_refptr<content::DevToolsAgentHost> agent_host_;
117 std::list<MojoService> mojo_services_; 126 std::list<MojoService> mojo_services_;
118 bool inject_mojo_services_into_isolated_world_; 127 bool inject_mojo_services_into_isolated_world_;
119 std::unique_ptr<HeadlessTabSocketImpl> headless_tab_socket_; 128 std::unique_ptr<HeadlessTabSocketImpl> headless_tab_socket_;
120 129
121 HeadlessBrowserContextImpl* browser_context_; // Not owned. 130 HeadlessBrowserContextImpl* browser_context_; // Not owned.
122 // TODO(alexclarke): With OOPIF there may be more than one renderer, we need 131 // TODO(alexclarke): With OOPIF there may be more than one renderer, we need
123 // to fix this. See crbug.com/715924 132 // to fix this. See crbug.com/715924
124 content::RenderProcessHost* render_process_host_; // Not owned. 133 content::RenderProcessHost* render_process_host_; // Not owned.
125 134
126 using ObserverMap = 135 using ObserverMap =
127 std::unordered_map<HeadlessWebContents::Observer*, 136 std::unordered_map<HeadlessWebContents::Observer*,
128 std::unique_ptr<WebContentsObserverAdapter>>; 137 std::unique_ptr<WebContentsObserverAdapter>>;
129 ObserverMap observer_map_; 138 ObserverMap observer_map_;
130 139
131 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContentsImpl); 140 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContentsImpl);
132 }; 141 };
133 142
134 } // namespace headless 143 } // namespace headless
135 144
136 #endif // HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_ 145 #endif // HEADLESS_LIB_BROWSER_HEADLESS_WEB_CONTENTS_IMPL_H_
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_devtools_manager_delegate.cc ('k') | headless/lib/browser/headless_web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698