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

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

Issue 925623002: Refactor the loading tracking logic in WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 5 years, 9 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 case blink::WebTextDirectionRightToLeft: 98 case blink::WebTextDirectionRightToLeft:
99 return base::i18n::RIGHT_TO_LEFT; 99 return base::i18n::RIGHT_TO_LEFT;
100 default: 100 default:
101 NOTREACHED(); 101 NOTREACHED();
102 return base::i18n::UNKNOWN_DIRECTION; 102 return base::i18n::UNKNOWN_DIRECTION;
103 } 103 }
104 } 104 }
105 105
106 } // namespace 106 } // namespace
107 107
108 const double RenderFrameHostImpl::kLoadingProgressNotStarted = 0.0;
109 const double RenderFrameHostImpl::kLoadingProgressMinimum = 0.1;
110 const double RenderFrameHostImpl::kLoadingProgressDone = 1.0;
111
108 // static 112 // static
109 bool RenderFrameHostImpl::IsRFHStateActive(RenderFrameHostImplState rfh_state) { 113 bool RenderFrameHostImpl::IsRFHStateActive(RenderFrameHostImplState rfh_state) {
110 return rfh_state == STATE_DEFAULT; 114 return rfh_state == STATE_DEFAULT;
111 } 115 }
112 116
113 // static 117 // static
114 RenderFrameHost* RenderFrameHost::FromID(int render_process_id, 118 RenderFrameHost* RenderFrameHost::FromID(int render_process_id,
115 int render_frame_id) { 119 int render_frame_id) {
116 return RenderFrameHostImpl::FromID(render_process_id, render_frame_id); 120 return RenderFrameHostImpl::FromID(render_process_id, render_frame_id);
117 } 121 }
(...skipping 25 matching lines...) Expand all
143 frame_tree_(frame_tree), 147 frame_tree_(frame_tree),
144 frame_tree_node_(frame_tree_node), 148 frame_tree_node_(frame_tree_node),
145 routing_id_(routing_id), 149 routing_id_(routing_id),
146 render_frame_created_(false), 150 render_frame_created_(false),
147 navigations_suspended_(false), 151 navigations_suspended_(false),
148 has_beforeunload_handlers_(false), 152 has_beforeunload_handlers_(false),
149 has_unload_handlers_(false), 153 has_unload_handlers_(false),
150 override_sudden_termination_status_(false), 154 override_sudden_termination_status_(false),
151 is_waiting_for_beforeunload_ack_(false), 155 is_waiting_for_beforeunload_ack_(false),
152 unload_ack_is_for_navigation_(false), 156 unload_ack_is_for_navigation_(false),
157 is_loading_(false),
158 loading_progress_(kLoadingProgressNotStarted),
153 accessibility_reset_token_(0), 159 accessibility_reset_token_(0),
154 accessibility_reset_count_(0), 160 accessibility_reset_count_(0),
155 no_create_browser_accessibility_manager_for_testing_(false), 161 no_create_browser_accessibility_manager_for_testing_(false),
156 weak_ptr_factory_(this) { 162 weak_ptr_factory_(this) {
157 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); 163 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT);
158 bool hidden = !!(flags & CREATE_RF_HIDDEN); 164 bool hidden = !!(flags & CREATE_RF_HIDDEN);
159 frame_tree_->RegisterRenderFrameHost(this); 165 frame_tree_->RegisterRenderFrameHost(this);
160 GetProcess()->AddRoute(routing_id_, this); 166 GetProcess()->AddRoute(routing_id_, this);
161 g_routing_id_frame_map.Get().insert(std::make_pair( 167 g_routing_id_frame_map.Get().insert(std::make_pair(
162 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 168 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1921 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1916 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1922 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1917 GetContentClient()->browser()->RegisterPermissionUsage( 1923 GetContentClient()->browser()->RegisterPermissionUsage(
1918 PERMISSION_GEOLOCATION, 1924 PERMISSION_GEOLOCATION,
1919 delegate_->GetAsWebContents(), 1925 delegate_->GetAsWebContents(),
1920 GetLastCommittedURL().GetOrigin(), 1926 GetLastCommittedURL().GetOrigin(),
1921 top_frame->GetLastCommittedURL().GetOrigin()); 1927 top_frame->GetLastCommittedURL().GetOrigin());
1922 } 1928 }
1923 1929
1924 } // namespace content 1930 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698