summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc12
-rw-r--r--chrome/browser/renderer_host/render_view_host.h2
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h10
-rw-r--r--chrome/browser/renderer_host/render_widget_host.cc7
-rw-r--r--chrome/browser/renderer_host/render_widget_host.h4
5 files changed, 27 insertions, 8 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 5fa612e..b957d28 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -1766,6 +1766,18 @@ void RenderViewHost::OnMsgFocusedNodeChanged() {
delegate_->FocusedNodeChanged();
}
+void RenderViewHost::OnMsgFocus() {
+ RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
+ if (view)
+ view->Activate();
+}
+
+void RenderViewHost::OnMsgBlur() {
+ RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
+ if (view)
+ view->Deactivate();
+}
+
gfx::Rect RenderViewHost::GetRootWindowResizerRect() const {
return delegate_->GetRootWindowResizerRect();
}
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 10a86b4..b47bb57 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -481,6 +481,8 @@ class RenderViewHost : public RenderWidgetHost {
virtual void NotifyRendererUnresponsive();
virtual void NotifyRendererResponsive();
virtual void OnMsgFocusedNodeChanged();
+ virtual void OnMsgFocus();
+ virtual void OnMsgBlur();
// IPC message handlers.
void OnMsgShowView(int route_id,
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index 4d28c3b..0be5784 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -153,10 +153,16 @@ class RenderViewHostDelegate {
// Notification that view for this delegate got the focus.
virtual void GotFocus() = 0;
- // Callback to inform the browser it should take back focus. If reverse is
- // true, it means the focus was retrieved by doing a Shift-Tab.
+ // Callback to inform the browser that the page is returning the focus to
+ // the browser's chrome. If reverse is true, it means the focus was
+ // retrieved by doing a Shift-Tab.
virtual void TakeFocus(bool reverse) = 0;
+ // The page wants the hosting window to activate/deactivate itself (it
+ // called the JavaScript window.focus()/blur() method).
+ virtual void Activate() = 0;
+ virtual void Deactivate() = 0;
+
// Callback to give the browser a chance to handle the specified keyboard
// event before sending it to the renderer.
// Returns true if the |event| was handled. Otherwise, if the |event| would
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index 5cb889c..53427ef 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -882,14 +882,13 @@ void RenderWidgetHost::ProcessWheelAck() {
}
void RenderWidgetHost::OnMsgFocus() {
- // Only the user can focus a RenderWidgetHost.
+ // Only RenderViewHost can deal with that message.
process()->ReceivedBadMessage(ViewHostMsg_Focus__ID);
}
void RenderWidgetHost::OnMsgBlur() {
- if (view_) {
- view_->Blur();
- }
+ // Only RenderViewHost can deal with that message.
+ process()->ReceivedBadMessage(ViewHostMsg_Blur__ID);
}
void RenderWidgetHost::OnMsgSetCursor(const WebCursor& cursor) {
diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h
index d729cba..2f31158 100644
--- a/chrome/browser/renderer_host/render_widget_host.h
+++ b/chrome/browser/renderer_host/render_widget_host.h
@@ -481,8 +481,8 @@ class RenderWidgetHost : public IPC::Channel::Listener,
void OnMsgUpdateVideo(TransportDIB::Id bitmap, const gfx::Rect& bitmap_rect);
void OnMsgDestroyVideo();
void OnMsgInputEventAck(const IPC::Message& message);
- void OnMsgFocus();
- void OnMsgBlur();
+ virtual void OnMsgFocus();
+ virtual void OnMsgBlur();
void OnMsgSetCursor(const WebCursor& cursor);
void OnMsgImeUpdateTextInputState(WebKit::WebTextInputType type,