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

Side by Side 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, 2 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/frame_tree.h" 5 #include "content/browser/frame_host/frame_tree.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 RenderFrameHostImpl* FrameTree::GetMainFrame() const { 251 RenderFrameHostImpl* FrameTree::GetMainFrame() const {
252 return root_->current_frame_host(); 252 return root_->current_frame_host();
253 } 253 }
254 254
255 FrameTreeNode* FrameTree::GetFocusedFrame() { 255 FrameTreeNode* FrameTree::GetFocusedFrame() {
256 return FindByID(focused_frame_tree_node_id_); 256 return FindByID(focused_frame_tree_node_id_);
257 } 257 }
258 258
259 void FrameTree::SetFocusedFrame(FrameTreeNode* node) { 259 void FrameTree::SetFocusedFrame(FrameTreeNode* node) {
260 // If the focused frame changed across processes, send a message to the old
261 // focused frame's renderer process to clear focus from that frame and fire
262 // blur events.
263 FrameTreeNode* oldFocusedFrame = GetFocusedFrame();
264 if (oldFocusedFrame &&
265 oldFocusedFrame->current_frame_host()->GetSiteInstance() !=
266 node->current_frame_host()->GetSiteInstance()) {
267 DCHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
268 oldFocusedFrame->current_frame_host()->ClearFocus();
269 }
270
260 node->set_last_focus_time(base::TimeTicks::Now()); 271 node->set_last_focus_time(base::TimeTicks::Now());
261 focused_frame_tree_node_id_ = node->frame_tree_node_id(); 272 focused_frame_tree_node_id_ = node->frame_tree_node_id();
262 } 273 }
263 274
264 void FrameTree::SetFrameRemoveListener( 275 void FrameTree::SetFrameRemoveListener(
265 const base::Callback<void(RenderFrameHost*)>& on_frame_removed) { 276 const base::Callback<void(RenderFrameHost*)>& on_frame_removed) {
266 on_frame_removed_ = on_frame_removed; 277 on_frame_removed_ = on_frame_removed;
267 } 278 }
268 279
269 RenderViewHostImpl* FrameTree::CreateRenderViewHost(SiteInstance* site_instance, 280 RenderViewHostImpl* FrameTree::CreateRenderViewHost(SiteInstance* site_instance,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 load_progress_ = 0.0; 403 load_progress_ = 0.0;
393 } 404 }
394 405
395 bool FrameTree::IsLoading() { 406 bool FrameTree::IsLoading() {
396 bool is_loading = false; 407 bool is_loading = false;
397 ForEach(base::Bind(&IsNodeLoading, &is_loading)); 408 ForEach(base::Bind(&IsNodeLoading, &is_loading));
398 return is_loading; 409 return is_loading;
399 } 410 }
400 411
401 } // namespace content 412 } // namespace content
OLDNEW
« 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