diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-28 18:37:25 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-28 18:37:25 +0000 |
commit | 022af74f8f0ab0ed381cc64831c7ad3921d02a7b (patch) | |
tree | d5a9492eeb97f71fa6670114b4736bc1c756afb1 /chrome | |
parent | 4f57823d8673c30668f562ff20290bb12b3eda83 (diff) | |
download | chromium_src-022af74f8f0ab0ed381cc64831c7ad3921d02a7b.zip chromium_src-022af74f8f0ab0ed381cc64831c7ad3921d02a7b.tar.gz chromium_src-022af74f8f0ab0ed381cc64831c7ad3921d02a7b.tar.bz2 |
Remove the remaining usages of NavigationEntry in chrome by converting a few more NavigationController methods to return the interface. In a followup, I'll rename NavigationEntry to NavigationEntryImpl, then create an interface for NavigationController.
BUG=98716
TBR=joi
Review URL: http://codereview.chromium.org/9004045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115900 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
36 files changed, 120 insertions, 103 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 |