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

Side by Side Diff: chrome/browser/devtools/devtools_window.h

Issue 2361613002: DevTools: untangle device discovery request from the devtools android bridge. (Closed)
Patch Set: for landing Created 4 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" 9 #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
10 #include "chrome/browser/devtools/devtools_toggle_action.h" 10 #include "chrome/browser/devtools/devtools_toggle_action.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // How to get pointer to the created window see comments for 70 // How to get pointer to the created window see comments for
71 // ToggleDevToolsWindow(). 71 // ToggleDevToolsWindow().
72 static void OpenDevToolsWindow(content::WebContents* inspected_web_contents, 72 static void OpenDevToolsWindow(content::WebContents* inspected_web_contents,
73 const DevToolsToggleAction& action); 73 const DevToolsToggleAction& action);
74 74
75 // Open or reveal DevTools window, with no special action. 75 // Open or reveal DevTools window, with no special action.
76 // How to get pointer to the created window see comments for 76 // How to get pointer to the created window see comments for
77 // ToggleDevToolsWindow(). 77 // ToggleDevToolsWindow().
78 static void OpenDevToolsWindow(content::WebContents* inspected_web_contents); 78 static void OpenDevToolsWindow(content::WebContents* inspected_web_contents);
79 79
80 // Open or reveal DevTools window. This window will be undocked. 80 // Open or reveal DevTools window, with no special action. Use |profile| to
81 // open client window in, default to |host|'s profile if none given.
81 static void OpenDevToolsWindow( 82 static void OpenDevToolsWindow(
82 Profile* profile, 83 scoped_refptr<content::DevToolsAgentHost> host,
83 const scoped_refptr<content::DevToolsAgentHost>& agent_host); 84 Profile* profile);
84 85
85 // Perform specified action for current WebContents inside a |browser|. 86 // Perform specified action for current WebContents inside a |browser|.
86 // This may close currently open DevTools window. 87 // This may close currently open DevTools window.
87 // If DeveloperToolsDisabled policy is set, no DevTools window created. 88 // If DeveloperToolsDisabled policy is set, no DevTools window created.
88 // In case if needed pointer to the created window one should use 89 // In case if needed pointer to the created window one should use
89 // DevToolsAgentHost and DevToolsWindow::FindDevToolsWindow(). E.g.: 90 // DevToolsAgentHost and DevToolsWindow::FindDevToolsWindow(). E.g.:
90 // 91 //
91 // scoped_refptr<content::DevToolsAgentHost> agent( 92 // scoped_refptr<content::DevToolsAgentHost> agent(
92 // content::DevToolsAgentHost::GetOrCreateFor(inspected_web_contents)); 93 // content::DevToolsAgentHost::GetOrCreateFor(inspected_web_contents));
93 // DevToolsWindow::ToggleDevToolsWindow( 94 // DevToolsWindow::ToggleDevToolsWindow(
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 content::WebContents* GetInspectedWebContents(); 211 content::WebContents* GetInspectedWebContents();
211 212
212 private: 213 private:
213 friend class DevToolsWindowTesting; 214 friend class DevToolsWindowTesting;
214 friend class DevToolsWindowCreationObserver; 215 friend class DevToolsWindowCreationObserver;
215 216
216 using CreationCallback = base::Callback<void(DevToolsWindow*)>; 217 using CreationCallback = base::Callback<void(DevToolsWindow*)>;
217 static void AddCreationCallbackForTest(const CreationCallback& callback); 218 static void AddCreationCallbackForTest(const CreationCallback& callback);
218 static void RemoveCreationCallbackForTest(const CreationCallback& callback); 219 static void RemoveCreationCallbackForTest(const CreationCallback& callback);
219 220
221 static void OpenDevToolsWindowForFrame(
222 Profile* profile,
223 const scoped_refptr<content::DevToolsAgentHost>& agent_host);
224
220 // DevTools lifecycle typically follows this way: 225 // DevTools lifecycle typically follows this way:
221 // - Toggle/Open: client call; 226 // - Toggle/Open: client call;
222 // - Create; 227 // - Create;
223 // - ScheduleShow: setup window to be functional, but not yet show; 228 // - ScheduleShow: setup window to be functional, but not yet show;
224 // - DocumentOnLoadCompletedInMainFrame: frontend loaded; 229 // - DocumentOnLoadCompletedInMainFrame: frontend loaded;
225 // - SetIsDocked: frontend decided on docking state; 230 // - SetIsDocked: frontend decided on docking state;
226 // - OnLoadCompleted: ready to present frontend; 231 // - OnLoadCompleted: ready to present frontend;
227 // - Show: actually placing frontend WebContents to a Browser or docked place; 232 // - Show: actually placing frontend WebContents to a Browser or docked place;
228 // - DoAction: perform action passed in Toggle/Open; 233 // - DoAction: perform action passed in Toggle/Open;
229 // - ...; 234 // - ...;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 SkColor color, 302 SkColor color,
298 const std::vector<content::ColorSuggestion>& suggestions) override; 303 const std::vector<content::ColorSuggestion>& suggestions) override;
299 void RunFileChooser(content::RenderFrameHost* render_frame_host, 304 void RunFileChooser(content::RenderFrameHost* render_frame_host,
300 const content::FileChooserParams& params) override; 305 const content::FileChooserParams& params) override;
301 bool PreHandleGestureEvent(content::WebContents* source, 306 bool PreHandleGestureEvent(content::WebContents* source,
302 const blink::WebGestureEvent& event) override; 307 const blink::WebGestureEvent& event) override;
303 308
304 // content::DevToolsUIBindings::Delegate overrides 309 // content::DevToolsUIBindings::Delegate overrides
305 void ActivateWindow() override; 310 void ActivateWindow() override;
306 void CloseWindow() override; 311 void CloseWindow() override;
312 void Inspect(scoped_refptr<content::DevToolsAgentHost> host) override;
307 void SetInspectedPageBounds(const gfx::Rect& rect) override; 313 void SetInspectedPageBounds(const gfx::Rect& rect) override;
308 void InspectElementCompleted() override; 314 void InspectElementCompleted() override;
309 void SetIsDocked(bool is_docked) override; 315 void SetIsDocked(bool is_docked) override;
310 void OpenInNewTab(const std::string& url) override; 316 void OpenInNewTab(const std::string& url) override;
311 void SetWhitelistedShortcuts(const std::string& message) override; 317 void SetWhitelistedShortcuts(const std::string& message) override;
312 void InspectedContentsClosing() override; 318 void InspectedContentsClosing() override;
313 void OnLoadCompleted() override; 319 void OnLoadCompleted() override;
314 void ReadyForTest() override; 320 void ReadyForTest() override;
315 InfoBarService* GetInfoBarService() override; 321 InfoBarService* GetInfoBarService() override;
316 void RenderProcessGone(bool crashed) override; 322 void RenderProcessGone(bool crashed) override;
(...skipping 28 matching lines...) Expand all
345 base::Closure ready_for_test_callback_; 351 base::Closure ready_for_test_callback_;
346 352
347 base::TimeTicks inspect_element_start_time_; 353 base::TimeTicks inspect_element_start_time_;
348 std::unique_ptr<DevToolsEventForwarder> event_forwarder_; 354 std::unique_ptr<DevToolsEventForwarder> event_forwarder_;
349 355
350 friend class DevToolsEventForwarder; 356 friend class DevToolsEventForwarder;
351 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); 357 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow);
352 }; 358 };
353 359
354 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ 360 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698