Add BrowserWindow.inspectElement(x, y) API.

This commit is contained in:
Cheng Zhao 2013-07-18 19:21:25 +08:00
parent 4ddd1bccb4
commit d59fb55a81
4 changed files with 22 additions and 0 deletions

View file

@ -16,6 +16,7 @@
#include "browser/atom_javascript_dialog_manager.h"
#include "browser/media/media_stream_devices_controller.h"
#include "browser/window_list.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/invalidate_type.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_details.h"
@ -135,6 +136,14 @@ void NativeWindow::CloseDevTools() {
inspectable_web_contents()->GetView()->CloseDevTools();
}
void NativeWindow::InspectElement(int x, int y) {
OpenDevTools();
content::RenderViewHost* rvh = GetWebContents()->GetRenderViewHost();
scoped_refptr<content::DevToolsAgentHost> agent(
content::DevToolsAgentHost::GetOrCreateFor(rvh));
agent->InspectElement(x, y);
}
void NativeWindow::FocusOnWebView() {
GetWebContents()->GetRenderViewHost()->Focus();
}