| 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() |
| 824 // For site-per-process, both ClassifyNavigation methods get it wrong (see | 825 // For site-per-process, both ClassifyNavigation methods get it wrong (see |
| 825 // http://crbug.com/464014) so don't worry about a mismatch if that's the | 826 // http://crbug.com/464014) so don't worry about a mismatch if that's the |
| 826 // case. | 827 // case. |
| 827 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 828 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 828 switches::kSitePerProcess)) { | 829 switches::kSitePerProcess)) { |
| 829 NavigationType new_type = ClassifyNavigationWithoutPageID(rfh, params); | 830 NavigationType new_type = ClassifyNavigationWithoutPageID(rfh, params); |
| 830 // There's constant disagreements over SAME_PAGE between the two classifiers | 831 // There's constant disagreements over SAME_PAGE between the two classifiers |
| 831 // so ignore disagreements if that's the case. Otherwise, enforce agreement. | 832 // so ignore disagreements if that's the case. Otherwise, enforce agreement. |
| 832 // TODO(avi): Work this out. | 833 // TODO(avi): Work this out. |
| 833 if (details->type != NAVIGATION_TYPE_SAME_PAGE && | 834 if (details->type != NAVIGATION_TYPE_SAME_PAGE && |
| 834 new_type != NAVIGATION_TYPE_SAME_PAGE) { | 835 new_type != NAVIGATION_TYPE_SAME_PAGE) { |
| 835 CHECK_EQ(details->type, new_type); | 836 DCHECK_EQ(details->type, new_type); |
| 836 } | 837 } |
| 837 } | 838 } |
| 839 #endif // DCHECK_IS_ON() |
| 838 | 840 |
| 839 // is_in_page must be computed before the entry gets committed. | 841 // is_in_page must be computed before the entry gets committed. |
| 840 details->is_in_page = AreURLsInPageNavigation(rfh->GetLastCommittedURL(), | 842 details->is_in_page = AreURLsInPageNavigation(rfh->GetLastCommittedURL(), |
| 841 params.url, params.was_within_same_page, rfh); | 843 params.url, params.was_within_same_page, rfh); |
| 842 | 844 |
| 843 switch (details->type) { | 845 switch (details->type) { |
| 844 case NAVIGATION_TYPE_NEW_PAGE: | 846 case NAVIGATION_TYPE_NEW_PAGE: |
| 845 RendererDidNavigateToNewPage(rfh, params, details->did_replace_entry); | 847 RendererDidNavigateToNewPage(rfh, params, details->did_replace_entry); |
| 846 break; | 848 break; |
| 847 case NAVIGATION_TYPE_EXISTING_PAGE: | 849 case NAVIGATION_TYPE_EXISTING_PAGE: |
| (...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 } | 2018 } |
| 2017 } | 2019 } |
| 2018 } | 2020 } |
| 2019 | 2021 |
| 2020 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2022 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 2021 const base::Callback<base::Time()>& get_timestamp_callback) { | 2023 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 2022 get_timestamp_callback_ = get_timestamp_callback; | 2024 get_timestamp_callback_ = get_timestamp_callback; |
| 2023 } | 2025 } |
| 2024 | 2026 |
| 2025 } // namespace content | 2027 } // namespace content |
| OLD | NEW |