diff options
48 files changed, 295 insertions, 227 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 3059012..39ebd84 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -30,6 +30,7 @@ include_rules = [ # TODO(jam): this needs to be removed, and only use content/public. BUG=98716 "+content/browser", "-content/browser/notification_service_impl.h", + "-content/browser/tab_contents/navigation_entry.h", "-content/browser/plugin_service_impl.h", "-content/common", diff --git a/chrome/browser/alternate_nav_url_fetcher.cc b/chrome/browser/alternate_nav_url_fetcher.cc index 7771b3a..a602bf3 100644 --- a/chrome/browser/alternate_nav_url_fetcher.cc +++ b/chrome/browser/alternate_nav_url_fetcher.cc @@ -125,7 +125,7 @@ void AlternateNavURLFetcher::Observe( delete this; } else if (!controller_) { // Start listening for the commit notification. - DCHECK(controller->pending_entry()); + DCHECK(controller->GetPendingEntry()); registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<NavigationController>(controller)); StartFetch(controller); diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index e53bb958..ffb1cc1b 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -259,7 +259,7 @@ void NavigationControllerRestoredObserver::Observe( } bool NavigationControllerRestoredObserver::FinishedRestoring() { - return (!controller_->needs_reload() && !controller_->pending_entry() && + return (!controller_->needs_reload() && !controller_->GetPendingEntry() && !controller_->tab_contents()->IsLoading()); } diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc index d04ae23..eb2f601 100644 --- a/chrome/browser/browser_commands_unittest.cc +++ b/chrome/browser/browser_commands_unittest.cc @@ -9,8 +9,8 @@ #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/testing_profile.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/navigation_entry.h" #include "content/test/test_browser_thread.h" typedef BrowserWithTestWindowTest BrowserCommandsTest; diff --git a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc index 540dde8..3f2c8f6 100644 --- a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc +++ b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc @@ -6,7 +6,6 @@ #include "chrome/browser/chromeos/offline/offline_load_page.h" #include "chrome/browser/renderer_host/offline_resource_handler.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/test_tab_contents.h" #include "content/test/test_browser_thread.h" @@ -155,7 +154,7 @@ TEST_F(OfflineLoadPageTest, OfflinePageDontProceed) { EXPECT_EQ(CANCEL, user_response()); EXPECT_FALSE(GetOfflineLoadPage()); // We did not proceed, the pending entry should be gone. - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); // the URL is set back to kURL1. EXPECT_EQ(kURL1, contents()->GetURL().spec()); } diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc index 4387098..b94d1d7 100644 --- a/chrome/browser/crash_recovery_browsertest.cc +++ b/chrome/browser/crash_recovery_browsertest.cc @@ -8,7 +8,6 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" diff --git a/chrome/browser/download/download_request_limiter.cc b/chrome/browser/download/download_request_limiter.cc index 220bf5f..e12f7fb 100644 --- a/chrome/browser/download/download_request_limiter.cc +++ b/chrome/browser/download/download_request_limiter.cc @@ -13,9 +13,9 @@ #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/web_contents_delegate.h" @@ -114,7 +114,7 @@ void DownloadRequestLimiter::TabDownloadState::Observe( // request. If this happens we may let a download through that we // shouldn't have. But this is rather rare, and it is difficult to get // 100% right, so we don't deal with it. - NavigationEntry* entry = controller_->pending_entry(); + content::NavigationEntry* entry = controller_->GetPendingEntry(); if (!entry) return; diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc index 76d337b..9c1a027 100644 --- a/chrome/browser/favicon/favicon_tab_helper.cc +++ b/chrome/browser/favicon/favicon_tab_helper.cc @@ -12,10 +12,11 @@ #include "chrome/common/icon_messages.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_details.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents_delegate.h" #include "ui/gfx/codec/png_codec.h" @@ -73,7 +74,7 @@ bool FaviconTabHelper::FaviconIsValid() const { bool FaviconTabHelper::ShouldDisplayFavicon() { // Always display a throbber during pending loads. const NavigationController& controller = web_contents()->GetController(); - if (controller.GetLastCommittedEntry() && controller.pending_entry()) + if (controller.GetLastCommittedEntry() && controller.GetPendingEntry()) return true; WebUI* web_ui = web_contents()->GetWebUIForCurrentState(); diff --git a/chrome/browser/geolocation/geolocation_settings_state_unittest.cc b/chrome/browser/geolocation/geolocation_settings_state_unittest.cc index e58ce34..db41369 100644 --- a/chrome/browser/geolocation/geolocation_settings_state_unittest.cc +++ b/chrome/browser/geolocation/geolocation_settings_state_unittest.cc @@ -8,8 +8,8 @@ #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/geolocation/geolocation_settings_state.h" #include "chrome/test/base/testing_profile.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/public/browser/navigation_details.h" +#include "content/public/browser/navigation_entry.h" #include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -33,10 +33,11 @@ TEST_F(GeolocationSettingsStateTests, ClearOnNewOrigin) { GeolocationSettingsState state(&profile); GURL url_0("http://www.example.com"); - NavigationEntry entry; - entry.SetURL(url_0); + scoped_ptr<content::NavigationEntry> entry( + content::NavigationEntry::Create()); + entry->SetURL(url_0); content::LoadCommittedDetails load_committed_details; - load_committed_details.entry = &entry; + load_committed_details.entry = entry.get(); state.DidNavigate(load_committed_details); profile.GetHostContentSettingsMap()->SetContentSetting( @@ -121,7 +122,7 @@ TEST_F(GeolocationSettingsStateTests, ClearOnNewOrigin) { EXPECT_EQ(state_map.size(), new_state_map.size()); GURL different_url("http://foo.com"); - entry.SetURL(different_url); + entry->SetURL(different_url); state.DidNavigate(load_committed_details); EXPECT_TRUE(state.state_map().empty()); @@ -138,10 +139,11 @@ TEST_F(GeolocationSettingsStateTests, ShowPortOnSameHost) { GeolocationSettingsState state(&profile); GURL url_0("http://www.example.com"); - NavigationEntry entry; - entry.SetURL(url_0); + scoped_ptr<content::NavigationEntry> entry( + content::NavigationEntry::Create()); + entry->SetURL(url_0); content::LoadCommittedDetails load_committed_details; - load_committed_details.entry = &entry; + load_committed_details.entry = entry.get(); state.DidNavigate(load_committed_details); profile.GetHostContentSettingsMap()->SetContentSetting( diff --git a/chrome/browser/google/google_url_tracker.cc b/chrome/browser/google/google_url_tracker.cc index ee7aacb..6daa8e9 100644 --- a/chrome/browser/google/google_url_tracker.cc +++ b/chrome/browser/google/google_url_tracker.cc @@ -21,8 +21,8 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" #include "content/public/common/url_fetcher.h" #include "grit/generated_resources.h" @@ -324,7 +324,7 @@ void GoogleURLTracker::Observe(int type, case content::NOTIFICATION_NAV_ENTRY_PENDING: { NavigationController* controller = content::Source<NavigationController>(source).ptr(); - OnNavigationPending(source, controller->pending_entry()->GetURL()); + OnNavigationPending(source, controller->GetPendingEntry()->GetURL()); break; } diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 4c984b4..3644246 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -34,11 +34,12 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/provisional_load_details.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_details.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -97,7 +98,7 @@ class InstantLoader::FrameLoadObserver : public content::NotificationObserver { text_(text), verbatim_(verbatim), unique_id_( - tab_contents_->GetController().pending_entry()->GetUniqueID()) { + tab_contents_->GetController().GetPendingEntry()->GetUniqueID()) { registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, content::Source<TabContents>(tab_contents_)); } @@ -550,7 +551,7 @@ void InstantLoader::TabContentsDelegateImpl::OnSetSuggestions( TabContentsWrapper* source = loader_->preview_contents(); content::NavigationEntry* entry = source->tab_contents()->GetController().GetActiveEntry(); - if (! entry || page_id != entry->GetPageID()) + if (!entry || page_id != entry->GetPageID()) return; if (suggestions.empty()) @@ -811,7 +812,7 @@ void InstantLoader::MaybeLoadInstantURL(TabContentsWrapper* tab_contents, bool InstantLoader::IsNavigationPending() const { return preview_contents_.get() && - preview_contents_->tab_contents()->GetController().pending_entry(); + preview_contents_->tab_contents()->GetController().GetPendingEntry(); } void InstantLoader::Observe(int type, diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index c48a6c4..9569c05 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -19,9 +19,9 @@ #include "content/browser/browser_child_process_host.h" #include "content/browser/renderer_host/backing_store_manager.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/bindings_policy.h" #include "content/public/common/process_type.h" @@ -284,8 +284,8 @@ void MemoryDetails::CollectChildInfoOnUIThread() { // last committed entry. // // Either the pending or last committed entries can be NULL. - const NavigationEntry* pending_entry = - contents->GetController().pending_entry(); + const content::NavigationEntry* pending_entry = + contents->GetController().GetPendingEntry(); const content::NavigationEntry* last_committed_entry = contents->GetController().GetLastCommittedEntry(); if ((last_committed_entry && diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 2eea9c5..8a2e56e 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -27,11 +27,11 @@ #include "chrome/common/print_messages.h" #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/webui/web_ui.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" @@ -302,7 +302,7 @@ void CloudPrintFlowHandler::RegisterMessages() { // to the real server URL, now that we've gotten an HTML dialog // going. NavigationController* controller = &web_ui_->tab_contents()->GetController(); - NavigationEntry* pending_entry = controller->pending_entry(); + content::NavigationEntry* pending_entry = controller->GetPendingEntry(); if (pending_entry) { Profile* profile = Profile::FromWebUI(web_ui_); pending_entry->SetURL( diff --git a/chrome/browser/printing/print_preview_tab_controller_unittest.cc b/chrome/browser/printing/print_preview_tab_controller_unittest.cc index 313f16c..037ed35 100644 --- a/chrome/browser/printing/print_preview_tab_controller_unittest.cc +++ b/chrome/browser/printing/print_preview_tab_controller_unittest.cc @@ -10,7 +10,6 @@ #include "chrome/browser/ui/webui/print_preview_ui.h" #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/testing_profile.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc index 0872512..a191790 100644 --- a/chrome/browser/rlz/rlz.cc +++ b/chrome/browser/rlz/rlz.cc @@ -32,8 +32,8 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/env_vars.h" #include "chrome/installer/util/google_update_settings.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" using content::BrowserThread; @@ -305,8 +305,8 @@ void RLZTracker::Observe(int type, content::NotificationService::AllSources()); break; case content::NOTIFICATION_NAV_ENTRY_PENDING: { - const NavigationEntry* entry = - content::Details<NavigationEntry>(details).ptr(); + const content::NavigationEntry* entry = + content::Details<content::NavigationEntry>(details).ptr(); if (entry != NULL && ((entry->GetTransitionType() & content::PAGE_TRANSITION_HOME_PAGE) != 0)) { diff --git a/chrome/browser/rlz/rlz_unittest.cc b/chrome/browser/rlz/rlz_unittest.cc index 6253a9f..1e28437 100644 --- a/chrome/browser/rlz/rlz_unittest.cc +++ b/chrome/browser/rlz/rlz_unittest.cc @@ -17,7 +17,7 @@ #include "chrome/common/env_vars.h" #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_constants.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" @@ -237,11 +237,13 @@ void RlzLibTest::SimulateOmniboxUsage() { } void RlzLibTest::SimulateHomepageUsage() { - NavigationEntry entry(NULL, 0, GURL(), content::Referrer(), string16(), - content::PAGE_TRANSITION_HOME_PAGE, false); + scoped_ptr<content::NavigationEntry> entry( + content::NavigationEntry::Create()); + entry->SetPageID(0); + entry->SetTransitionType(content::PAGE_TRANSITION_HOME_PAGE); tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, content::NotificationService::AllSources(), - content::Details<NavigationEntry>(&entry)); + content::Details<content::NavigationEntry>(entry.get())); } void RlzLibTest::InvokeDelayedInit() { @@ -580,14 +582,16 @@ TEST_F(RlzLibTest, PingUpdatesRlzCache) { } TEST_F(RlzLibTest, ObserveHandlesBadArgs) { - NavigationEntry entry(NULL, 0, GURL(), content::Referrer(), string16(), - content::PAGE_TRANSITION_LINK, false); + scoped_ptr<content::NavigationEntry> entry( + content::NavigationEntry::Create()); + entry->SetPageID(0); + entry->SetTransitionType(content::PAGE_TRANSITION_LINK); tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, content::NotificationService::AllSources(), - content::Details<NavigationEntry>(NULL)); + content::Details<content::NavigationEntry>(NULL)); tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, content::NotificationService::AllSources(), - content::Details<NavigationEntry>(&entry)); + content::Details<content::NavigationEntry>(entry.get())); } TEST_F(RlzLibTest, ReactivationNonOrganicNonOrganic) { diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc index 3771571..ccf8b69e 100644 --- a/chrome/browser/safe_browsing/browser_feature_extractor.cc +++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc @@ -21,8 +21,8 @@ #include "chrome/browser/safe_browsing/browser_features.h" #include "chrome/browser/safe_browsing/client_side_detection_service.h" #include "chrome/common/safe_browsing/csd.pb.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" #include "content/public/common/page_transition_types.h" #include "googleurl/src/gurl.h" @@ -52,7 +52,7 @@ static void AddNavigationFeatures(const std::string& feature_prefix, int index, const std::vector<GURL>& redirect_chain, ClientPhishingRequest* request) { - NavigationEntry* entry = controller.GetEntryAtIndex(index); + content::NavigationEntry* entry = controller.GetEntryAtIndex(index); bool is_secure_referrer = entry->GetReferrer().url.SchemeIsSecure(); if (!is_secure_referrer) { AddFeature(StringPrintf("%s%s=%s", @@ -162,7 +162,7 @@ void BrowserFeatureExtractor::ExtractFeatures(const BrowseInfo* info, // The url that we are extracting features for should already be commited. DCHECK_NE(index, -1); for (; index >= 0; index--) { - NavigationEntry* entry = controller.GetEntryAtIndex(index); + content::NavigationEntry* entry = controller.GetEntryAtIndex(index); if (url_index == -1 && entry->GetURL() == request_url) { // It's possible that we've been on the on the possibly phishy url before // in this tab, so make sure that we use the latest navigation for diff --git a/chrome/browser/safe_browsing/malware_details_unittest.cc b/chrome/browser/safe_browsing/malware_details_unittest.cc index e913da5..274861e 100644 --- a/chrome/browser/safe_browsing/malware_details_unittest.cc +++ b/chrome/browser/safe_browsing/malware_details_unittest.cc @@ -18,7 +18,6 @@ #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/test_url_request_context_getter.h" #include "chrome/test/base/testing_profile.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/test_tab_contents.h" #include "content/test/test_browser_thread.h" #include "net/base/io_buffer.h" diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc index ac15628..6165f1c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc @@ -9,8 +9,8 @@ #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/test_tab_contents.h" +#include "content/public/browser/navigation_entry.h" #include "content/test/test_browser_thread.h" using content::BrowserThread; @@ -115,7 +115,8 @@ class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness, } void GoBack(bool is_cross_site) { - NavigationEntry* entry = contents()->GetController().GetEntryAtOffset(-1); + content::NavigationEntry* entry = + contents()->GetController().GetEntryAtOffset(-1); ASSERT_TRUE(entry); contents()->GetController().GoBack(); @@ -217,7 +218,7 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwarePageDontProceed) { EXPECT_FALSE(GetSafeBrowsingBlockingPage()); // We did not proceed, the pending entry should be gone. - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); // A report should have been sent. EXPECT_EQ(1u, service_->GetDetails()->size()); @@ -581,7 +582,7 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwareReportsDisabled) { EXPECT_FALSE(GetSafeBrowsingBlockingPage()); // We did not proceed, the pending entry should be gone. - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); // No report should have been sent. EXPECT_EQ(0u, service_->GetDetails()->size()); diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index fda9b3f..830d3bb 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -32,9 +32,9 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_details.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_details.h" @@ -1139,8 +1139,8 @@ void SessionService::BuildCommandsForTab( wrapper->extension_tab_helper()->extension_app()->id())); } for (int i = min_index; i < max_index; ++i) { - const NavigationEntry* entry = (i == pending_index) ? - tab->tab_contents()->GetController().pending_entry() : + const content::NavigationEntry* entry = (i == pending_index) ? + tab->tab_contents()->GetController().GetPendingEntry() : tab->tab_contents()->GetController().GetEntryAtIndex(i); DCHECK(entry); if (ShouldTrackEntry(entry->GetVirtualURL())) { diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc index 5fa12e7..f93b475 100644 --- a/chrome/browser/sessions/session_service_unittest.cc +++ b/chrome/browser/sessions/session_service_unittest.cc @@ -22,7 +22,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/testing_profile.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" @@ -69,15 +69,16 @@ class SessionServiceTest : public BrowserWithTestWindowTest, const TabNavigation& navigation, int index, bool select) { - NavigationEntry entry; - entry.SetURL(navigation.virtual_url()); - entry.set_referrer(navigation.referrer()); - entry.SetTitle(navigation.title()); - entry.SetContentState(navigation.state()); - entry.set_transition_type(navigation.transition()); - entry.SetHasPostData( + scoped_ptr<content::NavigationEntry> entry( + content::NavigationEntry::Create()); + entry->SetURL(navigation.virtual_url()); + entry->SetReferrer(navigation.referrer()); + entry->SetTitle(navigation.title()); + entry->SetContentState(navigation.state()); + entry->SetTransitionType(navigation.transition()); + entry->SetHasPostData( navigation.type_mask() & TabNavigation::HAS_POST_DATA); - service()->UpdateTabNavigation(window_id, tab_id, index, entry); + service()->UpdateTabNavigation(window_id, tab_id, index, *entry.get()); if (select) service()->SetSelectedNavigationIndex(window_id, tab_id, index); } diff --git a/chrome/browser/sessions/session_types.cc b/chrome/browser/sessions/session_types.cc index fdccab8..30c2a11 100644 --- a/chrome/browser/sessions/session_types.cc +++ b/chrome/browser/sessions/session_types.cc @@ -8,7 +8,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/public/browser/navigation_entry.h" // TabNavigation -------------------------------------------------------------- @@ -58,9 +58,9 @@ TabNavigation& TabNavigation::operator=(const TabNavigation& tab) { } // static -NavigationEntry* TabNavigation::ToNavigationEntry(int page_id, - Profile *profile) const { - NavigationEntry* entry = NavigationController::CreateNavigationEntry( +content::NavigationEntry* TabNavigation::ToNavigationEntry( + int page_id, Profile *profile) const { + content::NavigationEntry* entry = NavigationController::CreateNavigationEntry( virtual_url_, referrer_, // Use a transition type of reload so that we don't incorrectly diff --git a/chrome/browser/sessions/session_types.h b/chrome/browser/sessions/session_types.h index d5c496a..03cbd57 100644 --- a/chrome/browser/sessions/session_types.h +++ b/chrome/browser/sessions/session_types.h @@ -19,7 +19,6 @@ #include "ui/base/ui_base_types.h" #include "ui/gfx/rect.h" -class NavigationEntry; class Profile; namespace content { @@ -51,7 +50,8 @@ class TabNavigation { // Converts this TabNavigation into a NavigationEntry with a page id of // |page_id|. The caller owns the returned NavigationEntry. - NavigationEntry* ToNavigationEntry(int page_id, Profile* profile) const; + content::NavigationEntry* ToNavigationEntry(int page_id, + Profile* profile) const; // Resets this TabNavigation from |entry|. void SetFromNavigationEntry(const content::NavigationEntry& entry); diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc index 9c1d066..f6e9646 100644 --- a/chrome/browser/sessions/tab_restore_service.cc +++ b/chrome/browser/sessions/tab_restore_service.cc @@ -28,8 +28,8 @@ #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/url_constants.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/navigation_entry.h" using base::Time; @@ -492,7 +492,7 @@ void TabRestoreService::PopulateTab(Tab* tab, tab->navigations.resize(static_cast<int>(entry_count)); for (int i = 0; i < entry_count; ++i) { content::NavigationEntry* entry = (i == pending_index) ? - controller->pending_entry() : controller->GetEntryAtIndex(i); + controller->GetPendingEntry() : controller->GetEntryAtIndex(i); tab->navigations[i].SetFromNavigationEntry(*entry); } tab->timestamp = TimeNow(); @@ -657,7 +657,7 @@ void TabRestoreService::ScheduleCommandsForTab(const Tab& tab, // Creating a NavigationEntry isn't the most efficient way to go about // this, but it simplifies the code and makes it less error prone as we // add new data to NavigationEntry. - scoped_ptr<NavigationEntry> entry( + scoped_ptr<content::NavigationEntry> entry( navigations[i].ToNavigationEntry(wrote_count, profile())); ScheduleCommand( CreateUpdateTabNavigationCommand(kCommandUpdateTabNavigation, tab.id, diff --git a/chrome/browser/sessions/tab_restore_service_browsertest.cc b/chrome/browser/sessions/tab_restore_service_browsertest.cc index 068564e..991cfe3 100644 --- a/chrome/browser/sessions/tab_restore_service_browsertest.cc +++ b/chrome/browser/sessions/tab_restore_service_browsertest.cc @@ -13,8 +13,8 @@ #include "chrome/test/base/chrome_render_view_test.h" #include "chrome/test/base/testing_profile.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/test_tab_contents.h" +#include "content/public/browser/navigation_entry.h" #include "content/test/render_view_test.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" @@ -99,9 +99,10 @@ class TabRestoreServiceTest : public ChromeRenderViewHostTestHarness { session_service->SetSelectedTabInWindow(window_id, 0); if (pinned) session_service->SetPinnedState(window_id, tab_id, true); - NavigationEntry entry; - entry.SetURL(url1_); - session_service->UpdateTabNavigation(window_id, tab_id, 0, entry); + scoped_ptr<content::NavigationEntry> entry( + content::NavigationEntry::Create());; + entry->SetURL(url1_); + session_service->UpdateTabNavigation(window_id, tab_id, 0, *entry.get()); } // Creates a SessionService and assigns it to the Profile. The SessionService diff --git a/chrome/browser/sync/profile_sync_service_session_unittest.cc b/chrome/browser/sync/profile_sync_service_session_unittest.cc index 131236f..15ec731 100644 --- a/chrome/browser/sync/profile_sync_service_session_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_session_unittest.cc @@ -42,7 +42,7 @@ #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/profile_mock.h" #include "chrome/test/base/testing_profile.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/tabs/pinned_tab_codec.cc b/chrome/browser/tabs/pinned_tab_codec.cc index 5831504..abac1c0 100644 --- a/chrome/browser/tabs/pinned_tab_codec.cc +++ b/chrome/browser/tabs/pinned_tab_codec.cc @@ -14,8 +14,8 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/navigation_entry.h" typedef BrowserInit::LaunchWithProfile::Tab Tab; @@ -54,7 +54,7 @@ static void EncodePinnedTab(TabStripModel* model, value->SetString(kURL, extension->GetFullLaunchURL().spec()); values->Append(value.release()); } else { -content::NavigationEntry* entry = + content::NavigationEntry* entry = tab_contents->tab_contents()->GetController().GetActiveEntry(); if (!entry && tab_contents->tab_contents()->GetController().entry_count()) entry = tab_contents->tab_contents()->GetController().GetEntryAtIndex(0); diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc index 140bcc7..e8c683d 100644 --- a/chrome/browser/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/tabs/tab_strip_model_unittest.cc @@ -30,8 +30,8 @@ #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_profile.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 502bf85..4a92d74 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -147,12 +147,12 @@ #include "content/browser/site_instance.h" #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/devtools_manager.h" #include "content/public/browser/download_item.h" #include "content/public/browser/download_manager.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/plugin_service.h" diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc index b2df4f0..21ce12b 100644 --- a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc +++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc @@ -11,7 +11,8 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.h" #include "chrome/common/render_messages.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/public/browser/favicon_status.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" #include "content/public/common/frame_navigate_params.h" @@ -147,7 +148,7 @@ void SearchEngineTabHelper::GenerateKeywordIfNecessary( // happen in new tabs. if (last_index <= 0) return; - const NavigationEntry* previous_entry = + const content::NavigationEntry* previous_entry = controller.GetEntryAtIndex(last_index - 1); if (IsFormSubmit(previous_entry)) { // Only generate a keyword if the previous page wasn't itself a form diff --git a/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc b/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc index 7dc2a63..623fee8 100644 --- a/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc +++ b/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc @@ -10,7 +10,7 @@ #include "chrome/browser/sessions/restore_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/extensions/extension.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/public/browser/navigation_entry.h" TabContentsWrapperSyncedTabDelegate::TabContentsWrapperSyncedTabDelegate( TabContentsWrapper* tab_contents_wrapper) @@ -61,7 +61,8 @@ int TabContentsWrapperSyncedTabDelegate::GetPendingEntryIndex() const { content::NavigationEntry* TabContentsWrapperSyncedTabDelegate::GetPendingEntry() const { - return tab_contents_wrapper_->tab_contents()->GetController().pending_entry(); + return + tab_contents_wrapper_->tab_contents()->GetController().GetPendingEntry(); } content::NavigationEntry* @@ -73,5 +74,6 @@ content::NavigationEntry* content::NavigationEntry* TabContentsWrapperSyncedTabDelegate::GetActiveEntry() const { - return tab_contents_wrapper_->tab_contents()->GetController().GetActiveEntry(); + return + tab_contents_wrapper_->tab_contents()->GetController().GetActiveEntry(); } diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.cc b/chrome/browser/ui/toolbar/back_forward_menu_model.cc index 056adb9..9c4932b 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc @@ -16,8 +16,9 @@ #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/favicon_status.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/user_metrics.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -89,7 +90,7 @@ string16 BackForwardMenuModel::GetLabelAt(int index) const { // Return the entry title, escaping any '&' characters and eliding it if it's // super long. - NavigationEntry* entry = GetNavigationEntry(index); + content::NavigationEntry* entry = GetNavigationEntry(index); Profile* profile = Profile::FromBrowserContext(GetTabContents()->GetBrowserContext()); string16 menu_text(entry->GetTitleForDisplay( @@ -134,7 +135,7 @@ bool BackForwardMenuModel::GetIconAt(int index, SkBitmap* icon) { *icon = *ResourceBundle::GetSharedInstance().GetBitmapNamed( IDR_HISTORY_FAVICON); } else { - NavigationEntry* entry = GetNavigationEntry(index); + content::NavigationEntry* entry = GetNavigationEntry(index); *icon = entry->GetFavicon().bitmap; if (!entry->GetFavicon().valid && menu_model_delegate()) { FetchFavicon(entry); @@ -222,7 +223,7 @@ void BackForwardMenuModel::SetMenuModelDelegate( menu_model_delegate_ = menu_model_delegate; } -void BackForwardMenuModel::FetchFavicon(NavigationEntry* entry) { +void BackForwardMenuModel::FetchFavicon(content::NavigationEntry* entry) { // If the favicon has already been requested for this menu, don't do // anything. if (requested_favicons_.find(entry->GetUniqueID()) != @@ -247,7 +248,7 @@ void BackForwardMenuModel::OnFavIconDataAvailable( if (favicon.is_valid()) { int unique_id = load_consumer_.GetClientDataForCurrentRequest(); // Find the current model_index for the unique_id. - NavigationEntry* entry = NULL; + content::NavigationEntry* entry = NULL; int model_index = -1; for (int i = 0; i < GetItemCount() - 1; i++) { if (IsSeparator(i)) @@ -347,7 +348,8 @@ int BackForwardMenuModel::GetIndexOfNextChapterStop(int start_from, } } - NavigationEntry* start_entry = controller.GetEntryAtIndex(start_from); + content::NavigationEntry* start_entry = + controller.GetEntryAtIndex(start_from); const GURL& url = start_entry->GetURL(); if (!forward) { @@ -438,7 +440,8 @@ int BackForwardMenuModel::MenuIndexToNavEntryIndex(int index) const { return index; } -NavigationEntry* BackForwardMenuModel::GetNavigationEntry(int index) const { +content::NavigationEntry* BackForwardMenuModel::GetNavigationEntry( + int index) const { int controller_index = MenuIndexToNavEntryIndex(index); NavigationController& controller = GetTabContents()->GetController(); if (controller_index >= 0 && controller_index < controller.entry_count()) diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.h b/chrome/browser/ui/toolbar/back_forward_menu_model.h index 69a7c54..70d5f9e 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model.h +++ b/chrome/browser/ui/toolbar/back_forward_menu_model.h @@ -19,7 +19,10 @@ class Browser; class SkBitmap; class TabContents; + +namespace content { class NavigationEntry; +} /////////////////////////////////////////////////////////////////////////////// // @@ -85,7 +88,7 @@ class BackForwardMenuModel : public ui::MenuModel { // Requests a favicon from the FaviconService. Called by GetIconAt if the // NavigationEntry has an invalid favicon. - void FetchFavicon(NavigationEntry* entry); + void FetchFavicon(content::NavigationEntry* entry); // Callback from the favicon service. void OnFavIconDataAvailable(FaviconService::Handle handle, @@ -163,7 +166,7 @@ class BackForwardMenuModel : public ui::MenuModel { string16 GetShowFullHistoryLabel() const; // Looks up a NavigationEntry by menu id. - NavigationEntry* GetNavigationEntry(int index) const; + content::NavigationEntry* GetNavigationEntry(int index) const; // Retrieves the TabContents pointer to use, which is either the one that // the unit test sets (using SetTabContentsForUnitTest) or the one from diff --git a/chrome/browser/ui/webui/cloud_print_signin_dialog.cc b/chrome/browser/ui/webui/cloud_print_signin_dialog.cc index 840654a..1374586 100644 --- a/chrome/browser/ui/webui/cloud_print_signin_dialog.cc +++ b/chrome/browser/ui/webui/cloud_print_signin_dialog.cc @@ -20,9 +20,9 @@ #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" @@ -64,7 +64,7 @@ void CloudPrintSigninFlowHandler::RegisterMessages() { if (web_ui_ && web_ui_->tab_contents()) { NavigationController* controller = &web_ui_->tab_contents()->GetController(); - NavigationEntry* pending_entry = controller->pending_entry(); + content::NavigationEntry* pending_entry = controller->GetPendingEntry(); if (pending_entry) pending_entry->SetURL(CloudPrintURL( Profile::FromWebUI(web_ui_)).GetCloudPrintSigninURL()); diff --git a/chrome/browser/ui/webui/web_ui_unittest.cc b/chrome/browser/ui/webui/web_ui_unittest.cc index 33f8e7f..e022e93 100644 --- a/chrome/browser/ui/webui/web_ui_unittest.cc +++ b/chrome/browser/ui/webui/web_ui_unittest.cc @@ -35,7 +35,7 @@ class WebUITest : public TabContentsWrapperTestHarness { std::string()); // The navigation entry should be pending with no committed entry. - ASSERT_TRUE(controller->pending_entry()); + ASSERT_TRUE(controller->GetPendingEntry()); ASSERT_FALSE(controller->GetLastCommittedEntry()); // Check the things the pending Web UI should have set. diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc index e760a4d..f0a6571 100644 --- a/chrome/test/base/browser_with_test_window_test.cc +++ b/chrome/test/base/browser_with_test_window_test.cc @@ -14,8 +14,8 @@ #include "chrome/common/render_messages.h" #include "chrome/test/base/testing_profile.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/common/page_transition_types.h" using content::BrowserThread; @@ -71,7 +71,7 @@ void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) { void BrowserWithTestWindowTest::CommitPendingLoad( NavigationController* controller) { - if (!controller->pending_entry()) + if (!controller->GetPendingEntry()) return; // Nothing to commit. TestRenderViewHost* old_rvh = @@ -95,15 +95,15 @@ void BrowserWithTestWindowTest::CommitPendingLoad( // just have a standalong pending_entry that isn't in the list already). if (controller->pending_entry_index() >= 0) { test_rvh->SendNavigateWithTransition( - controller->pending_entry()->GetPageID(), - controller->pending_entry()->GetURL(), - controller->pending_entry()->GetTransitionType()); + controller->GetPendingEntry()->GetPageID(), + controller->GetPendingEntry()->GetURL(), + controller->GetPendingEntry()->GetTransitionType()); } else { test_rvh->SendNavigateWithTransition( controller->tab_contents()-> GetMaxPageIDForSiteInstance(test_rvh->site_instance()) + 1, - controller->pending_entry()->GetURL(), - controller->pending_entry()->GetTransitionType()); + controller->GetPendingEntry()->GetURL(), + controller->GetPendingEntry()->GetTransitionType()); } // Simulate the SwapOut_ACK that fires if you commit a cross-site navigation diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index 0cfd8c0..d9590e1 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -136,7 +136,7 @@ InterstitialPage::InterstitialPage(TabContents* tab, // (which is the case when the interstitial was triggered by a sub-resource on // a page) when we have a pending entry (in the process of loading a new top // frame). - DCHECK(new_navigation || !tab->GetController().pending_entry()); + DCHECK(new_navigation || !tab->GetController().GetPendingEntry()); } InterstitialPage::~InterstitialPage() { diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc index 2c85578..2e1b31d 100644 --- a/content/browser/tab_contents/navigation_controller.cc +++ b/content/browser/tab_contents/navigation_controller.cc @@ -75,7 +75,7 @@ void ConfigureEntriesForRestore( for (size_t i = 0; i < entries->size(); ++i) { // Use a transition type of reload so that we don't incorrectly increase // the typed count. - (*entries)[i]->set_transition_type(content::PAGE_TRANSITION_RELOAD); + (*entries)[i]->SetTransitionType(content::PAGE_TRANSITION_RELOAD); (*entries)[i]->set_restore_type(from_last_session ? NavigationEntry::RESTORE_LAST_SESSION : NavigationEntry::RESTORE_CURRENT_SESSION); @@ -151,7 +151,7 @@ void NavigationController::Restore( bool from_last_session, std::vector<content::NavigationEntry*>* entries) { // Verify that this controller is unused and that the input is valid. - DCHECK(entry_count() == 0 && !pending_entry()); + DCHECK(entry_count() == 0 && !GetPendingEntry()); DCHECK(selected_navigation >= 0 && selected_navigation < static_cast<int>(entries->size())); @@ -205,7 +205,7 @@ void NavigationController::ReloadInternal(bool check_for_repost, DiscardNonCommittedEntriesInternal(); pending_entry_index_ = current_index; - entries_[pending_entry_index_]->set_transition_type( + entries_[pending_entry_index_]->SetTransitionType( content::PAGE_TRANSITION_RELOAD); NavigateToPendingEntry(reload_type); } @@ -230,7 +230,20 @@ bool NavigationController::IsInitialNavigation() { } // static -NavigationEntry* NavigationController::CreateNavigationEntry( +content::NavigationEntry* NavigationController::CreateNavigationEntry( + const GURL& url, + const content::Referrer& referrer, + content::PageTransition transition, + bool is_renderer_initiated, + const std::string& extra_headers, + content::BrowserContext* browser_context) { + return CreateNavigationEntryImpl( + url, referrer, transition, is_renderer_initiated, extra_headers, + browser_context); +} + +// static +NavigationEntry* NavigationController::CreateNavigationEntryImpl( const GURL& url, const content::Referrer& referrer, content::PageTransition transition, bool is_renderer_initiated, const std::string& extra_headers, @@ -288,7 +301,7 @@ void NavigationController::LoadEntry(NavigationEntry* entry) { content::NotificationService::current()->Notify( content::NOTIFICATION_NAV_ENTRY_PENDING, content::Source<NavigationController>(this), - content::Details<NavigationEntry>(entry)); + content::Details<content::NavigationEntry>(entry)); NavigateToPendingEntry(NO_RELOAD); } @@ -338,7 +351,13 @@ bool NavigationController::CanViewSource() const { is_supported_mime_type && !tab_contents_->GetInterstitialPage(); } -NavigationEntry* NavigationController::GetEntryAtOffset(int offset) const { +content::NavigationEntry* NavigationController::GetEntryAtIndex( + int index) const { + return entries_.at(index).get(); +} + +content::NavigationEntry* NavigationController::GetEntryAtOffset( + int offset) const { int index = (transient_entry_index_ != -1) ? transient_entry_index_ + offset : last_committed_entry_index_ + offset; @@ -369,7 +388,7 @@ void NavigationController::GoBack() { DiscardNonCommittedEntries(); pending_entry_index_ = current_index - 1; - entries_[pending_entry_index_]->set_transition_type( + entries_[pending_entry_index_]->SetTransitionType( content::PageTransitionFromInt( entries_[pending_entry_index_]->GetTransitionType() | content::PAGE_TRANSITION_FORWARD_BACK)); @@ -395,7 +414,7 @@ void NavigationController::GoForward() { if (!transient) pending_entry_index_++; - entries_[pending_entry_index_]->set_transition_type( + entries_[pending_entry_index_]->SetTransitionType( content::PageTransitionFromInt( entries_[pending_entry_index_]->GetTransitionType() | content::PAGE_TRANSITION_FORWARD_BACK)); @@ -422,7 +441,7 @@ void NavigationController::GoToIndex(int index) { DiscardNonCommittedEntries(); pending_entry_index_ = index; - entries_[pending_entry_index_]->set_transition_type( + entries_[pending_entry_index_]->SetTransitionType( content::PageTransitionFromInt( entries_[pending_entry_index_]->GetTransitionType() | content::PAGE_TRANSITION_FORWARD_BACK)); @@ -476,10 +495,10 @@ void NavigationController::TransferURL( // The user initiated a load, we don't need to reload anymore. needs_reload_ = false; - NavigationEntry* entry = CreateNavigationEntry(url, referrer, transition, - is_renderer_initiated, - extra_headers, - browser_context_); + NavigationEntry* entry = CreateNavigationEntryImpl(url, referrer, transition, + is_renderer_initiated, + extra_headers, + browser_context_); entry->set_transferred_global_request_id(transferred_global_request_id); LoadEntry(entry); @@ -493,10 +512,10 @@ void NavigationController::LoadURL( // The user initiated a load, we don't need to reload anymore. needs_reload_ = false; - NavigationEntry* entry = CreateNavigationEntry(url, referrer, transition, - false, - extra_headers, - browser_context_); + NavigationEntry* entry = CreateNavigationEntryImpl(url, referrer, transition, + false, + extra_headers, + browser_context_); LoadEntry(entry); } @@ -509,10 +528,10 @@ void NavigationController::LoadURLFromRenderer( // The user initiated a load, we don't need to reload anymore. needs_reload_ = false; - NavigationEntry* entry = CreateNavigationEntry(url, referrer, transition, - true, - extra_headers, - browser_context_); + NavigationEntry* entry = CreateNavigationEntryImpl(url, referrer, transition, + true, + extra_headers, + browser_context_); LoadEntry(entry); } @@ -767,9 +786,9 @@ void NavigationController::RendererDidNavigateToNewPage( new_entry->SetURL(params.url); if (update_virtual_url) UpdateVirtualURLToURL(new_entry, params.url); - new_entry->set_referrer(params.referrer); + new_entry->SetReferrer(params.referrer); new_entry->SetPageID(params.page_id); - new_entry->set_transition_type(params.transition); + new_entry->SetTransitionType(params.transition); new_entry->set_site_instance(tab_contents_->GetSiteInstance()); new_entry->SetHasPostData(params.is_post); @@ -935,7 +954,7 @@ bool NavigationController::IsURLInPageNavigation(const GURL& url) const { void NavigationController::CopyStateFrom(const NavigationController& source) { // Verify that we look new. - DCHECK(entry_count() == 0 && !pending_entry()); + DCHECK(entry_count() == 0 && !GetPendingEntry()); if (source.entry_count() == 0) return; // Nothing new to do. @@ -1055,6 +1074,10 @@ void NavigationController::DiscardNonCommittedEntries() { } } +content::NavigationEntry* NavigationController::GetPendingEntry() const { + return pending_entry_; +} + void NavigationController::InsertOrReplaceEntry(NavigationEntry* entry, bool replace) { DCHECK(entry->GetTransitionType() != content::PAGE_TRANSITION_AUTO_SUBFRAME); @@ -1205,8 +1228,8 @@ void NavigationController::LoadIfNecessary() { NavigateToPendingEntry(NO_RELOAD); } -void NavigationController::NotifyEntryChanged(const NavigationEntry* entry, - int index) { +void NavigationController::NotifyEntryChanged( + const content::NavigationEntry* entry, int index) { content::EntryChangedDetails det; det.changed_entry = entry; det.index = index; @@ -1254,7 +1277,7 @@ int NavigationController::GetEntryIndexWithPageID( return -1; } -NavigationEntry* NavigationController::GetTransientEntry() const { +content::NavigationEntry* NavigationController::GetTransientEntry() const { if (transient_entry_index_ == -1) return NULL; return entries_[transient_entry_index_].get(); diff --git a/content/browser/tab_contents/navigation_controller.h b/content/browser/tab_contents/navigation_controller.h index 1a309d5..79372a26 100644 --- a/content/browser/tab_contents/navigation_controller.h +++ b/content/browser/tab_contents/navigation_controller.h @@ -121,13 +121,11 @@ class CONTENT_EXPORT NavigationController { return static_cast<int>(entries_.size()); } - NavigationEntry* GetEntryAtIndex(int index) const { - return entries_.at(index).get(); - } + content::NavigationEntry* GetEntryAtIndex(int index) const; // Returns the entry at the specified offset from current. Returns NULL // if out of bounds. - NavigationEntry* GetEntryAtOffset(int offset) const; + content::NavigationEntry* GetEntryAtOffset(int offset) const; // Returns the index of the specified entry, or -1 if entry is not contained // in this NavigationController. @@ -150,9 +148,7 @@ class CONTENT_EXPORT NavigationController { // Returns the pending entry corresponding to the navigation that is // currently in progress, or null if there is none. - NavigationEntry* pending_entry() const { - return pending_entry_; - } + content::NavigationEntry* GetPendingEntry() const; // Returns the index of the pending entry or -1 if the pending entry // corresponds to a new navigation (created via LoadURL). @@ -173,7 +169,7 @@ class CONTENT_EXPORT NavigationController { // Returns the transient entry if any. Note that the returned entry is owned // by the navigation controller and may be deleted at any time. - NavigationEntry* GetTransientEntry() const; + content::NavigationEntry* GetTransientEntry() const; // New navigations ----------------------------------------------------------- @@ -273,7 +269,7 @@ class CONTENT_EXPORT NavigationController { // Broadcasts the NOTIFY_NAV_ENTRY_CHANGED notification for the given entry // (which must be at the given index). This will keep things in sync like // the saved session. - void NotifyEntryChanged(const NavigationEntry* entry, int index); + void NotifyEntryChanged(const content::NavigationEntry* entry, int index); // Returns true if the given URL would be an in-page navigation (i.e. only // the reference fragment is different) from the "last committed entry". We do @@ -351,7 +347,14 @@ class CONTENT_EXPORT NavigationController { // Creates navigation entry and translates the virtual url to a real one. // Used when navigating to a new URL using LoadURL. Extra headers are // separated by \n. - static NavigationEntry* CreateNavigationEntry( + static content::NavigationEntry* CreateNavigationEntry( + const GURL& url, + const content::Referrer& referrer, + content::PageTransition transition, + bool is_renderer_initiated, + const std::string& extra_headers, + content::BrowserContext* browser_context); + static NavigationEntry* CreateNavigationEntryImpl( const GURL& url, const content::Referrer& referrer, content::PageTransition transition, diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc index e532fb4..e533f5f 100644 --- a/content/browser/tab_contents/navigation_controller_unittest.cc +++ b/content/browser/tab_contents/navigation_controller_unittest.cc @@ -75,7 +75,7 @@ class TestWebContentsDelegate : public content::WebContentsDelegate { // ----------------------------------------------------------------------------- TEST_F(NavigationControllerTest, Defaults) { - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().GetLastCommittedEntry()); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_EQ(controller().last_committed_entry_index(), -1); @@ -102,7 +102,7 @@ TEST_F(NavigationControllerTest, LoadURL) { EXPECT_EQ(controller().last_committed_entry_index(), -1); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_FALSE(controller().GetLastCommittedEntry()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); EXPECT_EQ(contents()->GetMaxPageID(), -1); @@ -119,7 +119,7 @@ TEST_F(NavigationControllerTest, LoadURL) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); EXPECT_EQ(contents()->GetMaxPageID(), 0); @@ -133,7 +133,7 @@ TEST_F(NavigationControllerTest, LoadURL) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); // TODO(darin): maybe this should really be true? EXPECT_FALSE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); @@ -151,7 +151,7 @@ TEST_F(NavigationControllerTest, LoadURL) { EXPECT_EQ(controller().last_committed_entry_index(), 1); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); EXPECT_EQ(contents()->GetMaxPageID(), 1); @@ -186,7 +186,7 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); } @@ -216,7 +216,7 @@ TEST_F(NavigationControllerTest, LoadURL_Discarded) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); } @@ -392,7 +392,7 @@ TEST_F(NavigationControllerTest, LoadURL_IgnorePreemptsPending) { std::string()); EXPECT_EQ(0U, notifications.size()); EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_EQ(-1, controller().last_committed_entry_index()); EXPECT_EQ(1, delegate->navigation_state_change_count()); @@ -403,7 +403,7 @@ TEST_F(NavigationControllerTest, LoadURL_IgnorePreemptsPending) { // This should clear the pending entry and notify of a navigation state // change, so that we do not keep displaying kNewURL. EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_EQ(-1, controller().last_committed_entry_index()); EXPECT_EQ(2, delegate->navigation_state_change_count()); @@ -430,7 +430,7 @@ TEST_F(NavigationControllerTest, LoadURL_AbortCancelsPending) { std::string()); EXPECT_EQ(0U, notifications.size()); EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_EQ(-1, controller().last_committed_entry_index()); EXPECT_EQ(1, delegate->navigation_state_change_count()); @@ -450,7 +450,7 @@ TEST_F(NavigationControllerTest, LoadURL_AbortCancelsPending) { // This should clear the pending entry and notify of a navigation state // change, so that we do not keep displaying kNewURL. EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_EQ(-1, controller().last_committed_entry_index()); EXPECT_EQ(2, delegate->navigation_state_change_count()); @@ -478,7 +478,7 @@ TEST_F(NavigationControllerTest, LoadURL_RedirectAbortCancelsPending) { std::string()); EXPECT_EQ(0U, notifications.size()); EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_EQ(-1, controller().last_committed_entry_index()); EXPECT_EQ(1, delegate->navigation_state_change_count()); @@ -493,7 +493,7 @@ TEST_F(NavigationControllerTest, LoadURL_RedirectAbortCancelsPending) { // We don't want to change the NavigationEntry's url, in case it cancels. // Prevents regression of http://crbug.com/77786. - EXPECT_EQ(kNewURL, controller().pending_entry()->GetURL()); + EXPECT_EQ(kNewURL, controller().GetPendingEntry()->GetURL()); // It may abort before committing, if it's a download or due to a stop or // a new navigation from the user. @@ -511,7 +511,7 @@ TEST_F(NavigationControllerTest, LoadURL_RedirectAbortCancelsPending) { // This should clear the pending entry and notify of a navigation state // change, so that we do not keep displaying kNewURL. EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_EQ(-1, controller().last_committed_entry_index()); EXPECT_EQ(2, delegate->navigation_state_change_count()); @@ -539,7 +539,7 @@ TEST_F(NavigationControllerTest, Reload) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_EQ(controller().pending_entry_index(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); @@ -552,7 +552,7 @@ TEST_F(NavigationControllerTest, Reload) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); } @@ -583,7 +583,7 @@ TEST_F(NavigationControllerTest, Reload_GeneratesNewPage) { EXPECT_EQ(controller().last_committed_entry_index(), 1); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); } @@ -611,7 +611,7 @@ TEST_F(NavigationControllerTest, Back) { EXPECT_EQ(controller().last_committed_entry_index(), 1); EXPECT_EQ(controller().pending_entry_index(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); EXPECT_TRUE(controller().CanGoForward()); @@ -624,7 +624,7 @@ TEST_F(NavigationControllerTest, Back) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); EXPECT_TRUE(controller().CanGoForward()); } @@ -658,7 +658,7 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { EXPECT_EQ(controller().last_committed_entry_index(), 1); EXPECT_EQ(controller().pending_entry_index(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); EXPECT_TRUE(controller().CanGoForward()); @@ -672,7 +672,7 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { EXPECT_EQ(controller().last_committed_entry_index(), 2); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); } @@ -701,13 +701,13 @@ TEST_F(NavigationControllerTest, Back_NewPending) { kUrl3, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_EQ(kUrl3, controller().pending_entry()->GetURL()); + EXPECT_EQ(kUrl3, controller().GetPendingEntry()->GetURL()); controller().GoBack(); // The pending navigation should now be the "back" item and the new one // should be gone. EXPECT_EQ(0, controller().pending_entry_index()); - EXPECT_EQ(kUrl1, controller().pending_entry()->GetURL()); + EXPECT_EQ(kUrl1, controller().GetPendingEntry()->GetURL()); } // Receives a back message when there is a different renavigation already @@ -785,7 +785,7 @@ TEST_F(NavigationControllerTest, Forward) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_EQ(controller().pending_entry_index(), 1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); @@ -798,7 +798,7 @@ TEST_F(NavigationControllerTest, Forward) { EXPECT_EQ(controller().last_committed_entry_index(), 1); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); } @@ -832,7 +832,7 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_EQ(controller().pending_entry_index(), 1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); @@ -845,7 +845,7 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { EXPECT_EQ(controller().last_committed_entry_index(), 1); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); } @@ -872,7 +872,7 @@ TEST_F(NavigationControllerTest, Redirect) { controller().LoadURL( url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_EQ(url1, controller().GetActiveEntry()->GetURL()); @@ -899,7 +899,7 @@ TEST_F(NavigationControllerTest, Redirect) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_EQ(controller().pending_entry_index(), -1); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_EQ(url2, controller().GetActiveEntry()->GetURL()); EXPECT_FALSE(controller().CanGoBack()); @@ -930,7 +930,7 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { controller().LoadURL( url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_EQ(url1, controller().GetActiveEntry()->GetURL()); @@ -957,7 +957,7 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_EQ(controller().pending_entry_index(), -1); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_EQ(url2, controller().GetActiveEntry()->GetURL()); EXPECT_FALSE(controller().GetActiveEntry()->GetHasPostData()); @@ -977,7 +977,7 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) { controller().LoadURL( url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - EXPECT_TRUE(controller().pending_entry()); + EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_EQ(url1, controller().GetActiveEntry()->GetURL()); @@ -1004,7 +1004,7 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) { EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_EQ(controller().pending_entry_index(), -1); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_EQ(url2, controller().GetActiveEntry()->GetURL()); EXPECT_FALSE(controller().CanGoBack()); @@ -1182,7 +1182,7 @@ TEST_F(NavigationControllerTest, LinkClick) { EXPECT_EQ(controller().last_committed_entry_index(), 1); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); } @@ -1476,7 +1476,7 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { // Create a NavigationController with a restored set of tabs. GURL url("http://foo"); std::vector<content::NavigationEntry*> entries; - NavigationEntry* entry = NavigationController::CreateNavigationEntry( + NavigationEntry* entry = NavigationController::CreateNavigationEntryImpl( url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, std::string(), browser_context()); entry->SetPageID(0); @@ -1492,19 +1492,23 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { // Before navigating to the restored entry, it should have a restore_type // and no SiteInstance. EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, - our_controller.GetEntryAtIndex(0)->restore_type()); - EXPECT_FALSE(our_controller.GetEntryAtIndex(0)->site_instance()); + NavigationEntry::FromNavigationEntry( + our_controller.GetEntryAtIndex(0))->restore_type()); + EXPECT_FALSE(NavigationEntry::FromNavigationEntry( + our_controller.GetEntryAtIndex(0))->site_instance()); // After navigating, we should have one entry, and it should be "pending". // It should now have a SiteInstance and no restore_type. our_controller.GoToIndex(0); EXPECT_EQ(1, our_controller.entry_count()); EXPECT_EQ(our_controller.GetEntryAtIndex(0), - our_controller.pending_entry()); + our_controller.GetPendingEntry()); EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); EXPECT_EQ(NavigationEntry::RESTORE_NONE, - our_controller.GetEntryAtIndex(0)->restore_type()); - EXPECT_TRUE(our_controller.GetEntryAtIndex(0)->site_instance()); + NavigationEntry::FromNavigationEntry + (our_controller.GetEntryAtIndex(0))->restore_type()); + EXPECT_TRUE(NavigationEntry::FromNavigationEntry( + our_controller.GetEntryAtIndex(0))->site_instance()); // Say we navigated to that entry. ViewHostMsg_FrameNavigate_Params params; @@ -1523,13 +1527,14 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { // commit it properly. EXPECT_EQ(1, our_controller.entry_count()); EXPECT_EQ(0, our_controller.last_committed_entry_index()); - EXPECT_FALSE(our_controller.pending_entry()); + EXPECT_FALSE(our_controller.GetPendingEntry()); EXPECT_EQ(url, NavigationEntry::FromNavigationEntry( our_controller.GetLastCommittedEntry())->site_instance()-> site()); EXPECT_EQ(NavigationEntry::RESTORE_NONE, - our_controller.GetEntryAtIndex(0)->restore_type()); + NavigationEntry::FromNavigationEntry( + our_controller.GetEntryAtIndex(0))->restore_type()); } // Tests that we can still navigate to a restored entry after a different @@ -1538,7 +1543,7 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { // Create a NavigationController with a restored set of tabs. GURL url("http://foo"); std::vector<content::NavigationEntry*> entries; - NavigationEntry* entry = NavigationController::CreateNavigationEntry( + NavigationEntry* entry = NavigationController::CreateNavigationEntryImpl( url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, std::string(), browser_context()); entry->SetPageID(0); @@ -1554,19 +1559,23 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { // Before navigating to the restored entry, it should have a restore_type // and no SiteInstance. EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, - our_controller.GetEntryAtIndex(0)->restore_type()); - EXPECT_FALSE(our_controller.GetEntryAtIndex(0)->site_instance()); + NavigationEntry::FromNavigationEntry( + our_controller.GetEntryAtIndex(0))->restore_type()); + EXPECT_FALSE(NavigationEntry::FromNavigationEntry( + our_controller.GetEntryAtIndex(0))->site_instance()); // After navigating, we should have one entry, and it should be "pending". // It should now have a SiteInstance and no restore_type. our_controller.GoToIndex(0); EXPECT_EQ(1, our_controller.entry_count()); EXPECT_EQ(our_controller.GetEntryAtIndex(0), - our_controller.pending_entry()); + our_controller.GetPendingEntry()); EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); EXPECT_EQ(NavigationEntry::RESTORE_NONE, - our_controller.GetEntryAtIndex(0)->restore_type()); - EXPECT_TRUE(our_controller.GetEntryAtIndex(0)->site_instance()); + NavigationEntry::FromNavigationEntry( + our_controller.GetEntryAtIndex(0))->restore_type()); + EXPECT_TRUE(NavigationEntry::FromNavigationEntry( + our_controller.GetEntryAtIndex(0))->site_instance()); // This pending navigation may have caused a different navigation to fail, // which causes the pending entry to be cleared. @@ -1598,13 +1607,14 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { // There should be no pending entry and one committed one. EXPECT_EQ(1, our_controller.entry_count()); EXPECT_EQ(0, our_controller.last_committed_entry_index()); - EXPECT_FALSE(our_controller.pending_entry()); + EXPECT_FALSE(our_controller.GetPendingEntry()); EXPECT_EQ(url, NavigationEntry::FromNavigationEntry( our_controller.GetLastCommittedEntry())->site_instance()-> site()); EXPECT_EQ(NavigationEntry::RESTORE_NONE, - our_controller.GetEntryAtIndex(0)->restore_type()); + NavigationEntry::FromNavigationEntry( + our_controller.GetEntryAtIndex(0))->restore_type()); } // Make sure that the page type and stuff is correct after an interstitial. @@ -1619,7 +1629,8 @@ TEST_F(NavigationControllerTest, Interstitial) { const GURL url2("http://bar"); controller().LoadURL( url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - controller().pending_entry()->set_page_type(content::PAGE_TYPE_INTERSTITIAL); + NavigationEntry::FromNavigationEntry(controller().GetPendingEntry())-> + set_page_type(content::PAGE_TYPE_INTERSTITIAL); // At this point the interstitial will be displayed and the load will still // be pending. If the user continues, the load will commit. @@ -1667,13 +1678,13 @@ TEST_F(NavigationControllerTest, RemoveEntry) { controller().RemoveEntryAtIndex(controller().entry_count() - 1); EXPECT_EQ(4, controller().entry_count()); EXPECT_EQ(3, controller().last_committed_entry_index()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); // Remove an entry which is not the last committed one. controller().RemoveEntryAtIndex(0); EXPECT_EQ(3, controller().entry_count()); EXPECT_EQ(2, controller().last_committed_entry_index()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); // Remove the 2 remaining entries. controller().RemoveEntryAtIndex(1); @@ -1719,7 +1730,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { EXPECT_EQ(controller().last_committed_entry_index(), 1); EXPECT_EQ(controller().pending_entry_index(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); EXPECT_EQ(contents()->GetMaxPageID(), 1); @@ -1841,7 +1852,9 @@ TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { std::string()); EXPECT_EQ(url1, controller().GetActiveEntry()->GetURL()); EXPECT_EQ(url0, controller().GetVisibleEntry()->GetURL()); - EXPECT_TRUE(controller().pending_entry()->is_renderer_initiated()); + EXPECT_TRUE( + NavigationEntry::FromNavigationEntry(controller().GetPendingEntry())-> + is_renderer_initiated()); // After commit, both should be updated, and we should no longer treat the // entry as renderer-initiated. @@ -1996,7 +2009,8 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune) { NavigationController& other_controller = other_contents->GetController(); other_contents->NavigateAndCommit(url3); other_contents->ExpectSetHistoryLengthAndPrune( - other_controller.GetEntryAtIndex(0)->site_instance(), 2, + NavigationEntry::FromNavigationEntry( + other_controller.GetEntryAtIndex(0))->site_instance(), 2, other_controller.GetEntryAtIndex(0)->GetPageID()); other_controller.CopyStateFromAndPrune(&controller()); @@ -2064,9 +2078,9 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune3) { EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); // And there should be a pending entry for url3. - ASSERT_TRUE(other_controller.pending_entry()); + ASSERT_TRUE(other_controller.GetPendingEntry()); - EXPECT_EQ(url3, other_controller.pending_entry()->GetURL()); + EXPECT_EQ(url3, other_controller.GetPendingEntry()->GetURL()); } // Tests that navigations initiated from the page (with the history object) diff --git a/content/browser/tab_contents/navigation_entry.cc b/content/browser/tab_contents/navigation_entry.cc index a14bdfc..4649514 100644 --- a/content/browser/tab_contents/navigation_entry.cc +++ b/content/browser/tab_contents/navigation_entry.cc @@ -92,6 +92,10 @@ const GURL& NavigationEntry::GetURL() const { return url_; } +void NavigationEntry::SetReferrer(const content::Referrer& referrer) { + referrer_ = referrer; +} + const content::Referrer& NavigationEntry::GetReferrer() const { return referrer_; } @@ -169,6 +173,11 @@ bool NavigationEntry::IsViewSourceMode() const { return virtual_url_.SchemeIs(chrome::kViewSourceScheme); } +void NavigationEntry::SetTransitionType( + content::PageTransition transition_type) { + transition_type_ = transition_type; +} + content::PageTransition NavigationEntry::GetTransitionType() const { return transition_type_; } diff --git a/content/browser/tab_contents/navigation_entry.h b/content/browser/tab_contents/navigation_entry.h index aab192d..d2e18dd 100644 --- a/content/browser/tab_contents/navigation_entry.h +++ b/content/browser/tab_contents/navigation_entry.h @@ -37,6 +37,7 @@ class CONTENT_EXPORT NavigationEntry virtual content::PageType GetPageType() const OVERRIDE; virtual void SetURL(const GURL& url) OVERRIDE; virtual const GURL& GetURL() const OVERRIDE; + virtual void SetReferrer(const content::Referrer& referrer) OVERRIDE; virtual const content::Referrer& GetReferrer() const OVERRIDE; virtual void SetVirtualURL(const GURL& url) OVERRIDE; virtual const GURL& GetVirtualURL() const OVERRIDE; @@ -49,6 +50,8 @@ class CONTENT_EXPORT NavigationEntry virtual const string16& GetTitleForDisplay( const std::string& languages) const OVERRIDE; virtual bool IsViewSourceMode() const OVERRIDE; + virtual void SetTransitionType( + content::PageTransition transition_type) OVERRIDE; virtual content::PageTransition GetTransitionType() const OVERRIDE; virtual const GURL& GetUserTypedURL() const OVERRIDE; virtual void SetHasPostData(bool has_post_data) OVERRIDE; @@ -62,10 +65,6 @@ class CONTENT_EXPORT NavigationEntry unique_id_ = unique_id; } - void set_transition_type(content::PageTransition transition_type) { - transition_type_ = transition_type; - } - // The SiteInstance tells us how to share sub-processes when the tab type is // TAB_CONTENTS_WEB. This will be NULL otherwise. This is a reference counted // pointer to a shared site instance. @@ -82,10 +81,6 @@ class CONTENT_EXPORT NavigationEntry page_type_ = page_type; } - void set_referrer(const content::Referrer& referrer) { - referrer_ = referrer; - } - bool has_virtual_url() const { return !virtual_url_.is_empty(); } diff --git a/content/browser/tab_contents/navigation_entry_unittest.cc b/content/browser/tab_contents/navigation_entry_unittest.cc index 66128ba..2e8712d 100644 --- a/content/browser/tab_contents/navigation_entry_unittest.cc +++ b/content/browser/tab_contents/navigation_entry_unittest.cc @@ -130,7 +130,7 @@ TEST_F(NavigationEntryTest, NavigationEntryAccessors) { // Referrer EXPECT_EQ(GURL(), entry1_.get()->GetReferrer().url); EXPECT_EQ(GURL("from"), entry2_.get()->GetReferrer().url); - entry2_.get()->set_referrer( + entry2_.get()->SetReferrer( content::Referrer(GURL("from2"), WebKit::WebReferrerPolicyDefault)); EXPECT_EQ(GURL("from2"), entry2_.get()->GetReferrer().url); @@ -155,7 +155,7 @@ TEST_F(NavigationEntryTest, NavigationEntryAccessors) { // Transition type EXPECT_EQ(content::PAGE_TRANSITION_LINK, entry1_.get()->GetTransitionType()); EXPECT_EQ(content::PAGE_TRANSITION_TYPED, entry2_.get()->GetTransitionType()); - entry2_.get()->set_transition_type(content::PAGE_TRANSITION_RELOAD); + entry2_.get()->SetTransitionType(content::PAGE_TRANSITION_RELOAD); EXPECT_EQ(content::PAGE_TRANSITION_RELOAD, entry2_.get()->GetTransitionType()); diff --git a/content/browser/tab_contents/render_view_host_manager_unittest.cc b/content/browser/tab_contents/render_view_host_manager_unittest.cc index a114d4a..497cd5f 100644 --- a/content/browser/tab_contents/render_view_host_manager_unittest.cc +++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc @@ -242,7 +242,7 @@ TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) { EXPECT_EQ(controller().last_committed_entry_index(), 1); ASSERT_TRUE(controller().GetLastCommittedEntry()); EXPECT_TRUE(kUrl == controller().GetLastCommittedEntry()->GetURL()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); // Because we're using TestTabContents and TestRenderViewHost in this // unittest, no one calls TabContents::RenderViewCreated(). So, we see no // EnableViewSourceMode message, here. @@ -257,7 +257,7 @@ TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) { EXPECT_TRUE(last_rvh == rvh()); rvh()->SendNavigate(new_id, kUrl); // The same page_id returned. EXPECT_EQ(controller().last_committed_entry_index(), 1); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); // New message should be sent out to make sure to enter view-source mode. EXPECT_TRUE(process()->sink().GetUniqueMessageMatching( ViewMsg_EnableViewSourceMode::ID)); diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index d29557b..215dcde 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -778,7 +778,9 @@ WebContents* TabContents::OpenURL(const OpenURLParams& params) { bool TabContents::NavigateToPendingEntry( NavigationController::ReloadType reload_type) { - return NavigateToEntry(*controller_.pending_entry(), reload_type); + return NavigateToEntry( + *NavigationEntry::FromNavigationEntry(controller_.GetPendingEntry()), + reload_type); } bool TabContents::NavigateToEntry( @@ -1087,7 +1089,7 @@ WebUI* TabContents::GetWebUIForCurrentState() { // // - Normal state with no load: committed nav entry + no pending nav entry: // -> Use committed Web UI. - if (controller_.pending_entry() && + if (controller_.GetPendingEntry() && (controller_.GetLastCommittedEntry() || render_manager_.pending_web_ui())) return render_manager_.pending_web_ui(); @@ -1161,9 +1163,9 @@ void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, // TODO(creis): Remove this method and have the pre-rendering code listen to // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification // instead. See http://crbug.com/78512. - NavigationEntry* entry; + content::NavigationEntry* entry; if (page_id == -1) - entry = controller_.pending_entry(); + entry = controller_.GetPendingEntry(); else entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id); if (!entry || entry->GetURL() != source_url) @@ -1220,8 +1222,7 @@ void TabContents::OnDidFailProvisionalLoadWithError( // entry if the user started a new navigation. As a result, the navigation // controller may not remember that a load is in progress, but the // navigation will still commit even if there is no pending entry. - NavigationEntry* pending_entry = controller_.pending_entry(); - if (pending_entry) + if (controller_.GetPendingEntry()) DidCancelLoading(); render_manager_.RendererAbortedProvisionalLoad(GetRenderViewHost()); @@ -1328,13 +1329,14 @@ void TabContents::OnUpdateContentRestrictions(int restrictions) { void TabContents::OnGoToEntryAtOffset(int offset) { if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) { - NavigationEntry* entry = controller_.GetEntryAtOffset(offset); + NavigationEntry* entry = NavigationEntry::FromNavigationEntry( + controller_.GetEntryAtOffset(offset)); if (!entry) return; // Note that we don't call NavigationController::GotToOffset() as we don't // want to create a pending navigation entry (it might end up lingering // http://crbug.com/51680). - entry->set_transition_type( + entry->SetTransitionType( content::PageTransitionFromInt( entry->GetTransitionType() | content::PAGE_TRANSITION_FORWARD_BACK)); @@ -1758,7 +1760,7 @@ void TabContents::UpdateState(RenderViewHost* rvh, rvh->site_instance(), page_id); if (entry_index < 0) return; - NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); + content::NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); if (state == entry->GetContentState()) return; // Nothing to update. diff --git a/content/browser/tab_contents/tab_contents_unittest.cc b/content/browser/tab_contents/tab_contents_unittest.cc index 1482928..4a2fdfd 100644 --- a/content/browser/tab_contents/tab_contents_unittest.cc +++ b/content/browser/tab_contents/tab_contents_unittest.cc @@ -716,13 +716,13 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) { // Go back within the site. controller().GoBack(); EXPECT_FALSE(contents()->cross_navigation_pending()); - EXPECT_EQ(entry2, controller().pending_entry()); + EXPECT_EQ(entry2, controller().GetPendingEntry()); // Before that commits, go back again. controller().GoBack(); EXPECT_TRUE(contents()->cross_navigation_pending()); EXPECT_TRUE(contents()->pending_rvh()); - EXPECT_EQ(entry1, controller().pending_entry()); + EXPECT_EQ(entry1, controller().GetPendingEntry()); // Simulate beforeunload approval. EXPECT_TRUE(google_rvh->is_waiting_for_beforeunload_ack()); @@ -734,7 +734,7 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) { // We should commit this page and forget about the second back. EXPECT_FALSE(contents()->cross_navigation_pending()); - EXPECT_FALSE(controller().pending_entry()); + EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_EQ(google_rvh, contents()->GetRenderViewHost()); EXPECT_EQ(url2, controller().GetLastCommittedEntry()->GetURL()); @@ -1680,7 +1680,8 @@ TEST_F(TabContentsTest, NewInterstitialDoesNotCancelPendingEntry) { interstitial2->TestDidNavigate(1, kGURL); // Make sure we still have an entry. - NavigationEntry* entry = contents()->GetController().pending_entry(); + content::NavigationEntry* entry = + contents()->GetController().GetPendingEntry(); ASSERT_TRUE(entry); EXPECT_EQ(kUrl, entry->GetURL().spec()); @@ -1756,7 +1757,8 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) { NavigationController& other_controller = other_contents->GetController(); other_contents->NavigateAndCommit(url3); other_contents->ExpectSetHistoryLengthAndPrune( - other_controller.GetEntryAtIndex(0)->site_instance(), 1, + NavigationEntry::FromNavigationEntry( + other_controller.GetEntryAtIndex(0))->site_instance(), 1, other_controller.GetEntryAtIndex(0)->GetPageID()); other_controller.CopyStateFromAndPrune(&controller()); @@ -1799,7 +1801,8 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneTargetInterstitial) { EXPECT_TRUE(interstitial->is_showing()); EXPECT_EQ(2, other_controller.entry_count()); other_contents->ExpectSetHistoryLengthAndPrune( - other_controller.GetEntryAtIndex(0)->site_instance(), 1, + NavigationEntry::FromNavigationEntry( + other_controller.GetEntryAtIndex(0))->site_instance(), 1, other_controller.GetEntryAtIndex(0)->GetPageID()); other_controller.CopyStateFromAndPrune(&controller()); diff --git a/content/browser/tab_contents/test_tab_contents.cc b/content/browser/tab_contents/test_tab_contents.cc index 7ec09ba..f989f5d 100644 --- a/content/browser/tab_contents/test_tab_contents.cc +++ b/content/browser/tab_contents/test_tab_contents.cc @@ -111,7 +111,7 @@ void TestTabContents::CommitPendingNavigation() { if (!rvh) rvh = static_cast<TestRenderViewHost*>(old_rvh); - const NavigationEntry* entry = GetController().pending_entry(); + const content::NavigationEntry* entry = GetController().GetPendingEntry(); DCHECK(entry); int page_id = entry->GetPageID(); if (page_id == -1) { diff --git a/content/public/browser/navigation_entry.h b/content/public/browser/navigation_entry.h index bec474b..d3b8268b 100644 --- a/content/public/browser/navigation_entry.h +++ b/content/public/browser/navigation_entry.h @@ -50,6 +50,7 @@ class NavigationEntry { virtual const GURL& GetURL() const = 0; // The referring URL. Can be empty. + virtual void SetReferrer(const content::Referrer& referrer) = 0; virtual const content::Referrer& GetReferrer() const = 0; // The virtual URL, when nonempty, will override the actual URL of the page @@ -103,6 +104,7 @@ class NavigationEntry { // The transition type indicates what the user did to move to this page from // the previous page. + virtual void SetTransitionType(content::PageTransition transition_type) = 0; virtual content::PageTransition GetTransitionType() const = 0; // The user typed URL was the URL that the user initiated the navigation |