summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-16 16:47:58 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-16 16:47:58 +0000
commit522b1e1c7dc9e9898543e018647d22126aa02177 (patch)
tree9125edcbbcea96600f35e7fb37108b7adcbc2cd5 /chrome/browser/renderer_host
parentd0c07ee9cdb1101244e3b5b4e5322e46cb735163 (diff)
downloadchromium_src-522b1e1c7dc9e9898543e018647d22126aa02177.zip
chromium_src-522b1e1c7dc9e9898543e018647d22126aa02177.tar.gz
chromium_src-522b1e1c7dc9e9898543e018647d22126aa02177.tar.bz2
DevTools: Make 'toggle node search' mode work.
BUG=16824 Review URL: http://codereview.chromium.org/155639 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc17
-rw-r--r--chrome/browser/renderer_host/render_view_host.h10
2 files changed, 26 insertions, 1 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index ff6b8e3..73a66fa 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -109,7 +109,8 @@ RenderViewHost::RenderViewHost(SiteInstance* instance,
run_modal_reply_msg_(NULL),
is_waiting_for_unload_ack_(false),
are_javascript_messages_suppressed_(false),
- sudden_termination_allowed_(false) {
+ sudden_termination_allowed_(false),
+ in_inspect_element_mode_(false) {
DCHECK(instance_);
DCHECK(delegate_);
if (modal_dialog_event == NULL)
@@ -781,6 +782,8 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
OnDockDevToolsWindow);
IPC_MESSAGE_HANDLER(ViewHostMsg_UndockDevToolsWindow,
OnUndockDevToolsWindow);
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ToggleInspectElementMode,
+ OnToggleInspectElementMode);
IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
OnUserMetricsRecordAction)
IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus);
@@ -1328,6 +1331,10 @@ void RenderViewHost::OnUndockDevToolsWindow() {
DevToolsManager::GetInstance()->UndockWindow(this);
}
+void RenderViewHost::OnToggleInspectElementMode(bool enabled) {
+ DevToolsManager::GetInstance()->ToggleInspectElementMode(this, enabled);
+}
+
void RenderViewHost::OnUserMetricsRecordAction(const std::wstring& action) {
UserMetrics::RecordComputedAction(action.c_str(), process()->profile());
}
@@ -1481,6 +1488,14 @@ gfx::Rect RenderViewHost::GetRootWindowResizerRect() const {
void RenderViewHost::ForwardMouseEvent(
const WebKit::WebMouseEvent& mouse_event) {
+ if (in_inspect_element_mode_ &&
+ mouse_event.type == WebInputEvent::MouseDown) {
+ in_inspect_element_mode_ = false;
+ DevToolsManager::GetInstance()->InspectElement(this, mouse_event.x,
+ mouse_event.y);
+ return;
+ }
+
// We make a copy of the mouse event because
// RenderWidgetHost::ForwardMouseEvent will delete |mouse_event|.
WebKit::WebMouseEvent event_copy(mouse_event);
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 90a4d53..a55095a 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -418,6 +418,10 @@ class RenderViewHost : public RenderWidgetHost,
void SignalModalDialogEvent();
void ResetModalDialogEvent();
+ void set_in_inspect_element_mode(bool enabled) {
+ in_inspect_element_mode_ = enabled;
+ }
+
protected:
// RenderWidgetHost protected overrides.
virtual void UnhandledKeyboardEvent(const NativeWebKeyboardEvent& event);
@@ -522,6 +526,7 @@ class RenderViewHost : public RenderWidgetHost,
void OnCloseDevToolsWindow();
void OnDockDevToolsWindow();
void OnUndockDevToolsWindow();
+ void OnToggleInspectElementMode(bool enabled);
void OnUserMetricsRecordAction(const std::wstring& action);
void OnMissingPluginStatus(int status);
@@ -618,6 +623,11 @@ class RenderViewHost : public RenderWidgetHost,
// True if the render view can be shut down suddenly.
bool sudden_termination_allowed_;
+ // DevTools triggers this mode when user chooses inspect lens tool.
+ // While in this mode, mouse click is converted into InspectElement
+ // command.
+ bool in_inspect_element_mode_;
+
NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(RenderViewHost);