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

Unified Diff: content/browser/frame_host/frame_tree.cc

Issue 1370013003: OOPIF: Clear old focused frame when focus moves to a cross-process frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove !frame()->page() check from WebLocalFrameImpl::clearFocus() Created 5 years, 3 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
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/frame_tree.cc
diff --git a/content/browser/frame_host/frame_tree.cc b/content/browser/frame_host/frame_tree.cc
index 189694a525dc51e86e5c9788c6815de8ca06b73b..ac4b1db9069c1debfb24513300ada608edd70297 100644
--- a/content/browser/frame_host/frame_tree.cc
+++ b/content/browser/frame_host/frame_tree.cc
@@ -257,6 +257,17 @@ FrameTreeNode* FrameTree::GetFocusedFrame() {
}
void FrameTree::SetFocusedFrame(FrameTreeNode* node) {
+ // If the focused frame changed across processes, send a message to the old
+ // focused frame's renderer process to clear focus from that frame and fire
+ // blur events.
+ FrameTreeNode* oldFocusedFrame = GetFocusedFrame();
+ if (oldFocusedFrame &&
+ oldFocusedFrame->current_frame_host()->GetSiteInstance() !=
+ node->current_frame_host()->GetSiteInstance()) {
+ DCHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
+ oldFocusedFrame->current_frame_host()->ClearFocus();
+ }
+
node->set_last_focus_time(base::TimeTicks::Now());
focused_frame_tree_node_id_ = node->frame_tree_node_id();
}
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698