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

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

Issue 972123003: Fixed behavior in case of disabled devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 "chrome/browser/devtools/devtools_contents_resizing_strategy.h" 8 #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
9 #include "chrome/browser/devtools/devtools_toggle_action.h" 9 #include "chrome/browser/devtools/devtools_toggle_action.h"
10 #include "chrome/browser/devtools/devtools_ui_bindings.h" 10 #include "chrome/browser/devtools/devtools_ui_bindings.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // presented in UI. 55 // presented in UI.
56 // If |out_strategy| is not NULL, it will contain resizing strategy. 56 // If |out_strategy| is not NULL, it will contain resizing strategy.
57 // For immediately-ready-to-use but maybe not yet fully initialized DevTools 57 // For immediately-ready-to-use but maybe not yet fully initialized DevTools
58 // use |GetInstanceForInspectedRenderViewHost| instead. 58 // use |GetInstanceForInspectedRenderViewHost| instead.
59 static content::WebContents* GetInTabWebContents( 59 static content::WebContents* GetInTabWebContents(
60 content::WebContents* inspected_tab, 60 content::WebContents* inspected_tab,
61 DevToolsContentsResizingStrategy* out_strategy); 61 DevToolsContentsResizingStrategy* out_strategy);
62 62
63 static bool IsDevToolsWindow(content::WebContents* web_contents); 63 static bool IsDevToolsWindow(content::WebContents* web_contents);
64 static DevToolsWindow* AsDevToolsWindow(content::WebContents* web_contents); 64 static DevToolsWindow* AsDevToolsWindow(content::WebContents* web_contents);
65 static DevToolsWindow* FindDevToolsWindow(content::DevToolsAgentHost*);
65 66
66 // Open or reveal DevTools window, and perform the specified action. 67 // Open or reveal DevTools window, and perform the specified action.
67 static DevToolsWindow* OpenDevToolsWindow( 68 // How to get pointer to the created window see comments for
68 content::WebContents* inspected_web_contents, 69 // ToggleDevToolsWindow().
69 const DevToolsToggleAction& action); 70 static void OpenDevToolsWindow(content::WebContents* inspected_web_contents,
71 const DevToolsToggleAction& action);
70 72
71 // Open or reveal DevTools window, with no special action. 73 // Open or reveal DevTools window, with no special action.
72 static DevToolsWindow* OpenDevToolsWindow( 74 // How to get pointer to the created window see comments for
73 content::WebContents* inspected_web_contents); 75 // ToggleDevToolsWindow().
76 static void OpenDevToolsWindow(content::WebContents* inspected_web_contents);
74 77
75 // Open or reveal DevTools window. This window will be undocked. 78 // Open or reveal DevTools window. This window will be undocked.
76 static DevToolsWindow* OpenDevToolsWindow( 79 static void OpenDevToolsWindow(
77 Profile* profile, 80 Profile* profile,
78 const scoped_refptr<content::DevToolsAgentHost>& agent_host); 81 const scoped_refptr<content::DevToolsAgentHost>& agent_host);
79 82
80 // Perform specified action for current WebContents inside a |browser|. 83 // Perform specified action for current WebContents inside a |browser|.
81 // This may close currently open DevTools window. 84 // This may close currently open DevTools window.
82 static DevToolsWindow* ToggleDevToolsWindow( 85 // If DeveloperToolsDisabled policy is set, no DevTools window created.
86 // In case if needed pointer to the created window one should use
87 // DevToolsAgentHost and DevToolsWindow::FindDevToolsWindow(). E.g.:
88 //
89 // scoped_refptr<content::DevToolsAgentHost> agent(
90 // content::DevToolsAgentHost::GetOrCreateFor(inspected_web_contents));
91 // DevToolsWindow::ToggleDevToolsWindow(
92 // inspected_web_contents, DevToolsToggleAction::Show());
93 // DevToolsWindow* window = DevToolsWindow::FindDevToolsWindow(agent.get());
94 //
95 static void ToggleDevToolsWindow(
83 Browser* browser, 96 Browser* browser,
84 const DevToolsToggleAction& action); 97 const DevToolsToggleAction& action);
85 98
86 // External frontend is always undocked. 99 // External frontend is always undocked.
87 static void OpenExternalFrontend( 100 static void OpenExternalFrontend(
88 Profile* profile, 101 Profile* profile,
89 const std::string& frontend_uri, 102 const std::string& frontend_uri,
90 const scoped_refptr<content::DevToolsAgentHost>& agent_host, 103 const scoped_refptr<content::DevToolsAgentHost>& agent_host,
91 bool isWorker); 104 bool isWorker);
92 105
93 // Worker frontend is always undocked. 106 // Worker frontend is always undocked.
94 static DevToolsWindow* OpenDevToolsWindowForWorker( 107 static void OpenDevToolsWindowForWorker(
95 Profile* profile, 108 Profile* profile,
96 const scoped_refptr<content::DevToolsAgentHost>& worker_agent); 109 const scoped_refptr<content::DevToolsAgentHost>& worker_agent);
97 110
98 static void InspectElement(content::WebContents* inspected_web_contents, 111 static void InspectElement(content::WebContents* inspected_web_contents,
99 int x, 112 int x,
100 int y); 113 int y);
101 114
102 // Sets closure to be called after load is done. If already loaded, calls 115 // Sets closure to be called after load is done. If already loaded, calls
103 // closure immediately. 116 // closure immediately.
104 void SetLoadCompletedCallback(const base::Closure& closure); 117 void SetLoadCompletedCallback(const base::Closure& closure);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 bool shared_worker_frontend, 234 bool shared_worker_frontend,
222 const std::string& remote_frontend, 235 const std::string& remote_frontend,
223 bool can_dock, 236 bool can_dock,
224 const std::string& settings); 237 const std::string& settings);
225 static GURL GetDevToolsURL(Profile* profile, 238 static GURL GetDevToolsURL(Profile* profile,
226 const GURL& base_url, 239 const GURL& base_url,
227 bool shared_worker_frontend, 240 bool shared_worker_frontend,
228 const std::string& remote_frontend, 241 const std::string& remote_frontend,
229 bool can_dock, 242 bool can_dock,
230 const std::string& settings); 243 const std::string& settings);
231 static DevToolsWindow* FindDevToolsWindow(content::DevToolsAgentHost*); 244
232 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); 245 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile);
233 static DevToolsWindow* ToggleDevToolsWindow( 246 static void ToggleDevToolsWindow(
234 content::WebContents* web_contents, 247 content::WebContents* web_contents,
235 bool force_open, 248 bool force_open,
236 const DevToolsToggleAction& action, 249 const DevToolsToggleAction& action,
237 const std::string& settings); 250 const std::string& settings);
238 251
239 // content::WebContentsDelegate: 252 // content::WebContentsDelegate:
240 void ActivateContents(content::WebContents* contents) override; 253 void ActivateContents(content::WebContents* contents) override;
241 void AddNewContents(content::WebContents* source, 254 void AddNewContents(content::WebContents* source,
242 content::WebContents* new_contents, 255 content::WebContents* new_contents,
243 WindowOpenDisposition disposition, 256 WindowOpenDisposition disposition,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 base::Closure close_callback_; 327 base::Closure close_callback_;
315 328
316 base::TimeTicks inspect_element_start_time_; 329 base::TimeTicks inspect_element_start_time_;
317 scoped_ptr<DevToolsEventForwarder> event_forwarder_; 330 scoped_ptr<DevToolsEventForwarder> event_forwarder_;
318 331
319 friend class DevToolsEventForwarder; 332 friend class DevToolsEventForwarder;
320 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); 333 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow);
321 }; 334 };
322 335
323 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ 336 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698