diff options
-rw-r--r-- | chrome/browser/debugger/devtools_manager.cc | 4 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_manager.h | 4 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_window.cc | 19 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_window.h | 1 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.cc | 16 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.h | 4 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 4 | ||||
-rw-r--r-- | chrome/renderer/devtools_client.cc | 8 | ||||
-rw-r--r-- | chrome/renderer/devtools_client.h | 4 |
9 files changed, 38 insertions, 26 deletions
diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc index bceec77..2b89d8f 100644 --- a/chrome/browser/debugger/devtools_manager.cc +++ b/chrome/browser/debugger/devtools_manager.cc @@ -115,11 +115,11 @@ void DevToolsManager::CloseWindow(RenderViewHost* client_rvh) { CloseWindow(client_host); } -void DevToolsManager::DockWindow(RenderViewHost* client_rvh) { +void DevToolsManager::RequestDockWindow(RenderViewHost* client_rvh) { ReopenWindow(client_rvh, true); } -void DevToolsManager::UndockWindow(RenderViewHost* client_rvh) { +void DevToolsManager::RequestUndockWindow(RenderViewHost* client_rvh) { ReopenWindow(client_rvh, false); } diff --git a/chrome/browser/debugger/devtools_manager.h b/chrome/browser/debugger/devtools_manager.h index df7d454..c458928 100644 --- a/chrome/browser/debugger/devtools_manager.h +++ b/chrome/browser/debugger/devtools_manager.h @@ -50,8 +50,8 @@ class DevToolsManager : public DevToolsClientHost::CloseListener, void ActivateWindow(RenderViewHost* client_rvn); void CloseWindow(RenderViewHost* client_rvn); - void DockWindow(RenderViewHost* client_rvn); - void UndockWindow(RenderViewHost* client_rvn); + void RequestDockWindow(RenderViewHost* client_rvn); + void RequestUndockWindow(RenderViewHost* client_rvn); void OpenDevToolsWindow(RenderViewHost* inspected_rvh); void ToggleDevToolsWindow(RenderViewHost* inspected_rvh, bool open_console); diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index 90bbf212..ec0c1aa 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -121,6 +121,7 @@ void DevToolsWindow::Show(bool open_console) { if (inspected_window) { tab_contents_->set_delegate(this); inspected_window->UpdateDevTools(); + SetAttachedWindow(); tab_contents_->view()->SetInitialFocus(); return; } else { @@ -133,6 +134,7 @@ void DevToolsWindow::Show(bool open_console) { CreateDevToolsBrowser(); browser_->window()->Show(); + SetAttachedWindow(); tab_contents_->view()->SetInitialFocus(); if (open_console) { @@ -141,6 +143,7 @@ void DevToolsWindow::Show(bool open_console) { else open_console_on_load_ = true; } + } void DevToolsWindow::Activate() { @@ -159,6 +162,10 @@ void DevToolsWindow::SetDocked(bool docked) { if (docked_ == docked) { return; } + if (docked && !GetInspectedBrowserWindow()) { + // Cannot dock, avoid window flashing due to close-reopen cycle. + return; + } docked_ = docked; if (docked) { @@ -225,14 +232,18 @@ BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() { return NULL; } +void DevToolsWindow::SetAttachedWindow() { + tab_contents_->render_view_host()-> + ExecuteJavascriptInWebFrame( + L"", docked_ ? L"WebInspector.setAttachedWindow(true);" : + L"WebInspector.setAttachedWindow(false);"); +} + void DevToolsWindow::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { if (type == NotificationType::LOAD_STOP) { - tab_contents_->render_view_host()-> - ExecuteJavascriptInWebFrame( - L"", docked_ ? L"WebInspector.setAttachedWindow(true);" : - L"WebInspector.setAttachedWindow(false);"); + SetAttachedWindow(); is_loaded_ = true; if (open_console_on_load_) { OpenConsole(); diff --git a/chrome/browser/debugger/devtools_window.h b/chrome/browser/debugger/devtools_window.h index caa4418..2913090 100644 --- a/chrome/browser/debugger/devtools_window.h +++ b/chrome/browser/debugger/devtools_window.h @@ -52,6 +52,7 @@ class DevToolsWindow private: void CreateDevToolsBrowser(); BrowserWindow* GetInspectedBrowserWindow(); + void SetAttachedWindow(); // Overridden from NotificationObserver. virtual void Observe(NotificationType type, diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 35bfec5..47debf7 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -787,10 +787,10 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { OnActivateDevToolsWindow); IPC_MESSAGE_HANDLER(ViewHostMsg_CloseDevToolsWindow, OnCloseDevToolsWindow); - IPC_MESSAGE_HANDLER(ViewHostMsg_DockDevToolsWindow, - OnDockDevToolsWindow); - IPC_MESSAGE_HANDLER(ViewHostMsg_UndockDevToolsWindow, - OnUndockDevToolsWindow); + IPC_MESSAGE_HANDLER(ViewHostMsg_RequestDockDevToolsWindow, + OnRequestDockDevToolsWindow); + IPC_MESSAGE_HANDLER(ViewHostMsg_RequestUndockDevToolsWindow, + OnRequestUndockDevToolsWindow); IPC_MESSAGE_HANDLER(ViewHostMsg_DevToolsRuntimeFeatureStateChanged, OnDevToolsRuntimeFeatureStateChanged); IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, @@ -1445,12 +1445,12 @@ void RenderViewHost::OnCloseDevToolsWindow() { DevToolsManager::GetInstance()->CloseWindow(this); } -void RenderViewHost::OnDockDevToolsWindow() { - DevToolsManager::GetInstance()->DockWindow(this); +void RenderViewHost::OnRequestDockDevToolsWindow() { + DevToolsManager::GetInstance()->RequestDockWindow(this); } -void RenderViewHost::OnUndockDevToolsWindow() { - DevToolsManager::GetInstance()->UndockWindow(this); +void RenderViewHost::OnRequestUndockDevToolsWindow() { + DevToolsManager::GetInstance()->RequestUndockWindow(this); } void RenderViewHost::OnDevToolsRuntimeFeatureStateChanged( diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 3f8586d..e35a707 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -563,8 +563,8 @@ class RenderViewHost : public RenderWidgetHost { void OnForwardToDevToolsClient(const IPC::Message& message); void OnActivateDevToolsWindow(); void OnCloseDevToolsWindow(); - void OnDockDevToolsWindow(); - void OnUndockDevToolsWindow(); + void OnRequestDockDevToolsWindow(); + void OnRequestUndockDevToolsWindow(); void OnDevToolsRuntimeFeatureStateChanged(const std::string& feature, bool enabled); diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 6a5f1ac..5730588 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1566,10 +1566,10 @@ IPC_BEGIN_MESSAGES(ViewHost) IPC_MESSAGE_ROUTED0(ViewHostMsg_CloseDevToolsWindow) // Attaches dev tools window that is inspecting current render_view_host. - IPC_MESSAGE_ROUTED0(ViewHostMsg_DockDevToolsWindow) + IPC_MESSAGE_ROUTED0(ViewHostMsg_RequestDockDevToolsWindow) // Detaches dev tools window that is inspecting current render_view_host. - IPC_MESSAGE_ROUTED0(ViewHostMsg_UndockDevToolsWindow) + IPC_MESSAGE_ROUTED0(ViewHostMsg_RequestUndockDevToolsWindow) // Updates runtime features store in devtools manager in order to support // cross-navigation instrumentation. diff --git a/chrome/renderer/devtools_client.cc b/chrome/renderer/devtools_client.cc index 2ab162e..4aaea4b 100644 --- a/chrome/renderer/devtools_client.cc +++ b/chrome/renderer/devtools_client.cc @@ -71,13 +71,13 @@ void DevToolsClient::closeWindow() { render_view_->routing_id())); } -void DevToolsClient::dockWindow() { - render_view_->Send(new ViewHostMsg_DockDevToolsWindow( +void DevToolsClient::requestDockWindow() { + render_view_->Send(new ViewHostMsg_RequestDockDevToolsWindow( render_view_->routing_id())); } -void DevToolsClient::undockWindow() { - render_view_->Send(new ViewHostMsg_UndockDevToolsWindow( +void DevToolsClient::requestUndockWindow() { + render_view_->Send(new ViewHostMsg_RequestUndockDevToolsWindow( render_view_->routing_id())); } diff --git a/chrome/renderer/devtools_client.h b/chrome/renderer/devtools_client.h index c8eba9f..8b56884 100644 --- a/chrome/renderer/devtools_client.h +++ b/chrome/renderer/devtools_client.h @@ -46,8 +46,8 @@ class DevToolsClient : public WebKit::WebDevToolsFrontendClient { virtual void activateWindow(); virtual void closeWindow(); - virtual void dockWindow(); - virtual void undockWindow(); + virtual void requestDockWindow(); + virtual void requestUndockWindow(); private: void OnRpcMessage(const DevToolsMessageData& data); |