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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 871443004: Expose the visibility state of a frame to the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rfh_isfocused
Patch Set: rebase Created 5 years, 10 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 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/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 service_registry_.reset(); 1557 service_registry_.reset();
1558 } 1558 }
1559 1559
1560 bool RenderFrameHostImpl::IsFocused() { 1560 bool RenderFrameHostImpl::IsFocused() {
1561 return GetView()->HasFocus() && 1561 return GetView()->HasFocus() &&
1562 frame_tree_->GetFocusedFrame() && 1562 frame_tree_->GetFocusedFrame() &&
1563 (frame_tree_->GetFocusedFrame() == frame_tree_node() || 1563 (frame_tree_->GetFocusedFrame() == frame_tree_node() ||
1564 frame_tree_->GetFocusedFrame()->IsDescendantOf(frame_tree_node())); 1564 frame_tree_->GetFocusedFrame()->IsDescendantOf(frame_tree_node()));
1565 } 1565 }
1566 1566
1567 blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() {
1568 blink::WebPageVisibilityState visibility_state =
1569 RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost())->is_hidden()
1570 ? blink::WebPageVisibilityStateHidden
1571 : blink::WebPageVisibilityStateVisible;
1572 GetContentClient()->browser()->OverridePageVisibilityState(this,
1573 &visibility_state);
1574 return visibility_state;
1575 }
1576
1567 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility( 1577 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility(
1568 const std::map<int32, int>& node_to_frame_routing_id_map) { 1578 const std::map<int32, int>& node_to_frame_routing_id_map) {
1569 for (const auto& iter : node_to_frame_routing_id_map) { 1579 for (const auto& iter : node_to_frame_routing_id_map) {
1570 // This is the id of the accessibility node that has a child frame. 1580 // This is the id of the accessibility node that has a child frame.
1571 int32 node_id = iter.first; 1581 int32 node_id = iter.first;
1572 // The routing id from either a RenderFrame or a RenderFrameProxy. 1582 // The routing id from either a RenderFrame or a RenderFrameProxy.
1573 int frame_routing_id = iter.second; 1583 int frame_routing_id = iter.second;
1574 1584
1575 FrameTree* frame_tree = frame_tree_node()->frame_tree(); 1585 FrameTree* frame_tree = frame_tree_node()->frame_tree();
1576 FrameTreeNode* child_frame_tree_node = frame_tree->FindByRoutingID( 1586 FrameTreeNode* child_frame_tree_node = frame_tree->FindByRoutingID(
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1745 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1736 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1746 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1737 GetContentClient()->browser()->RegisterPermissionUsage( 1747 GetContentClient()->browser()->RegisterPermissionUsage(
1738 PERMISSION_GEOLOCATION, 1748 PERMISSION_GEOLOCATION,
1739 delegate_->GetAsWebContents(), 1749 delegate_->GetAsWebContents(),
1740 GetLastCommittedURL().GetOrigin(), 1750 GetLastCommittedURL().GetOrigin(),
1741 top_frame->GetLastCommittedURL().GetOrigin()); 1751 top_frame->GetLastCommittedURL().GetOrigin());
1742 } 1752 }
1743 1753
1744 } // namespace content 1754 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698