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

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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 case blink::WebTextDirectionRightToLeft: 97 case blink::WebTextDirectionRightToLeft:
98 return base::i18n::RIGHT_TO_LEFT; 98 return base::i18n::RIGHT_TO_LEFT;
99 default: 99 default:
100 NOTREACHED(); 100 NOTREACHED();
101 return base::i18n::UNKNOWN_DIRECTION; 101 return base::i18n::UNKNOWN_DIRECTION;
102 } 102 }
103 } 103 }
104 104
105 } // namespace 105 } // namespace
106 106
107 const double RenderFrameHostImpl::kLoadingProgressNotStarted = 0.0;
108 const double RenderFrameHostImpl::kLoadingProgressMinimum = 0.1;
109 const double RenderFrameHostImpl::kLoadingProgressDone = 1.0;
110
107 // static 111 // static
108 bool RenderFrameHostImpl::IsRFHStateActive(RenderFrameHostImplState rfh_state) { 112 bool RenderFrameHostImpl::IsRFHStateActive(RenderFrameHostImplState rfh_state) {
109 return rfh_state == STATE_DEFAULT; 113 return rfh_state == STATE_DEFAULT;
110 } 114 }
111 115
112 // static 116 // static
113 RenderFrameHost* RenderFrameHost::FromID(int render_process_id, 117 RenderFrameHost* RenderFrameHost::FromID(int render_process_id,
114 int render_frame_id) { 118 int render_frame_id) {
115 return RenderFrameHostImpl::FromID(render_process_id, render_frame_id); 119 return RenderFrameHostImpl::FromID(render_process_id, render_frame_id);
116 } 120 }
(...skipping 25 matching lines...) Expand all
142 frame_tree_(frame_tree), 146 frame_tree_(frame_tree),
143 frame_tree_node_(frame_tree_node), 147 frame_tree_node_(frame_tree_node),
144 routing_id_(routing_id), 148 routing_id_(routing_id),
145 render_frame_created_(false), 149 render_frame_created_(false),
146 navigations_suspended_(false), 150 navigations_suspended_(false),
147 has_beforeunload_handlers_(false), 151 has_beforeunload_handlers_(false),
148 has_unload_handlers_(false), 152 has_unload_handlers_(false),
149 override_sudden_termination_status_(false), 153 override_sudden_termination_status_(false),
150 is_waiting_for_beforeunload_ack_(false), 154 is_waiting_for_beforeunload_ack_(false),
151 unload_ack_is_for_navigation_(false), 155 unload_ack_is_for_navigation_(false),
156 is_loading_(false),
157 loading_progress_(kLoadingProgressNotStarted),
152 accessibility_reset_token_(0), 158 accessibility_reset_token_(0),
153 accessibility_reset_count_(0), 159 accessibility_reset_count_(0),
154 no_create_browser_accessibility_manager_for_testing_(false), 160 no_create_browser_accessibility_manager_for_testing_(false),
155 weak_ptr_factory_(this) { 161 weak_ptr_factory_(this) {
156 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); 162 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT);
157 bool hidden = !!(flags & CREATE_RF_HIDDEN); 163 bool hidden = !!(flags & CREATE_RF_HIDDEN);
158 frame_tree_->RegisterRenderFrameHost(this); 164 frame_tree_->RegisterRenderFrameHost(this);
159 GetProcess()->AddRoute(routing_id_, this); 165 GetProcess()->AddRoute(routing_id_, this);
160 g_routing_id_frame_map.Get().insert(std::make_pair( 166 g_routing_id_frame_map.Get().insert(std::make_pair(
161 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 167 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1916 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1911 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1917 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1912 GetContentClient()->browser()->RegisterPermissionUsage( 1918 GetContentClient()->browser()->RegisterPermissionUsage(
1913 PERMISSION_GEOLOCATION, 1919 PERMISSION_GEOLOCATION,
1914 delegate_->GetAsWebContents(), 1920 delegate_->GetAsWebContents(),
1915 GetLastCommittedURL().GetOrigin(), 1921 GetLastCommittedURL().GetOrigin(),
1916 top_frame->GetLastCommittedURL().GetOrigin()); 1922 top_frame->GetLastCommittedURL().GetOrigin());
1917 } 1923 }
1918 1924
1919 } // namespace content 1925 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698