OLD | NEW |
---|---|
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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2099 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnStop()); | 2099 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnStop()); |
2100 } | 2100 } |
2101 | 2101 |
2102 // Tell the embedding application that the URL of the active page has changed. | 2102 // Tell the embedding application that the URL of the active page has changed. |
2103 void RenderFrameImpl::UpdateURL(blink::WebFrame* frame) { | 2103 void RenderFrameImpl::UpdateURL(blink::WebFrame* frame) { |
2104 DCHECK(!frame_ || frame_ == frame); | 2104 DCHECK(!frame_ || frame_ == frame); |
2105 WebDataSource* ds = frame->dataSource(); | 2105 WebDataSource* ds = frame->dataSource(); |
2106 DCHECK(ds); | 2106 DCHECK(ds); |
2107 | 2107 |
2108 const WebURLRequest& request = ds->request(); | 2108 const WebURLRequest& request = ds->request(); |
2109 const WebURLRequest& original_request = ds->originalRequest(); | |
2110 const WebURLResponse& response = ds->response(); | 2109 const WebURLResponse& response = ds->response(); |
2111 | 2110 |
2112 DocumentState* document_state = DocumentState::FromDataSource(ds); | 2111 DocumentState* document_state = DocumentState::FromDataSource(ds); |
2113 NavigationState* navigation_state = document_state->navigation_state(); | 2112 NavigationState* navigation_state = document_state->navigation_state(); |
2114 InternalDocumentStateData* internal_data = | 2113 InternalDocumentStateData* internal_data = |
2115 InternalDocumentStateData::FromDocumentState(document_state); | 2114 InternalDocumentStateData::FromDocumentState(document_state); |
2116 | 2115 |
2117 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2116 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
2118 params.http_status_code = response.httpStatusCode(); | 2117 params.http_status_code = response.httpStatusCode(); |
2119 params.is_post = false; | 2118 params.is_post = false; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2220 params.is_post = true; | 2219 params.is_post = true; |
2221 params.post_id = ExtractPostId(item); | 2220 params.post_id = ExtractPostId(item); |
2222 } | 2221 } |
2223 | 2222 |
2224 // Send the user agent override back. | 2223 // Send the user agent override back. |
2225 params.is_overriding_user_agent = internal_data->is_overriding_user_agent(); | 2224 params.is_overriding_user_agent = internal_data->is_overriding_user_agent(); |
2226 | 2225 |
2227 // Track the URL of the original request. We use the first entry of the | 2226 // Track the URL of the original request. We use the first entry of the |
2228 // redirect chain if it exists because the chain may have started in another | 2227 // redirect chain if it exists because the chain may have started in another |
2229 // process. | 2228 // process. |
2230 if (params.redirects.size() > 0) | 2229 params.original_request_url = GetOriginalRequestURL(ds); |
2231 params.original_request_url = params.redirects.at(0); | |
2232 else | |
2233 params.original_request_url = original_request.url(); | |
2234 | 2230 |
2235 params.history_list_was_cleared = | 2231 params.history_list_was_cleared = |
2236 navigation_state->history_list_was_cleared(); | 2232 navigation_state->history_list_was_cleared(); |
2237 | 2233 |
2238 // Save some histogram data so we can compute the average memory used per | 2234 // Save some histogram data so we can compute the average memory used per |
2239 // page load of the glyphs. | 2235 // page load of the glyphs. |
2240 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", | 2236 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", |
2241 blink::WebGlyphCache::pageCount()); | 2237 blink::WebGlyphCache::pageCount()); |
2242 | 2238 |
2243 // This message needs to be sent before any of allowScripts(), | 2239 // This message needs to be sent before any of allowScripts(), |
(...skipping 29 matching lines...) Expand all Loading... | |
2273 navigation_state->set_transition_type(PAGE_TRANSITION_LINK); | 2269 navigation_state->set_transition_type(PAGE_TRANSITION_LINK); |
2274 } | 2270 } |
2275 | 2271 |
2276 void RenderFrameImpl::didStartLoading() { | 2272 void RenderFrameImpl::didStartLoading() { |
2277 Send(new FrameHostMsg_DidStartLoading(routing_id_)); | 2273 Send(new FrameHostMsg_DidStartLoading(routing_id_)); |
2278 } | 2274 } |
2279 | 2275 |
2280 void RenderFrameImpl::didStopLoading() { | 2276 void RenderFrameImpl::didStopLoading() { |
2281 Send(new FrameHostMsg_DidStopLoading(routing_id_)); | 2277 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
2282 } | 2278 } |
2283 | 2279 |
sgurun-gerrit only
2014/03/13 00:47:48
nit: add // static here (code convention, see how
| |
2280 GURL RenderFrameImpl::GetOriginalRequestURL(WebDataSource* ds) { | |
2281 // WebDataSource has unreachable URL means that the frame is loaded through | |
2282 // blink::WebFrame::loadData(), and the base URL will be in the redirect | |
2283 // chain. However, we never visited the baseURL. So in this case, we should | |
2284 // use the unreachable URL as the original URL. | |
2285 if (ds->hasUnreachableURL()) | |
2286 return ds->unreachableURL(); | |
2287 | |
2288 std::vector<GURL> redirects; | |
2289 GetRedirectChain(ds, &redirects); | |
2290 if (!redirects.empty()) | |
2291 return redirects.at(0); | |
2292 | |
2293 return ds->originalRequest().url(); | |
2294 } | |
2295 | |
2284 } // namespace content | 2296 } // namespace content |
OLD | NEW |