Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1017)

Unified Diff: content/browser/renderer_host/render_widget_host_impl.h

Issue 898443003: Use RWH instead of RWHV to know whether a frame is focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_impl.h
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index 80c5e23dc0647583c27ea666732880c052f6f29f..a5136ce21b3dae423a2e5a5ab86a0b9215371554 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -228,6 +228,15 @@ class CONTENT_EXPORT RenderWidgetHostImpl
virtual void GotFocus();
virtual void LostCapture();
+ // Indicates whether the RenderWidgetHost thinks it is focused.
+ // This is different from RenderWidgetHostView::HasFocus() in the sense that
+ // it reflects what the renderer process knows: it saves the state that is
+ // sent/received.
+ // RenderWidgetHostView::HasFocus() is checking whether the view is focused so
+ // it is possible in some edge cases that a view was requested to be focused
+ // but it failed, thus HasFocus() returns false.
+ bool is_focused() const { return is_focused_; }
+
// Called to notify the RenderWidget that it has lost the mouse lock.
virtual void LostMouseLock();
@@ -841,6 +850,12 @@ class CONTENT_EXPORT RenderWidgetHostImpl
// object does not self destroy.
bool owned_by_render_frame_host_;
+ // Indicates whether this RenderWidgetHost thinks is focused. This is trying
+ // to match what the renderer process knows. It is different from
+ // RenderWidgetHostView::HasFocus in that in that the focus request may fail,
+ // causing HasFocus to return false when is_focused_ is true.
+ bool is_focused_;
+
base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl);
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698