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 30 matching lines...) Expand all Loading... | |
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 |
2280 GURL RenderFrameImpl::GetOriginalRequestUrl(WebDataSource* ds) { | |
darin (slow to review)
2014/03/11 20:04:32
nit: We aren't terribly consistent, but a quick gr
hush (inactive)
2014/03/12 21:34:21
Done
| |
2281 std::vector<GURL> redirects; | |
darin (slow to review)
2014/03/11 20:04:32
nit: I'd move this below the hasUnreachableURL bra
hush (inactive)
2014/03/12 21:34:21
Done
| |
2282 GetRedirectChain(ds, &redirects); | |
2283 | |
2284 // The frame is loaded via WebFrame::loadData, where we pass the | |
darin (slow to review)
2014/03/11 20:04:32
nit: This comment needs some work. It appears to b
hush (inactive)
2014/03/12 21:34:21
Okay. I just reworded the comments by only referri
| |
2285 // history_url_for_data_url as unreachableURL in blink. The | |
2286 // base_url_for_data_url will be in the redirect chain, but we | |
2287 // never actually visited base_url_for_data_url. So we need to set | |
2288 // history_url_for_data_url as the original_request_url. | |
2289 if (ds->hasUnreachableURL()) | |
2290 return ds->unreachableURL(); | |
2291 | |
2292 if (redirects.size() > 0) | |
darin (slow to review)
2014/03/11 20:04:32
nit: I'd use the .empty() method here instead: if
hush (inactive)
2014/03/12 21:34:21
Done
| |
2293 return redirects.at(0); | |
2294 | |
2295 return ds->originalRequest().url(); | |
2296 } | |
2297 | |
2284 } // namespace content | 2298 } // namespace content |
OLD | NEW |