mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add support for DevTools inspect element via a new |inspect_element_at| parameter added to CefBrowserHost::ShowDevTools (issue #586).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1870 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -26,7 +26,8 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
CefRefPtr<CefBrowserHostImpl> inspected_browser,
|
||||
const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings) {
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
CefBrowserSettings new_settings = settings;
|
||||
if (CefColorGetA(new_settings.background_color) == 0) {
|
||||
// Use white as the default background color for DevTools instead of the
|
||||
@@ -40,12 +41,17 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
inspected_browser->GetWindowHandle(), true,
|
||||
inspected_browser->GetRequestContext());
|
||||
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host =
|
||||
content::DevToolsAgentHost::GetOrCreateFor(
|
||||
inspected_browser->GetWebContents());
|
||||
if (!inspect_element_at.IsEmpty())
|
||||
agent_host->InspectElement(inspect_element_at.x, inspect_element_at.y);
|
||||
|
||||
// CefDevToolsFrontend will delete itself when the frontend WebContents is
|
||||
// destroyed.
|
||||
CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend(
|
||||
static_cast<CefBrowserHostImpl*>(frontend_browser.get()),
|
||||
content::DevToolsAgentHost::GetOrCreateFor(
|
||||
inspected_browser->GetWebContents()).get());
|
||||
agent_host.get());
|
||||
|
||||
// Need to load the URL after creating the DevTools objects.
|
||||
CefDevToolsDelegate* delegate =
|
||||
|
Reference in New Issue
Block a user