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

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

Issue 898443003: Use RWH instead of RWHV to know whether a frame is focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 RenderViewHost* RenderFrameHostImpl::GetRenderViewHost() { 272 RenderViewHost* RenderFrameHostImpl::GetRenderViewHost() {
273 return render_view_host_; 273 return render_view_host_;
274 } 274 }
275 275
276 ServiceRegistry* RenderFrameHostImpl::GetServiceRegistry() { 276 ServiceRegistry* RenderFrameHostImpl::GetServiceRegistry() {
277 return service_registry_.get(); 277 return service_registry_.get();
278 } 278 }
279 279
280 blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() { 280 blink::WebPageVisibilityState RenderFrameHostImpl::GetVisibilityState() {
281 // TODO(mlamouri,kenrb): call GetRenderWidgetHost() directly when it stops
282 // returning nullptr in some cases. See https://crbug.com/455245.
281 blink::WebPageVisibilityState visibility_state = 283 blink::WebPageVisibilityState visibility_state =
282 RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost())->is_hidden() 284 RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost())->is_hidden()
283 ? blink::WebPageVisibilityStateHidden 285 ? blink::WebPageVisibilityStateHidden
284 : blink::WebPageVisibilityStateVisible; 286 : blink::WebPageVisibilityStateVisible;
285 GetContentClient()->browser()->OverridePageVisibilityState(this, 287 GetContentClient()->browser()->OverridePageVisibilityState(this,
286 &visibility_state); 288 &visibility_state);
287 return visibility_state; 289 return visibility_state;
288 } 290 }
289 291
290 bool RenderFrameHostImpl::Send(IPC::Message* message) { 292 bool RenderFrameHostImpl::Send(IPC::Message* message) {
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 #if defined(OS_ANDROID) 1597 #if defined(OS_ANDROID)
1596 // The Android-specific service registry has a reference to 1598 // The Android-specific service registry has a reference to
1597 // |service_registry_| and thus must be torn down first. 1599 // |service_registry_| and thus must be torn down first.
1598 service_registry_android_.reset(); 1600 service_registry_android_.reset();
1599 #endif 1601 #endif
1600 1602
1601 service_registry_.reset(); 1603 service_registry_.reset();
1602 } 1604 }
1603 1605
1604 bool RenderFrameHostImpl::IsFocused() { 1606 bool RenderFrameHostImpl::IsFocused() {
1605 return GetView()->HasFocus() && 1607 // TODO(mlamouri,kenrb): call GetRenderWidgetHost() directly when it stops
1608 // returning nullptr in some cases. See https://crbug.com/455245.
1609 return RenderWidgetHostImpl::From(
1610 GetView()->GetRenderWidgetHost())->is_focused() &&
1606 frame_tree_->GetFocusedFrame() && 1611 frame_tree_->GetFocusedFrame() &&
1607 (frame_tree_->GetFocusedFrame() == frame_tree_node() || 1612 (frame_tree_->GetFocusedFrame() == frame_tree_node() ||
1608 frame_tree_->GetFocusedFrame()->IsDescendantOf(frame_tree_node())); 1613 frame_tree_->GetFocusedFrame()->IsDescendantOf(frame_tree_node()));
1609 } 1614 }
1610 1615
1611 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility( 1616 void RenderFrameHostImpl::UpdateCrossProcessIframeAccessibility(
1612 const std::map<int32, int>& node_to_frame_routing_id_map) { 1617 const std::map<int32, int>& node_to_frame_routing_id_map) {
1613 for (const auto& iter : node_to_frame_routing_id_map) { 1618 for (const auto& iter : node_to_frame_routing_id_map) {
1614 // This is the id of the accessibility node that has a child frame. 1619 // This is the id of the accessibility node that has a child frame.
1615 int32 node_id = iter.first; 1620 int32 node_id = iter.first;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1785 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1781 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1786 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1782 GetContentClient()->browser()->RegisterPermissionUsage( 1787 GetContentClient()->browser()->RegisterPermissionUsage(
1783 PERMISSION_GEOLOCATION, 1788 PERMISSION_GEOLOCATION,
1784 delegate_->GetAsWebContents(), 1789 delegate_->GetAsWebContents(),
1785 GetLastCommittedURL().GetOrigin(), 1790 GetLastCommittedURL().GetOrigin(),
1786 top_frame->GetLastCommittedURL().GetOrigin()); 1791 top_frame->GetLastCommittedURL().GetOrigin());
1787 } 1792 }
1788 1793
1789 } // namespace content 1794 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698