OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 bool is_main_frame, | 1355 bool is_main_frame, |
1356 const GURL& url) { | 1356 const GURL& url) { |
1357 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); | 1357 bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); |
1358 GURL validated_url(url); | 1358 GURL validated_url(url); |
1359 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), | 1359 render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(), |
1360 GetRenderProcessHost()->id(), &validated_url); | 1360 GetRenderProcessHost()->id(), &validated_url); |
1361 | 1361 |
1362 ProvisionalLoadDetails details( | 1362 ProvisionalLoadDetails details( |
1363 is_main_frame, | 1363 is_main_frame, |
1364 controller_.IsURLInPageNavigation(validated_url), | 1364 controller_.IsURLInPageNavigation(validated_url), |
1365 validated_url, std::string(), false, is_error_page, frame_id); | 1365 validated_url, std::string(), is_error_page, frame_id); |
1366 NotificationService::current()->Notify( | 1366 NotificationService::current()->Notify( |
1367 NotificationType::FRAME_PROVISIONAL_LOAD_START, | 1367 NotificationType::FRAME_PROVISIONAL_LOAD_START, |
1368 Source<NavigationController>(&controller_), | 1368 Source<NavigationController>(&controller_), |
1369 Details<ProvisionalLoadDetails>(&details)); | 1369 Details<ProvisionalLoadDetails>(&details)); |
1370 if (is_main_frame) { | 1370 if (is_main_frame) { |
1371 // If we're displaying a network error page do not reset the content | 1371 // If we're displaying a network error page do not reset the content |
1372 // settings delegate's cookies so the user has a chance to modify cookie | 1372 // settings delegate's cookies so the user has a chance to modify cookie |
1373 // settings. | 1373 // settings. |
1374 if (!is_error_page) | 1374 if (!is_error_page) |
1375 content_settings_delegate_->ClearCookieSpecificContentSettings(); | 1375 content_settings_delegate_->ClearCookieSpecificContentSettings(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 // Update the URL display. | 1449 // Update the URL display. |
1450 NotifyNavigationStateChanged(TabContents::INVALIDATE_URL); | 1450 NotifyNavigationStateChanged(TabContents::INVALIDATE_URL); |
1451 } | 1451 } |
1452 | 1452 |
1453 render_manager_.RendererAbortedProvisionalLoad(render_view_host()); | 1453 render_manager_.RendererAbortedProvisionalLoad(render_view_host()); |
1454 } | 1454 } |
1455 | 1455 |
1456 // Send out a notification that we failed a provisional load with an error. | 1456 // Send out a notification that we failed a provisional load with an error. |
1457 ProvisionalLoadDetails details( | 1457 ProvisionalLoadDetails details( |
1458 is_main_frame, controller_.IsURLInPageNavigation(validated_url), | 1458 is_main_frame, controller_.IsURLInPageNavigation(validated_url), |
1459 validated_url, std::string(), false, false, frame_id); | 1459 validated_url, std::string(), false, frame_id); |
1460 details.set_error_code(error_code); | 1460 details.set_error_code(error_code); |
1461 | 1461 |
1462 NotificationService::current()->Notify( | 1462 NotificationService::current()->Notify( |
1463 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 1463 NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
1464 Source<NavigationController>(&controller_), | 1464 Source<NavigationController>(&controller_), |
1465 Details<ProvisionalLoadDetails>(&details)); | 1465 Details<ProvisionalLoadDetails>(&details)); |
1466 } | 1466 } |
1467 | 1467 |
1468 void TabContents::OnDidLoadResourceFromMemoryCache( | 1468 void TabContents::OnDidLoadResourceFromMemoryCache( |
1469 const GURL& url, | 1469 const GURL& url, |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 // Send notification about committed provisional loads. This notification is | 2165 // Send notification about committed provisional loads. This notification is |
2166 // different from the NAV_ENTRY_COMMITTED notification which doesn't include | 2166 // different from the NAV_ENTRY_COMMITTED notification which doesn't include |
2167 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. | 2167 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. |
2168 if (details.type != NavigationType::NAV_IGNORE) { | 2168 if (details.type != NavigationType::NAV_IGNORE) { |
2169 // For AUTO_SUBFRAME navigations, an event for the main frame is generated | 2169 // For AUTO_SUBFRAME navigations, an event for the main frame is generated |
2170 // that is not recorded in the navigation history. For the purpose of | 2170 // that is not recorded in the navigation history. For the purpose of |
2171 // tracking navigation events, we treat this event as a sub frame navigation | 2171 // tracking navigation events, we treat this event as a sub frame navigation |
2172 // event. | 2172 // event. |
2173 bool is_main_frame = did_navigate ? details.is_main_frame : false; | 2173 bool is_main_frame = did_navigate ? details.is_main_frame : false; |
2174 ProvisionalLoadDetails load_details( | 2174 ProvisionalLoadDetails load_details( |
2175 is_main_frame, details.is_in_page, params.url, std::string(), false, | 2175 is_main_frame, details.is_in_page, params.url, std::string(), |
2176 false, params.frame_id); | 2176 false, params.frame_id); |
2177 load_details.set_transition_type(params.transition); | 2177 load_details.set_transition_type(params.transition); |
2178 // Whether or not a page transition was triggered by going backward or | 2178 // Whether or not a page transition was triggered by going backward or |
2179 // forward in the history is only stored in the navigation controller's | 2179 // forward in the history is only stored in the navigation controller's |
2180 // entry list. | 2180 // entry list. |
2181 if (did_navigate && | 2181 if (did_navigate && |
2182 (controller_.GetActiveEntry()->transition_type() & | 2182 (controller_.GetActiveEntry()->transition_type() & |
2183 PageTransition::FORWARD_BACK)) { | 2183 PageTransition::FORWARD_BACK)) { |
2184 load_details.set_transition_type( | 2184 load_details.set_transition_type( |
2185 params.transition | PageTransition::FORWARD_BACK); | 2185 params.transition | PageTransition::FORWARD_BACK); |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2847 } | 2847 } |
2848 | 2848 |
2849 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { | 2849 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { |
2850 prerender::PrerenderManager* pm = profile()->GetPrerenderManager(); | 2850 prerender::PrerenderManager* pm = profile()->GetPrerenderManager(); |
2851 if (pm != NULL) { | 2851 if (pm != NULL) { |
2852 if (pm->MaybeUsePreloadedPage(this, url)) | 2852 if (pm->MaybeUsePreloadedPage(this, url)) |
2853 return true; | 2853 return true; |
2854 } | 2854 } |
2855 return false; | 2855 return false; |
2856 } | 2856 } |
OLD | NEW |