Index: content/shell/browser/webkit_test_controller.cc |
diff --git a/content/shell/browser/webkit_test_controller.cc b/content/shell/browser/webkit_test_controller.cc |
index 3712d32fe4759afd069aac557f05fea6c990e084..a4dc574151194b3024611ce5e074792ddbb36ffd 100644 |
--- a/content/shell/browser/webkit_test_controller.cc |
+++ b/content/shell/browser/webkit_test_controller.cc |
@@ -205,7 +205,8 @@ WebKitTestController::WebKitTestController() |
is_leak_detection_enabled_( |
base::CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnableLeakDetection)), |
- crash_when_leak_found_(false) { |
+ crash_when_leak_found_(false), |
+ devtools_frontend_(NULL) { |
CHECK(!instance_); |
instance_ = this; |
@@ -433,7 +434,9 @@ void WebKitTestController::RenderProcessGone(base::TerminationStatus status) { |
void WebKitTestController::DevToolsProcessCrashed() { |
DCHECK(CalledOnValidThread()); |
printer_->AddErrorMessage("#CRASHED - devtools"); |
- DiscardMainWindow(); |
+ if (devtools_frontend_) |
+ devtools_frontend_->Close(); |
+ devtools_frontend_ = NULL; |
} |
void WebKitTestController::WebContentsDestroyed() { |
@@ -586,11 +589,20 @@ void WebKitTestController::OnClearDevToolsLocalStorage() { |
void WebKitTestController::OnShowDevTools(const std::string& settings, |
const std::string& frontend_url) { |
- main_window_->ShowDevToolsForTest(settings, frontend_url); |
+ if (!devtools_frontend_) { |
+ devtools_frontend_ = LayoutTestDevToolsFrontend::Show( |
+ main_window_->web_contents(), settings, frontend_url); |
+ } else { |
+ devtools_frontend_->ReuseFrontend( |
+ main_window_->web_contents(), settings, frontend_url); |
+ } |
+ devtools_frontend_->Activate(); |
+ devtools_frontend_->Focus(); |
} |
void WebKitTestController::OnCloseDevTools() { |
- main_window_->CloseDevTools(); |
+ if (devtools_frontend_) |
+ devtools_frontend_->DisconnectFromTarget(); |
} |
void WebKitTestController::OnGoToOffset(int offset) { |
@@ -653,8 +665,10 @@ void WebKitTestController::OnCaptureSessionHistory() { |
void WebKitTestController::OnCloseRemainingWindows() { |
DevToolsAgentHost::DetachAllClients(); |
std::vector<Shell*> open_windows(Shell::windows()); |
+ Shell* devtools_shell = devtools_frontend_ ? |
+ devtools_frontend_->frontend_shell() : NULL; |
for (size_t i = 0; i < open_windows.size(); ++i) { |
- if (open_windows[i] != main_window_) |
+ if (open_windows[i] != main_window_ && open_windows[i] != devtools_shell) |
open_windows[i]->Close(); |
} |
base::MessageLoop::current()->RunUntilIdle(); |