OLD | NEW |
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 void FrameTree::SetFocusedFrame(FrameTreeNode* node) { | 270 void FrameTree::SetFocusedFrame(FrameTreeNode* node) { |
271 // If the focused frame changed across processes, send a message to the old | 271 // If the focused frame changed across processes, send a message to the old |
272 // focused frame's renderer process to clear focus from that frame and fire | 272 // focused frame's renderer process to clear focus from that frame and fire |
273 // blur events. | 273 // blur events. |
274 FrameTreeNode* oldFocusedFrame = GetFocusedFrame(); | 274 FrameTreeNode* oldFocusedFrame = GetFocusedFrame(); |
275 if (oldFocusedFrame && | 275 if (oldFocusedFrame && |
276 oldFocusedFrame->current_frame_host()->GetSiteInstance() != | 276 oldFocusedFrame->current_frame_host()->GetSiteInstance() != |
277 node->current_frame_host()->GetSiteInstance()) { | 277 node->current_frame_host()->GetSiteInstance()) { |
278 DCHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); | 278 DCHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); |
279 oldFocusedFrame->current_frame_host()->ClearFocus(); | 279 oldFocusedFrame->current_frame_host()->ClearFocus(node); |
280 } | 280 } |
281 | 281 |
282 node->set_last_focus_time(base::TimeTicks::Now()); | 282 node->set_last_focus_time(base::TimeTicks::Now()); |
283 focused_frame_tree_node_id_ = node->frame_tree_node_id(); | 283 focused_frame_tree_node_id_ = node->frame_tree_node_id(); |
284 } | 284 } |
285 | 285 |
286 void FrameTree::SetFrameRemoveListener( | 286 void FrameTree::SetFrameRemoveListener( |
287 const base::Callback<void(RenderFrameHost*)>& on_frame_removed) { | 287 const base::Callback<void(RenderFrameHost*)>& on_frame_removed) { |
288 on_frame_removed_ = on_frame_removed; | 288 on_frame_removed_ = on_frame_removed; |
289 } | 289 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 // This is only used to set page-level focus in cross-process subframes, and | 439 // This is only used to set page-level focus in cross-process subframes, and |
440 // requests to set focus in main frame's SiteInstance are ignored. | 440 // requests to set focus in main frame's SiteInstance are ignored. |
441 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { | 441 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { |
442 RenderFrameProxyHost* proxy = | 442 RenderFrameProxyHost* proxy = |
443 root_manager->GetRenderFrameProxyHost(instance); | 443 root_manager->GetRenderFrameProxyHost(instance); |
444 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); | 444 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); |
445 } | 445 } |
446 } | 446 } |
447 | 447 |
448 } // namespace content | 448 } // namespace content |
OLD | NEW |