diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/debugger/devtools_manager.cc | 10 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_manager.h | 1 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_window.cc | 8 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_window.h | 1 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.cc | 6 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.h | 1 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 3 | ||||
-rw-r--r-- | chrome/renderer/devtools_client.cc | 3 |
8 files changed, 32 insertions, 1 deletions
diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc index 1f292b0..574e42c 100644 --- a/chrome/browser/debugger/devtools_manager.cc +++ b/chrome/browser/debugger/devtools_manager.cc @@ -93,6 +93,16 @@ void DevToolsManager::ForwardToDevToolsClient(RenderViewHost* inspected_rvh, client_host->SendMessageToClient(message); } +void DevToolsManager::ActivateWindow(RenderViewHost* client_rvh) { + DevToolsClientHost* client_host = FindOnwerDevToolsClientHost(client_rvh); + if (!client_host) { + return; + } + DevToolsWindow* window = client_host->AsDevToolsWindow(); + DCHECK(window); + window->Activate(); +} + void DevToolsManager::CloseWindow(RenderViewHost* client_rvh) { DevToolsClientHost* client_host = FindOnwerDevToolsClientHost(client_rvh); if (!client_host) { diff --git a/chrome/browser/debugger/devtools_manager.h b/chrome/browser/debugger/devtools_manager.h index af0d90e..5b6261c 100644 --- a/chrome/browser/debugger/devtools_manager.h +++ b/chrome/browser/debugger/devtools_manager.h @@ -47,6 +47,7 @@ class DevToolsManager : public DevToolsClientHost::CloseListener, void ForwardToDevToolsClient(RenderViewHost* inspected_rvh, const IPC::Message& message); + void ActivateWindow(RenderViewHost* client_rvn); void CloseWindow(RenderViewHost* client_rvn); void DockWindow(RenderViewHost* client_rvn); void UndockWindow(RenderViewHost* client_rvn); diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index ee57310a..144bb74 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -33,6 +33,7 @@ class FloatingWindow : public DevToolsWindow, FloatingWindow(Profile* profile); virtual ~FloatingWindow(); virtual void Show(); + virtual void Activate(); virtual void InspectedTabClosing(); // TabStripModelObserver implementation @@ -49,6 +50,7 @@ class DockedWindow : public DevToolsWindow, public: DockedWindow(Profile* profile, BrowserWindow* window); virtual ~DockedWindow(); + virtual void Activate() {} virtual void Show(); virtual void InspectedTabClosing(); @@ -216,6 +218,12 @@ FloatingWindow::FloatingWindow(Profile* profile) FloatingWindow::~FloatingWindow() { } +void FloatingWindow::Activate() { + if (!browser_->window()->IsActive()) { + browser_->window()->Activate(); + } +} + void FloatingWindow::Show() { browser_->window()->Show(); tab_contents_->view()->SetInitialFocus(); diff --git a/chrome/browser/debugger/devtools_window.h b/chrome/browser/debugger/devtools_window.h index 8538cda..b6d4236 100644 --- a/chrome/browser/debugger/devtools_window.h +++ b/chrome/browser/debugger/devtools_window.h @@ -32,6 +32,7 @@ class DevToolsWindow : public DevToolsClientHost, public NotificationObserver { virtual ~DevToolsWindow(); virtual void Show() = 0; + virtual void Activate() = 0; bool is_docked() { return docked_; }; RenderViewHost* GetRenderViewHost(); diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 82182db..e790b44 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -719,6 +719,8 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { OnForwardToDevToolsAgent); IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsClient, OnForwardToDevToolsClient); + IPC_MESSAGE_HANDLER(ViewHostMsg_ActivateDevToolsWindow, + OnActivateDevToolsWindow); IPC_MESSAGE_HANDLER(ViewHostMsg_CloseDevToolsWindow, OnCloseDevToolsWindow); IPC_MESSAGE_HANDLER(ViewHostMsg_DockDevToolsWindow, @@ -1200,6 +1202,10 @@ void RenderViewHost::OnForwardToDevToolsClient(const IPC::Message& message) { DevToolsManager::GetInstance()->ForwardToDevToolsClient(this, message); } +void RenderViewHost::OnActivateDevToolsWindow() { + DevToolsManager::GetInstance()->ActivateWindow(this); +} + void RenderViewHost::OnCloseDevToolsWindow() { DevToolsManager::GetInstance()->CloseWindow(this); } diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index b932e1c..b8487cb 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -499,6 +499,7 @@ class RenderViewHost : public RenderWidgetHost { void OnUpdateInspectorSettings(const std::wstring& raw_settings); void OnForwardToDevToolsAgent(const IPC::Message& message); void OnForwardToDevToolsClient(const IPC::Message& message); + void OnActivateDevToolsWindow(); void OnCloseDevToolsWindow(); void OnDockDevToolsWindow(); void OnUndockDevToolsWindow(); diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 53dac3c..d04c3a5 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1101,6 +1101,9 @@ IPC_BEGIN_MESSAGES(ViewHost) IPC_MESSAGE_ROUTED1(ViewHostMsg_ForwardToDevToolsAgent, IPC::Message /* one of DevToolsAgentMsg_XXX types */) + // Activates (brings to the front) corresponding dev tools window. + IPC_MESSAGE_ROUTED0(ViewHostMsg_ActivateDevToolsWindow) + // Closes dev tools window that is inspecting current render_view_host. IPC_MESSAGE_ROUTED0(ViewHostMsg_CloseDevToolsWindow) diff --git a/chrome/renderer/devtools_client.cc b/chrome/renderer/devtools_client.cc index feca1a71..6d88ccd 100644 --- a/chrome/renderer/devtools_client.cc +++ b/chrome/renderer/devtools_client.cc @@ -48,7 +48,8 @@ void DevToolsClient::SendDebuggerCommandToAgent(const std::string& command) { } void DevToolsClient::ActivateWindow() { - render_view_->TakeFocus(render_view_->webview(), false); + render_view_->Send(new ViewHostMsg_ActivateDevToolsWindow( + render_view_->routing_id())); } void DevToolsClient::CloseWindow() { |