Make the DebugDevTools API more generic.

This commit is contained in:
Cheng Zhao 2014-03-04 14:35:35 +08:00
parent 1c07235121
commit d37bf06b5a
3 changed files with 18 additions and 16 deletions

View file

@ -101,6 +101,14 @@ NativeWindow* NativeWindow::Create(base::DictionaryValue* options) {
return Create(content::WebContents::Create(create_params), options);
}
// static
NativeWindow* NativeWindow::Debug(content::WebContents* web_contents) {
base::DictionaryValue options;
NativeWindow* window = NativeWindow::Create(&options);
window->devtools_delegate_.reset(new DevToolsDelegate(window, web_contents));
return window;
}
// static
NativeWindow* NativeWindow::FromRenderView(int process_id, int routing_id) {
// Stupid iterating.
@ -203,16 +211,6 @@ void NativeWindow::InspectElement(int x, int y) {
agent->InspectElement(x, y);
}
void NativeWindow::DebugDevTools() {
if (!IsDevToolsOpened())
return;
base::DictionaryValue options;
NativeWindow* window = NativeWindow::Create(&options);
window->devtools_delegate_.reset(new DevToolsDelegate(
window, GetDevToolsWebContents()));
}
void NativeWindow::FocusOnWebView() {
GetWebContents()->GetRenderViewHost()->Focus();
}