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

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

Issue 2474323002: Implement WebContentsViewChildFrame::TakeFocus. (Closed)
Patch Set: Remove logging code. Created 3 years, 11 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
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 4717 matching lines...) Expand 10 before | Expand all | Expand 10 after
4728 void WebContentsImpl::SetAsFocusedWebContentsIfNecessary() { 4728 void WebContentsImpl::SetAsFocusedWebContentsIfNecessary() {
4729 // Only change focus if we are not currently focused. 4729 // Only change focus if we are not currently focused.
4730 WebContentsImpl* old_contents = GetFocusedWebContents(); 4730 WebContentsImpl* old_contents = GetFocusedWebContents();
4731 if (old_contents == this) 4731 if (old_contents == this)
4732 return; 4732 return;
4733 4733
4734 // Send a page level blur to the old contents so that it displays inactive UI 4734 // Send a page level blur to the old contents so that it displays inactive UI
4735 // and focus this contents to activate it. 4735 // and focus this contents to activate it.
4736 if (old_contents) 4736 if (old_contents)
4737 old_contents->GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(false); 4737 old_contents->GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(false);
4738
4739 // Make sure the outer web contents knows our frame is focused. Otherwise, the
4740 // outer renderer could have the element before or after the frame element
4741 // focused which would return early without actually advancing focus.
4742 if (GetRenderManager()->GetProxyToOuterDelegate())
4743 GetRenderManager()->GetProxyToOuterDelegate()->SetFocusedFrame();
4744
4738 GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(true); 4745 GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(true);
4739 GetOutermostWebContents()->node_->SetFocusedWebContents(this); 4746 GetOutermostWebContents()->node_->SetFocusedWebContents(this);
4740 } 4747 }
4741 4748
4742 void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node, 4749 void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
4743 SiteInstance* source) { 4750 SiteInstance* source) {
4744 // The PDF plugin still runs as a BrowserPlugin and must go through the 4751 // The PDF plugin still runs as a BrowserPlugin and must go through the
4745 // input redirection mechanism. It must not become focused direcly. 4752 // input redirection mechanism. It must not become focused direcly.
4746 if (!GuestMode::IsCrossProcessFrameGuest(this) && browser_plugin_guest_) { 4753 if (!GuestMode::IsCrossProcessFrameGuest(this) && browser_plugin_guest_) {
4747 frame_tree_.SetFocusedFrame(node, source); 4754 frame_tree_.SetFocusedFrame(node, source);
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
5418 GetMainFrame()->AddMessageToConsole( 5425 GetMainFrame()->AddMessageToConsole(
5419 content::CONSOLE_MESSAGE_LEVEL_WARNING, 5426 content::CONSOLE_MESSAGE_LEVEL_WARNING,
5420 base::StringPrintf("This site does not have a valid SSL " 5427 base::StringPrintf("This site does not have a valid SSL "
5421 "certificate! Without SSL, your site's and " 5428 "certificate! Without SSL, your site's and "
5422 "visitors' data is vulnerable to theft and " 5429 "visitors' data is vulnerable to theft and "
5423 "tampering. Get a valid SSL certificate before" 5430 "tampering. Get a valid SSL certificate before"
5424 " releasing your website to the public.")); 5431 " releasing your website to the public."));
5425 } 5432 }
5426 5433
5427 } // namespace content 5434 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698