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

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: Cleanup 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
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..5163959c5253165b1beeb87b20b7fcc5907ae2b0 100644
--- a/content/browser/frame_host/frame_tree.cc
+++ b/content/browser/frame_host/frame_tree.cc
@@ -258,6 +258,17 @@ FrameTreeNode* FrameTree::GetFocusedFrame() {
void FrameTree::SetFocusedFrame(FrameTreeNode* node) {
node->set_last_focus_time(base::TimeTicks::Now());
Charlie Reis 2015/09/29 23:50:44 nit: Move this below with the actual assignment.
alexmos 2015/09/30 16:48:20 Done.
+
+ // 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 (SiteIsolationPolicy::AreCrossProcessFramesPossible() && oldFocusedFrame &&
Charlie Reis 2015/09/29 23:50:43 nit: We can probably just make AreCrossProcessFram
alexmos 2015/09/30 16:48:20 Indeed - done.
+ oldFocusedFrame->current_frame_host()->GetSiteInstance() !=
+ node->current_frame_host()->GetSiteInstance()) {
+ oldFocusedFrame->current_frame_host()->ClearFocus();
+ }
+
focused_frame_tree_node_id_ = node->frame_tree_node_id();
}

Powered by Google App Engine
This is Rietveld 408576698