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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2474323002: Implement WebContentsViewChildFrame::TakeFocus. (Closed)
Patch Set: Fix cases where focus does not actually advance focus Created 4 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 4656 matching lines...) Expand 10 before | Expand all | Expand 10 after
4667 void WebContentsImpl::SetAsFocusedWebContentsIfNecessary() { 4667 void WebContentsImpl::SetAsFocusedWebContentsIfNecessary() {
4668 // Only change focus if we are not currently focused. 4668 // Only change focus if we are not currently focused.
4669 WebContentsImpl* old_contents = GetFocusedWebContents(); 4669 WebContentsImpl* old_contents = GetFocusedWebContents();
4670 if (old_contents == this) 4670 if (old_contents == this)
4671 return; 4671 return;
4672 4672
4673 // Send a page level blur to the old contents so that it displays inactive UI 4673 // Send a page level blur to the old contents so that it displays inactive UI
4674 // and focus this contents to activate it. 4674 // and focus this contents to activate it.
4675 if (old_contents) 4675 if (old_contents)
4676 old_contents->GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(false); 4676 old_contents->GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(false);
4677
4678 // Make sure the outer web contents knows our frame is focused. Otherwise, the
4679 // outer renderer could have the element before or after the frame element
4680 // focused which would return early without actually advancing focus.
4681 if (GetRenderManager()->GetProxyToOuterDelegate()) {
alexmos 2016/11/28 23:52:24 nit: { not necessary
avallee 2016/12/09 21:16:51 Done.
4682 GetRenderManager()->GetProxyToOuterDelegate()->SetFocusedFrame();
4683 }
4684
4677 GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(true); 4685 GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(true);
4678 GetOutermostWebContents()->node_->SetFocusedWebContents(this); 4686 GetOutermostWebContents()->node_->SetFocusedWebContents(this);
4679 } 4687 }
4680 4688
4681 void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node, 4689 void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
4682 SiteInstance* source) { 4690 SiteInstance* source) {
4683 // The PDF plugin still runs as a BrowserPlugin and must go through the 4691 // The PDF plugin still runs as a BrowserPlugin and must go through the
4684 // input redirection mechanism. It must not become focused direcly. 4692 // input redirection mechanism. It must not become focused direcly.
4685 if (!GuestMode::IsCrossProcessFrameGuest(this) && browser_plugin_guest_) { 4693 if (!GuestMode::IsCrossProcessFrameGuest(this) && browser_plugin_guest_) {
4686 frame_tree_.SetFocusedFrame(node, source); 4694 frame_tree_.SetFocusedFrame(node, source);
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
5281 dialog_manager_ = dialog_manager; 5289 dialog_manager_ = dialog_manager;
5282 } 5290 }
5283 5291
5284 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { 5292 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) {
5285 auto it = binding_sets_.find(interface_name); 5293 auto it = binding_sets_.find(interface_name);
5286 if (it != binding_sets_.end()) 5294 if (it != binding_sets_.end())
5287 binding_sets_.erase(it); 5295 binding_sets_.erase(it);
5288 } 5296 }
5289 5297
5290 } // namespace content 5298 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698