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/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 // pending parameters that were saved. | 814 // pending parameters that were saved. |
815 if (params.url_is_unreachable && failed_pending_entry_id_ != 0) { | 815 if (params.url_is_unreachable && failed_pending_entry_id_ != 0) { |
816 details->did_replace_entry = failed_pending_entry_should_replace_; | 816 details->did_replace_entry = failed_pending_entry_should_replace_; |
817 } else { | 817 } else { |
818 details->did_replace_entry = pending_entry_ && | 818 details->did_replace_entry = pending_entry_ && |
819 pending_entry_->should_replace_entry(); | 819 pending_entry_->should_replace_entry(); |
820 } | 820 } |
821 | 821 |
822 // Do navigation-type specific actions. These will make and commit an entry. | 822 // Do navigation-type specific actions. These will make and commit an entry. |
823 details->type = ClassifyNavigation(rfh, params); | 823 details->type = ClassifyNavigation(rfh, params); |
824 #if DCHECK_IS_ON() | |
825 // For site-per-process, both ClassifyNavigation methods get it wrong (see | 824 // For site-per-process, both ClassifyNavigation methods get it wrong (see |
826 // http://crbug.com/464014) so don't worry about a mismatch if that's the | 825 // http://crbug.com/464014) so don't worry about a mismatch if that's the |
827 // case. | 826 // case. |
828 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 827 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
829 switches::kSitePerProcess)) { | 828 switches::kSitePerProcess)) { |
830 NavigationType new_type = ClassifyNavigationWithoutPageID(rfh, params); | 829 NavigationType new_type = ClassifyNavigationWithoutPageID(rfh, params); |
831 // There's constant disagreements over SAME_PAGE between the two classifiers | 830 // There's constant disagreements over SAME_PAGE between the two classifiers |
832 // so ignore disagreements if that's the case. Otherwise, enforce agreement. | 831 // so ignore disagreements if that's the case. Otherwise, enforce agreement. |
833 // TODO(avi): Work this out. | 832 // TODO(avi): Work this out. |
834 if (details->type != NAVIGATION_TYPE_SAME_PAGE && | 833 if (details->type != NAVIGATION_TYPE_SAME_PAGE && |
835 new_type != NAVIGATION_TYPE_SAME_PAGE) { | 834 new_type != NAVIGATION_TYPE_SAME_PAGE) { |
836 DCHECK_EQ(details->type, new_type); | 835 CHECK_EQ(details->type, new_type); |
837 } | 836 } |
838 } | 837 } |
839 #endif // DCHECK_IS_ON() | |
840 | 838 |
841 // is_in_page must be computed before the entry gets committed. | 839 // is_in_page must be computed before the entry gets committed. |
842 details->is_in_page = AreURLsInPageNavigation(rfh->GetLastCommittedURL(), | 840 details->is_in_page = AreURLsInPageNavigation(rfh->GetLastCommittedURL(), |
843 params.url, params.was_within_same_page, rfh); | 841 params.url, params.was_within_same_page, rfh); |
844 | 842 |
845 switch (details->type) { | 843 switch (details->type) { |
846 case NAVIGATION_TYPE_NEW_PAGE: | 844 case NAVIGATION_TYPE_NEW_PAGE: |
847 RendererDidNavigateToNewPage(rfh, params, details->did_replace_entry); | 845 RendererDidNavigateToNewPage(rfh, params, details->did_replace_entry); |
848 break; | 846 break; |
849 case NAVIGATION_TYPE_EXISTING_PAGE: | 847 case NAVIGATION_TYPE_EXISTING_PAGE: |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2018 } | 2016 } |
2019 } | 2017 } |
2020 } | 2018 } |
2021 | 2019 |
2022 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2020 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
2023 const base::Callback<base::Time()>& get_timestamp_callback) { | 2021 const base::Callback<base::Time()>& get_timestamp_callback) { |
2024 get_timestamp_callback_ = get_timestamp_callback; | 2022 get_timestamp_callback_ = get_timestamp_callback; |
2025 } | 2023 } |
2026 | 2024 |
2027 } // namespace content | 2025 } // namespace content |
OLD | NEW |