| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 | 247 |
| 248 FrameTreeNode* FrameTree::GetFocusedFrame() { | 248 FrameTreeNode* FrameTree::GetFocusedFrame() { |
| 249 return FindByID(focused_frame_tree_node_id_); | 249 return FindByID(focused_frame_tree_node_id_); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void FrameTree::SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) { | 252 void FrameTree::SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) { |
| 253 if (node == GetFocusedFrame()) | 253 if (node == GetFocusedFrame()) |
| 254 return; | 254 return; |
| 255 | 255 |
| 256 if (!node) { |
| 257 // TODO(avallee): https://crbug.com/614463 Notify proxies here once |
| 258 // <webview> supports oopifs inside itself. |
| 259 if (GetFocusedFrame()) |
| 260 GetFocusedFrame()->current_frame_host()->ClearFocusedFrame(); |
| 261 focused_frame_tree_node_id_ = FrameTreeNode::kFrameTreeNodeInvalidId; |
| 262 |
| 263 // TODO(avallee): https://crbug.com/610795 This line is not sufficient to |
| 264 // make the test pass. There seems to be no focus change events generated. |
| 265 root()->current_frame_host()->UpdateAXTreeData(); |
| 266 return; |
| 267 } |
| 268 |
| 256 std::set<SiteInstance*> frame_tree_site_instances = | 269 std::set<SiteInstance*> frame_tree_site_instances = |
| 257 CollectSiteInstances(this); | 270 CollectSiteInstances(this); |
| 258 | 271 |
| 259 SiteInstance* current_instance = | 272 SiteInstance* current_instance = |
| 260 node->current_frame_host()->GetSiteInstance(); | 273 node->current_frame_host()->GetSiteInstance(); |
| 261 | 274 |
| 262 // Update the focused frame in all other SiteInstances. If focus changes to | 275 // Update the focused frame in all other SiteInstances. If focus changes to |
| 263 // a cross-process frame, this allows the old focused frame's renderer | 276 // a cross-process frame, this allows the old focused frame's renderer |
| 264 // process to clear focus from that frame and fire blur events. It also | 277 // process to clear focus from that frame and fire blur events. It also |
| 265 // ensures that the latest focused frame is available in all renderers to | 278 // ensures that the latest focused frame is available in all renderers to |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 // This is only used to set page-level focus in cross-process subframes, and | 461 // This is only used to set page-level focus in cross-process subframes, and |
| 449 // requests to set focus in main frame's SiteInstance are ignored. | 462 // requests to set focus in main frame's SiteInstance are ignored. |
| 450 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { | 463 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { |
| 451 RenderFrameProxyHost* proxy = | 464 RenderFrameProxyHost* proxy = |
| 452 root_manager->GetRenderFrameProxyHost(instance); | 465 root_manager->GetRenderFrameProxyHost(instance); |
| 453 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); | 466 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); |
| 454 } | 467 } |
| 455 } | 468 } |
| 456 | 469 |
| 457 } // namespace content | 470 } // namespace content |
| OLD | NEW |