| 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/browser/frame_host/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 !policy->IsWebSafeScheme(validated_url.scheme())) { | 185 !policy->IsWebSafeScheme(validated_url.scheme())) { |
| 186 validated_url = GURL(url::kAboutBlankURL); | 186 validated_url = GURL(url::kAboutBlankURL); |
| 187 } | 187 } |
| 188 | 188 |
| 189 if (is_main_frame && !is_error_page) { | 189 if (is_main_frame && !is_error_page) { |
| 190 DidStartMainFrameNavigation(validated_url, | 190 DidStartMainFrameNavigation(validated_url, |
| 191 render_frame_host->GetSiteInstance(), | 191 render_frame_host->GetSiteInstance(), |
| 192 render_frame_host->navigation_handle()); | 192 render_frame_host->navigation_handle()); |
| 193 } | 193 } |
| 194 | 194 |
| 195 if (delegate_) { | |
| 196 // Notify the observer about the start of the provisional load. | |
| 197 delegate_->DidStartProvisionalLoad(render_frame_host, validated_url, | |
| 198 is_error_page); | |
| 199 } | |
| 200 | |
| 201 if (is_error_page || IsBrowserSideNavigationEnabled()) | 195 if (is_error_page || IsBrowserSideNavigationEnabled()) |
| 202 return; | 196 return; |
| 203 | 197 |
| 204 if (render_frame_host->navigation_handle()) { | 198 if (render_frame_host->navigation_handle()) { |
| 205 if (render_frame_host->navigation_handle()->is_transferring()) { | 199 if (render_frame_host->navigation_handle()->is_transferring()) { |
| 206 // If the navigation is completing a transfer, this | 200 // If the navigation is completing a transfer, this |
| 207 // DidStartProvisionalLoad should not correspond to a new navigation. | 201 // DidStartProvisionalLoad should not correspond to a new navigation. |
| 208 DCHECK_EQ(url, render_frame_host->navigation_handle()->GetURL()); | 202 DCHECK_EQ(url, render_frame_host->navigation_handle()->GetURL()); |
| 209 render_frame_host->navigation_handle()->set_is_transferring(false); | 203 render_frame_host->navigation_handle()->set_is_transferring(false); |
| 210 return; | 204 return; |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 // After setting the last committed origin, reset the feature policy in the | 685 // After setting the last committed origin, reset the feature policy in the |
| 692 // RenderFrameHost to a blank policy based on the parent frame. | 686 // RenderFrameHost to a blank policy based on the parent frame. |
| 693 render_frame_host->ResetFeaturePolicy(); | 687 render_frame_host->ResetFeaturePolicy(); |
| 694 | 688 |
| 695 // Send notification about committed provisional loads. This notification is | 689 // Send notification about committed provisional loads. This notification is |
| 696 // different from the NAV_ENTRY_COMMITTED notification which doesn't include | 690 // different from the NAV_ENTRY_COMMITTED notification which doesn't include |
| 697 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. | 691 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. |
| 698 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { | 692 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { |
| 699 DCHECK_EQ(!render_frame_host->GetParent(), | 693 DCHECK_EQ(!render_frame_host->GetParent(), |
| 700 did_navigate ? details.is_main_frame : false); | 694 did_navigate ? details.is_main_frame : false); |
| 701 ui::PageTransition transition_type = params.transition; | |
| 702 // Whether or not a page transition was triggered by going backward or | |
| 703 // forward in the history is only stored in the navigation controller's | |
| 704 // entry list. | |
| 705 if (did_navigate && | |
| 706 (controller_->GetLastCommittedEntry()->GetTransitionType() & | |
| 707 ui::PAGE_TRANSITION_FORWARD_BACK)) { | |
| 708 transition_type = ui::PageTransitionFromInt( | |
| 709 params.transition | ui::PAGE_TRANSITION_FORWARD_BACK); | |
| 710 } | |
| 711 | |
| 712 delegate_->DidCommitProvisionalLoad(render_frame_host, | |
| 713 params.url, | |
| 714 transition_type); | |
| 715 navigation_handle->DidCommitNavigation(params, details.did_replace_entry, | 695 navigation_handle->DidCommitNavigation(params, details.did_replace_entry, |
| 716 details.previous_url, details.type, | 696 details.previous_url, details.type, |
| 717 render_frame_host); | 697 render_frame_host); |
| 718 navigation_handle.reset(); | 698 navigation_handle.reset(); |
| 719 } | 699 } |
| 720 | 700 |
| 721 if (!did_navigate) | 701 if (!did_navigate) |
| 722 return; // No navigation happened. | 702 return; // No navigation happened. |
| 723 | 703 |
| 724 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen | 704 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 if (navigation_handle) | 1305 if (navigation_handle) |
| 1326 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1306 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
| 1327 | 1307 |
| 1328 controller_->SetPendingEntry(std::move(entry)); | 1308 controller_->SetPendingEntry(std::move(entry)); |
| 1329 if (delegate_) | 1309 if (delegate_) |
| 1330 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1310 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
| 1331 } | 1311 } |
| 1332 } | 1312 } |
| 1333 | 1313 |
| 1334 } // namespace content | 1314 } // namespace content |
| OLD | NEW |