summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 10:32:33 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 10:32:33 +0000
commitfab0816e7a9ee2403d403bed6eb2b258c07ad306 (patch)
tree61d92e148490083ea673edfb3e0f0dcd684dec9e /chrome
parent195792b55d3c8ebd850fe22870f66f2883d68b87 (diff)
downloadchromium_src-fab0816e7a9ee2403d403bed6eb2b258c07ad306.zip
chromium_src-fab0816e7a9ee2403d403bed6eb2b258c07ad306.tar.gz
chromium_src-fab0816e7a9ee2403d403bed6eb2b258c07ad306.tar.bz2
DevTools: localize window title, append inspected tab url there.
Review URL: http://codereview.chromium.org/109014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15292 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd5
-rw-r--r--chrome/browser/debugger/devtools_client_host.h6
-rw-r--r--chrome/browser/debugger/devtools_manager.cc24
-rw-r--r--chrome/browser/debugger/devtools_manager.h5
-rw-r--r--chrome/browser/debugger/devtools_manager_unittest.cc3
-rw-r--r--chrome/browser/debugger/devtools_window_win.cc12
-rw-r--r--chrome/browser/debugger/devtools_window_win.h2
-rw-r--r--chrome/browser/debugger/inspectable_tab_proxy.cc4
-rw-r--r--chrome/browser/debugger/inspectable_tab_proxy.h1
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc3
10 files changed, 53 insertions, 12 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 5d892eb3..6ff9aeb 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -3499,6 +3499,11 @@ each locale. -->
JavaScript Debugger - Running
</message>
+ <!-- Developer Tools -->
+ <message name="IDS_DEVTOOLS_TITLE" desc="Default Developer Tools title bar">
+ Developer Tools - <ph name="URL">$1<ex>http://www.google.com</ex></ph>
+ </message>
+
<!-- Shortcut Modifiers -->
<message name="IDS_CONTROL_MODIFIER" desc="Control key shortcut modifier">
Ctrl+<ph name="KEY_COMBO_NAME">$1<ex>C</ex></ph>
diff --git a/chrome/browser/debugger/devtools_client_host.h b/chrome/browser/debugger/devtools_client_host.h
index 71534fb..7e1d67d 100644
--- a/chrome/browser/debugger/devtools_client_host.h
+++ b/chrome/browser/debugger/devtools_client_host.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_
#define CHROME_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_
+#include <string>
+
#include "base/basictypes.h"
namespace IPC {
@@ -33,6 +35,10 @@ class DevToolsClientHost {
// closing.
virtual void InspectedTabClosing() = 0;
+ // This method is called when tab inspected by this devtools client has
+ // navigated to some url.
+ virtual void SetInspectedTabUrl(const std::string& url) = 0;
+
// Sends the message to the devtools client hosted by this object.
virtual void SendMessageToClient(const IPC::Message& msg) = 0;
diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc
index 3ebfbd3..cf89d49 100644
--- a/chrome/browser/debugger/devtools_manager.cc
+++ b/chrome/browser/debugger/devtools_manager.cc
@@ -7,10 +7,12 @@
#include "chrome/browser/debugger/devtools_window.h"
#include "chrome/browser/debugger/devtools_client_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
+#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/devtools_messages.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_type.h"
+#include "googleurl/src/gurl.h"
DevToolsManager::DevToolsManager() : tab_contents_listeners_(NULL) {
}
@@ -63,7 +65,7 @@ void DevToolsManager::RegisterDevToolsClientHostFor(
client_host->set_close_listener(this);
StartListening(navigation_controller);
- SendAttachToAgent(tab_contents, tab_contents.render_view_host());
+ SendAttachToAgent(tab_contents.render_view_host());
}
void DevToolsManager::ForwardToDevToolsAgent(
@@ -153,7 +155,7 @@ void DevToolsManager::ClientHostClosing(DevToolsClientHost* host) {
if (!tab_contents) {
return;
}
- SendDetachToAgent(*tab_contents);
+ SendDetachToAgent(tab_contents->render_view_host());
UnregisterDevToolsClientHost(host, controller);
}
@@ -196,17 +198,25 @@ void DevToolsManager::StopListening(
}
}
-void DevToolsManager::SendAttachToAgent(const TabContents& wc,
- RenderViewHost* target_host) {
- if (GetDevToolsClientHostFor(wc) && target_host) {
+void DevToolsManager::OnNavigatingToPendingEntry(const TabContents& wc,
+ RenderViewHost* target_host) {
+ DevToolsClientHost* client_host = GetDevToolsClientHostFor(wc);
+ if (client_host) {
+ const NavigationEntry& entry = *wc.controller().pending_entry();
+ client_host->SetInspectedTabUrl(entry.url().possibly_invalid_spec());
+ SendAttachToAgent(target_host);
+ }
+}
+
+void DevToolsManager::SendAttachToAgent(RenderViewHost* target_host) {
+ if (target_host) {
IPC::Message* m = new DevToolsAgentMsg_Attach();
m->set_routing_id(target_host->routing_id());
target_host->Send(m);
}
}
-void DevToolsManager::SendDetachToAgent(const TabContents& wc) {
- RenderViewHost* target_host = wc.render_view_host();
+void DevToolsManager::SendDetachToAgent(RenderViewHost* target_host) {
if (target_host) {
IPC::Message* m = new DevToolsAgentMsg_Detach();
m->set_routing_id(target_host->routing_id());
diff --git a/chrome/browser/debugger/devtools_manager.h b/chrome/browser/debugger/devtools_manager.h
index 143b7f4..d29a6ea 100644
--- a/chrome/browser/debugger/devtools_manager.h
+++ b/chrome/browser/debugger/devtools_manager.h
@@ -55,7 +55,7 @@ class DevToolsManager : public NotificationObserver,
// Sends 'Attach' message to the agent using |target_host| in case
// there is a DevToolsClientHost registered for the |tab_contents|.
- void SendAttachToAgent(
+ void OnNavigatingToPendingEntry(
const TabContents& tab_contents,
RenderViewHost* target_host);
@@ -81,7 +81,8 @@ private:
NavigationController* navigation_controller);
void StartListening(NavigationController* navigation_controller);
void StopListening(NavigationController* navigation_controller);
- void SendDetachToAgent(const TabContents& tab_contents);
+ void SendAttachToAgent(RenderViewHost* target_host);
+ void SendDetachToAgent(RenderViewHost* target_host);
// This object is not NULL iff there is at least one registered
// DevToolsClientHost.
diff --git a/chrome/browser/debugger/devtools_manager_unittest.cc b/chrome/browser/debugger/devtools_manager_unittest.cc
index 6169f60..5744471 100644
--- a/chrome/browser/debugger/devtools_manager_unittest.cc
+++ b/chrome/browser/debugger/devtools_manager_unittest.cc
@@ -33,6 +33,9 @@ class TestDevToolsClientHost : public DevToolsClientHost {
Close();
}
+ virtual void SetInspectedTabUrl(const std::string& url) {
+ }
+
virtual void SendMessageToClient(const IPC::Message& message) {
last_sent_message = &message;
}
diff --git a/chrome/browser/debugger/devtools_window_win.cc b/chrome/browser/debugger/devtools_window_win.cc
index 25175f5..36ca327 100644
--- a/chrome/browser/debugger/devtools_window_win.cc
+++ b/chrome/browser/debugger/devtools_window_win.cc
@@ -7,8 +7,9 @@
#include "chrome/browser/debugger/devtools_manager.h"
#include "chrome/browser/debugger/devtools_view.h"
#include "chrome/browser/debugger/devtools_window.h"
+#include "chrome/common/l10n_util.h"
#include "chrome/views/window/window.h"
-
+#include "grit/generated_resources.h"
// static
DevToolsWindow* DevToolsWindow::Create() {
@@ -50,6 +51,13 @@ void DevToolsWindowWin::InspectedTabClosing() {
}
}
+void DevToolsWindowWin::SetInspectedTabUrl(const std::string& url) {
+ inspected_url_ = url;
+ if (window()) {
+ window()->UpdateWindowTitle();
+ }
+}
+
void DevToolsWindowWin::SendMessageToClient(const IPC::Message& message) {
if (tools_view_) {
tools_view_->SendMessageToClient(message);
@@ -57,7 +65,7 @@ void DevToolsWindowWin::SendMessageToClient(const IPC::Message& message) {
}
std::wstring DevToolsWindowWin::GetWindowTitle() const {
- return L"Developer Tools";
+ return l10n_util::GetStringF(IDS_DEVTOOLS_TITLE, UTF8ToWide(inspected_url_));
}
void DevToolsWindowWin::WindowClosing() {
diff --git a/chrome/browser/debugger/devtools_window_win.h b/chrome/browser/debugger/devtools_window_win.h
index 4cea5a3..066388d 100644
--- a/chrome/browser/debugger/devtools_window_win.h
+++ b/chrome/browser/debugger/devtools_window_win.h
@@ -25,6 +25,7 @@ class DevToolsWindowWin : public DevToolsWindow,
virtual bool HasRenderViewHost(const RenderViewHost& rvh) const;
virtual void InspectedTabClosing();
+ virtual void SetInspectedTabUrl(const std::string& url);
virtual void SendMessageToClient(const IPC::Message& message);
private:
@@ -39,6 +40,7 @@ class DevToolsWindowWin : public DevToolsWindow,
virtual void DeleteDelegate();
DevToolsView* tools_view_;
+ std::string inspected_url_;
DISALLOW_COPY_AND_ASSIGN(DevToolsWindowWin);
};
diff --git a/chrome/browser/debugger/inspectable_tab_proxy.cc b/chrome/browser/debugger/inspectable_tab_proxy.cc
index 48e0155..943a480 100644
--- a/chrome/browser/debugger/inspectable_tab_proxy.cc
+++ b/chrome/browser/debugger/inspectable_tab_proxy.cc
@@ -21,6 +21,10 @@ void DevToolsClientHostImpl::InspectedTabClosing() {
delete this;
}
+void DevToolsClientHostImpl::SetInspectedTabUrl(const std::string& url) {
+ //TODO(apavlov): Notify debugger on the url update.
+}
+
void DevToolsClientHostImpl::SendMessageToClient(
const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(DevToolsClientHostImpl, msg)
diff --git a/chrome/browser/debugger/inspectable_tab_proxy.h b/chrome/browser/debugger/inspectable_tab_proxy.h
index c47c4d5..23e1b11 100644
--- a/chrome/browser/debugger/inspectable_tab_proxy.h
+++ b/chrome/browser/debugger/inspectable_tab_proxy.h
@@ -70,6 +70,7 @@ class DevToolsClientHostImpl : public DevToolsClientHost {
// DevToolsClientHost interface
virtual void InspectedTabClosing();
+ virtual void SetInspectedTabUrl(const std::string& url);
virtual void SendMessageToClient(const IPC::Message& msg);
private:
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 2dec5dc..3712fc4 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -669,7 +669,8 @@ bool TabContents::NavigateToPendingEntry(bool reload) {
// Tell DevTools agent that it is attached prior to the navigation.
DevToolsManager* dev_tools_manager = g_browser_process->devtools_manager();
if (dev_tools_manager) // NULL in unit tests.
- dev_tools_manager->SendAttachToAgent(*this, dest_render_view_host);
+ dev_tools_manager->OnNavigatingToPendingEntry(*this,
+ dest_render_view_host);
// Used for page load time metrics.
current_load_start_ = base::TimeTicks::Now();