diff options
84 files changed, 620 insertions, 552 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 39ebd84..aa8a766 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -30,7 +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/tab_contents/navigation_entry_impl.h", "-content/browser/plugin_service_impl.h", "-content/common", diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 6282a55..f4f2284 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -155,6 +155,7 @@ using content::BrowserThread; using content::ChildProcessHost; using content::DownloadItem; using content::DownloadManager; +using content::NavigationEntry; using content::PluginService; using content::OpenURLParams; using content::Referrer; @@ -1284,7 +1285,7 @@ void TestingAutomationProvider::GetTabTitle(int handle, *title_string_size = -1; // -1 is the error code if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); - content::NavigationEntry* entry = tab->GetActiveEntry(); + NavigationEntry* entry = tab->GetActiveEntry(); if (entry != NULL) { *title = UTF16ToWideHack(entry->GetTitleForDisplay("")); } else { @@ -1573,7 +1574,7 @@ void TestingAutomationProvider::GetSecurityState( int* insecure_content_status) { if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); - content::NavigationEntry* entry = tab->GetActiveEntry(); + NavigationEntry* entry = tab->GetActiveEntry(); *success = true; *security_style = entry->GetSSL().security_style; *ssl_cert_status = entry->GetSSL().cert_status; @@ -1592,7 +1593,7 @@ void TestingAutomationProvider::GetPageType( content::PageType* page_type) { if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); - content::NavigationEntry* entry = tab->GetActiveEntry(); + NavigationEntry* entry = tab->GetActiveEntry(); *page_type = entry->GetPageType(); *success = true; // In order to return the proper result when an interstitial is shown and @@ -1619,7 +1620,7 @@ void TestingAutomationProvider::ActionOnSSLBlockingPage( IPC::Message* reply_message) { if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); - content::NavigationEntry* entry = tab->GetActiveEntry(); + NavigationEntry* entry = tab->GetActiveEntry(); if (entry->GetPageType() == content::PAGE_TYPE_INTERSTITIAL) { TabContents* tab_contents = tab->tab_contents(); InterstitialPage* ssl_blocking_page = @@ -2972,7 +2973,7 @@ void TestingAutomationProvider::GetNavigationInfo( } scoped_ptr<DictionaryValue> return_value(new DictionaryValue); const NavigationController& controller = tab_contents->GetController(); - content::NavigationEntry* nav_entry = controller.GetActiveEntry(); + NavigationEntry* nav_entry = controller.GetActiveEntry(); DCHECK(nav_entry); // Security info. diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc index 54cfb0f..a5e118c 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.cc +++ b/chrome/browser/content_settings/tab_specific_content_settings.cc @@ -33,6 +33,7 @@ #include "webkit/fileapi/file_system_types.h" using content::BrowserThread; +using content::NavigationEntry; using content::WebContents; namespace { @@ -468,7 +469,7 @@ void TabSpecificContentSettings::Observe( content::Details<const ContentSettingsDetails> settings_details(details); const NavigationController& controller = web_contents()->GetController(); - content::NavigationEntry* entry = controller.GetActiveEntry(); + NavigationEntry* entry = controller.GetActiveEntry(); GURL entry_url; if (entry) entry_url = entry->GetURL(); diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index ef58094..513b08e 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -58,6 +58,7 @@ using content::DevToolsAgentHost; using content::DevToolsAgentHostRegistry; using content::DevToolsClientHost; using content::DevToolsManager; +using content::NavigationEntry; using content::OpenURLParams; using content::WebContents; @@ -190,7 +191,7 @@ DevToolsWindow::DevToolsWindow(TabContentsWrapper* tab_contents, this); g_instances.Get().push_back(this); // Wipe out page icon so that the default application icon is used. - content::NavigationEntry* entry = + NavigationEntry* entry = tab_contents_->tab_contents()->GetController().GetActiveEntry(); entry->GetFavicon().bitmap = SkBitmap(); entry->GetFavicon().valid = true; diff --git a/chrome/browser/download/download_request_limiter.cc b/chrome/browser/download/download_request_limiter.cc index e12f7fb..f2c35db 100644 --- a/chrome/browser/download/download_request_limiter.cc +++ b/chrome/browser/download/download_request_limiter.cc @@ -21,6 +21,7 @@ #include "content/public/browser/web_contents_delegate.h" using content::BrowserThread; +using content::NavigationEntry; using content::WebContents; // TabDownloadState ------------------------------------------------------------ @@ -39,7 +40,7 @@ DownloadRequestLimiter::TabDownloadState::TabDownloadState( notification_source); registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED, notification_source); - content::NavigationEntry* active_entry = originating_controller ? + NavigationEntry* active_entry = originating_controller ? originating_controller->GetActiveEntry() : controller->GetActiveEntry(); if (active_entry) initial_page_host_ = active_entry->GetURL().host(); @@ -114,7 +115,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. - content::NavigationEntry* entry = controller_->GetPendingEntry(); + NavigationEntry* entry = controller_->GetPendingEntry(); if (!entry) return; diff --git a/chrome/browser/extensions/extension_navigation_observer.cc b/chrome/browser/extensions/extension_navigation_observer.cc index f1aabb1..23c8575 100644 --- a/chrome/browser/extensions/extension_navigation_observer.cc +++ b/chrome/browser/extensions/extension_navigation_observer.cc @@ -10,6 +10,8 @@ #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" +using content::NavigationEntry; + ExtensionNavigationObserver::ExtensionNavigationObserver(Profile* profile) : profile_(profile) { RegisterForNotifications(); @@ -46,7 +48,7 @@ void ExtensionNavigationObserver::PromptToEnableExtensionIfNecessary( if (!in_progress_prompt_extension_id_.empty()) return; - content::NavigationEntry* nav_entry = nav_controller->GetActiveEntry(); + NavigationEntry* nav_entry = nav_controller->GetActiveEntry(); if (!nav_entry) return; diff --git a/chrome/browser/extensions/extension_page_actions_module.cc b/chrome/browser/extensions/extension_page_actions_module.cc index 713fc81..f8ce2d2 100644 --- a/chrome/browser/extensions/extension_page_actions_module.cc +++ b/chrome/browser/extensions/extension_page_actions_module.cc @@ -21,6 +21,8 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_entry.h" +using content::NavigationEntry; + namespace keys = extension_page_actions_module_constants; namespace { @@ -80,7 +82,7 @@ bool PageActionFunction::SetPageActionEnabled(bool enable) { } // Make sure the URL hasn't changed. - content::NavigationEntry* entry = + NavigationEntry* entry = contents->tab_contents()->GetController().GetActiveEntry(); if (!entry || url != entry->GetURL().spec()) { error_ = ExtensionErrorUtils::FormatErrorMessage(kUrlNotActiveError, url); diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc index 55cc01a..32cb17f 100644 --- a/chrome/browser/extensions/extension_tab_util.cc +++ b/chrome/browser/extensions/extension_tab_util.cc @@ -18,6 +18,7 @@ namespace keys = extension_tabs_module_constants; namespace errors = extension_manifest_errors; +using content::NavigationEntry; using content::WebContents; int ExtensionTabUtil::GetWindowId(const Browser* browser) { @@ -119,8 +120,7 @@ DictionaryValue* ExtensionTabUtil::CreateTabValue(const WebContents* contents, contents->GetBrowserContext()->IsOffTheRecord()); if (!is_loading) { - content::NavigationEntry* entry = - contents->GetController().GetActiveEntry(); + NavigationEntry* entry = contents->GetController().GetActiveEntry(); if (entry) { if (entry->GetFavicon().valid) result->SetString(keys::kFaviconUrlKey, entry->GetFavicon().url.spec()); diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index d07df26..e2e65a8 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -60,6 +60,7 @@ namespace keys = extension_tabs_module_constants; namespace errors = extension_manifest_errors; +using content::NavigationEntry; using content::OpenURLParams; using content::Referrer; using content::WebContents; @@ -1377,8 +1378,7 @@ bool ReloadTabFunction::RunImpl() { TabContents* tab_contents = contents->tab_contents(); if (tab_contents->ShowingInterstitialPage()) { // This does as same as Browser::ReloadInternal. - content::NavigationEntry* entry = - tab_contents->GetController().GetActiveEntry(); + NavigationEntry* entry = tab_contents->GetController().GetActiveEntry(); OpenURLParams params(entry->GetURL(), Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_RELOAD, false); GetCurrentBrowser()->OpenURL(params); diff --git a/chrome/browser/extensions/extension_url_rewrite_browsertest.cc b/chrome/browser/extensions/extension_url_rewrite_browsertest.cc index ffdcab3..d23e57c 100644 --- a/chrome/browser/extensions/extension_url_rewrite_browsertest.cc +++ b/chrome/browser/extensions/extension_url_rewrite_browsertest.cc @@ -19,6 +19,8 @@ #include "content/public/browser/navigation_entry.h" #include "googleurl/src/gurl.h" +using content::NavigationEntry; + class ExtensionURLRewriteBrowserTest : public ExtensionBrowserTest { protected: std::string GetLocationBarText() const { @@ -34,7 +36,7 @@ class ExtensionURLRewriteBrowserTest : public ExtensionBrowserTest { return &browser()->GetSelectedTabContents()->GetController(); } - content::NavigationEntry* GetNavigationEntry() const { + NavigationEntry* GetNavigationEntry() const { return GetNavigationController()->GetActiveEntry(); } diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 980f616..a83e49d 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -67,6 +67,7 @@ #include "ui/views/layout/grid_layout.h" using content::BrowserThread; +using content::NavigationEntry; using content::OpenURLParams; using content::SSLStatus; using content::WebContents; @@ -956,7 +957,7 @@ bool ExternalTabContainer::InitNavigationInfo(NavigationInfo* nav_info, content::NavigationType nav_type, int relative_offset) { DCHECK(nav_info); - content::NavigationEntry* entry = + NavigationEntry* entry = tab_contents_->tab_contents()->GetController().GetActiveEntry(); // If this is very early in the game then we may not have an entry. if (!entry) diff --git a/chrome/browser/favicon/favicon_handler.cc b/chrome/browser/favicon/favicon_handler.cc index a846789..6c1bf56 100644 --- a/chrome/browser/favicon/favicon_handler.cc +++ b/chrome/browser/favicon/favicon_handler.cc @@ -21,6 +21,8 @@ #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_util.h" +using content::NavigationEntry; + namespace { // Returns history::IconType the given icon_type corresponds to. @@ -140,20 +142,20 @@ void FaviconHandler::SetFavicon( } if (url == url_ && icon_type == history::FAVICON) { - content::NavigationEntry* entry = GetEntry(); + NavigationEntry* entry = GetEntry(); if (entry) UpdateFavicon(entry, &sized_image); } } -void FaviconHandler::UpdateFavicon(content::NavigationEntry* entry, +void FaviconHandler::UpdateFavicon(NavigationEntry* entry, scoped_refptr<RefCountedMemory> data) { scoped_ptr<gfx::Image> image(gfx::ImageFromPNGEncodedData(data->front(), data->size())); UpdateFavicon(entry, image.get()); } -void FaviconHandler::UpdateFavicon(content::NavigationEntry* entry, +void FaviconHandler::UpdateFavicon(NavigationEntry* entry, const gfx::Image* image) { // No matter what happens, we need to mark the favicon as being set. entry->GetFavicon().valid = true; @@ -168,7 +170,7 @@ void FaviconHandler::UpdateFavicon(content::NavigationEntry* entry, void FaviconHandler::OnUpdateFaviconURL( int32 page_id, const std::vector<FaviconURL>& candidates) { - content::NavigationEntry* entry = GetEntry(); + NavigationEntry* entry = GetEntry(); if (!entry) return; @@ -245,8 +247,8 @@ void FaviconHandler::OnDidDownloadFavicon(int id, download_requests_.erase(i); } -content::NavigationEntry* FaviconHandler::GetEntry() { - content::NavigationEntry* entry = delegate_->GetActiveEntry(); +NavigationEntry* FaviconHandler::GetEntry() { + NavigationEntry* entry = delegate_->GetActiveEntry(); if (entry && entry->GetURL() == url_) return entry; @@ -313,7 +315,7 @@ bool FaviconHandler::ShouldSaveFavicon(const GURL& url) { void FaviconHandler::OnFaviconDataForInitialURL( FaviconService::Handle handle, history::FaviconData favicon) { - content::NavigationEntry* entry = GetEntry(); + NavigationEntry* entry = GetEntry(); if (!entry) return; @@ -390,7 +392,7 @@ void FaviconHandler::DownloadFaviconOrAskHistory( void FaviconHandler::OnFaviconData(FaviconService::Handle handle, history::FaviconData favicon) { - content::NavigationEntry* entry = GetEntry(); + NavigationEntry* entry = GetEntry(); if (!entry) return; diff --git a/chrome/browser/favicon/favicon_handler.h b/chrome/browser/favicon/favicon_handler.h index edcc571..a59e944 100644 --- a/chrome/browser/favicon/favicon_handler.h +++ b/chrome/browser/favicon/favicon_handler.h @@ -20,7 +20,6 @@ #include "ui/gfx/favicon_size.h" class FaviconHandlerDelegate; -class NavigationEntry; class Profile; class RefCountedMemory; class SkBitmap; diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc index c630ed3..0018bf5 100644 --- a/chrome/browser/favicon/favicon_handler_unittest.cc +++ b/chrome/browser/favicon/favicon_handler_unittest.cc @@ -14,6 +14,8 @@ class TestFaviconHandler; +using content::NavigationEntry; + namespace { // Fill the given bmp with valid png data. @@ -134,7 +136,7 @@ class TestFaviconHandlerDelegate : public FaviconHandlerDelegate { : tab_contents_(tab_contents) { } - virtual content::NavigationEntry* GetActiveEntry() { + virtual NavigationEntry* GetActiveEntry() { ADD_FAILURE() << "TestFaviconHandlerDelegate::GetActiveEntry() " << "should never be called in tests."; return NULL; @@ -163,7 +165,7 @@ class TestFaviconHandler : public FaviconHandler { Type type) : FaviconHandler(profile, delegate, type), download_image_size_(0), - entry_(content::NavigationEntry::Create()), + entry_(NavigationEntry::Create()), download_id_(0) { entry_->SetURL(page_url); } @@ -189,7 +191,7 @@ class TestFaviconHandler : public FaviconHandler { download_handler_.reset(download_handler); } - virtual content::NavigationEntry* GetEntry() { + virtual NavigationEntry* GetEntry() { return entry_.get(); } @@ -273,7 +275,7 @@ class TestFaviconHandler : public FaviconHandler { int download_image_size_; private: - scoped_ptr<content::NavigationEntry> entry_; + scoped_ptr<NavigationEntry> entry_; // The unique id of a download request. It will be returned to a // FaviconHandler. diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc index 9c1a027..bfd4a6d 100644 --- a/chrome/browser/favicon/favicon_tab_helper.cc +++ b/chrome/browser/favicon/favicon_tab_helper.cc @@ -23,6 +23,7 @@ #include "ui/gfx/image/image.h" using content::FaviconStatus; +using content::NavigationEntry; using content::WebContents; FaviconTabHelper::FaviconTabHelper(TabContents* tab_contents) @@ -48,7 +49,7 @@ SkBitmap FaviconTabHelper::GetFavicon() const { // Like GetTitle(), we also want to use the favicon for the last committed // entry rather than a pending navigation entry. const NavigationController& controller = web_contents()->GetController(); - content::NavigationEntry* entry = controller.GetTransientEntry(); + NavigationEntry* entry = controller.GetTransientEntry(); if (entry) return entry->GetFavicon().bitmap; @@ -60,7 +61,7 @@ SkBitmap FaviconTabHelper::GetFavicon() const { bool FaviconTabHelper::FaviconIsValid() const { const NavigationController& controller = web_contents()->GetController(); - content::NavigationEntry* entry = controller.GetTransientEntry(); + NavigationEntry* entry = controller.GetTransientEntry(); if (entry) return entry->GetFavicon().valid; @@ -84,8 +85,7 @@ bool FaviconTabHelper::ShouldDisplayFavicon() { } void FaviconTabHelper::SaveFavicon() { - content::NavigationEntry* entry = - web_contents()->GetController().GetActiveEntry(); + NavigationEntry* entry = web_contents()->GetController().GetActiveEntry(); if (!entry || entry->GetURL().is_empty()) return; @@ -133,7 +133,7 @@ void FaviconTabHelper::OnUpdateFaviconURL( touch_icon_handler_->OnUpdateFaviconURL(page_id, candidates); } -content::NavigationEntry* FaviconTabHelper::GetActiveEntry() { +NavigationEntry* FaviconTabHelper::GetActiveEntry() { return web_contents()->GetController().GetActiveEntry(); } diff --git a/chrome/browser/favicon/favicon_tab_helper.h b/chrome/browser/favicon/favicon_tab_helper.h index 6e2c3a8..d62aaab 100644 --- a/chrome/browser/favicon/favicon_tab_helper.h +++ b/chrome/browser/favicon/favicon_tab_helper.h @@ -17,7 +17,6 @@ #include "googleurl/src/gurl.h" class FaviconHandler; -class NavigationEntry; class SkBitmap; // FaviconTabHelper works with FaviconHandlers to fetch the favicons. diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc index dfdfae0..b1f57f3 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc @@ -42,6 +42,7 @@ using WebKit::WebSecurityOrigin; using content::BrowserThread; +using content::NavigationEntry; using content::OpenURLParams; using content::Referrer; using content::WebContents; @@ -178,7 +179,7 @@ GeolocationConfirmInfoBarDelegate::GeolocationConfirmInfoBarDelegate( bridge_id_(bridge_id), requesting_frame_url_(requesting_frame_url), display_languages_(display_languages) { - const content::NavigationEntry* committed_entry = + const NavigationEntry* committed_entry = infobar_helper->web_contents()->GetController().GetLastCommittedEntry(); committed_contents_unique_id_ = committed_entry ? committed_entry->GetUniqueID() : 0; diff --git a/chrome/browser/geolocation/geolocation_settings_state_unittest.cc b/chrome/browser/geolocation/geolocation_settings_state_unittest.cc index db41369..9cd8ee1 100644 --- a/chrome/browser/geolocation/geolocation_settings_state_unittest.cc +++ b/chrome/browser/geolocation/geolocation_settings_state_unittest.cc @@ -14,6 +14,7 @@ #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; +using content::NavigationEntry; namespace { @@ -33,8 +34,7 @@ TEST_F(GeolocationSettingsStateTests, ClearOnNewOrigin) { GeolocationSettingsState state(&profile); GURL url_0("http://www.example.com"); - scoped_ptr<content::NavigationEntry> entry( - content::NavigationEntry::Create()); + scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); entry->SetURL(url_0); content::LoadCommittedDetails load_committed_details; load_committed_details.entry = entry.get(); @@ -139,8 +139,7 @@ TEST_F(GeolocationSettingsStateTests, ShowPortOnSameHost) { GeolocationSettingsState state(&profile); GURL url_0("http://www.example.com"); - scoped_ptr<content::NavigationEntry> entry( - content::NavigationEntry::Create()); + scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); entry->SetURL(url_0); content::LoadCommittedDetails load_committed_details; load_committed_details.entry = entry.get(); diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc index c1b7447..f60558d 100644 --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc @@ -18,6 +18,8 @@ #include "content/public/browser/web_contents_delegate.h" #include "content/public/common/frame_navigate_params.h" +using content::NavigationEntry; + HistoryTabHelper::HistoryTabHelper(TabContents* tab_contents) : content::WebContentsObserver(tab_contents), received_page_title_(false) { @@ -35,8 +37,7 @@ void HistoryTabHelper::UpdateHistoryForNavigation( GetHistoryService()->AddPage(*add_page_args); } -void HistoryTabHelper::UpdateHistoryPageTitle( - const content::NavigationEntry& entry) { +void HistoryTabHelper::UpdateHistoryPageTitle(const NavigationEntry& entry) { HistoryService* hs = GetHistoryService(); if (hs) hs->SetPageTitle(entry.GetVirtualURL(), entry.GetTitleForDisplay("")); diff --git a/chrome/browser/infobars/infobar_delegate.cc b/chrome/browser/infobars/infobar_delegate.cc index daef494..4a0e35b 100644 --- a/chrome/browser/infobars/infobar_delegate.cc +++ b/chrome/browser/infobars/infobar_delegate.cc @@ -11,6 +11,8 @@ #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" +using content::NavigationEntry; + // InfoBarDelegate ------------------------------------------------------------ InfoBarDelegate::~InfoBarDelegate() { @@ -83,7 +85,7 @@ InfoBarDelegate::InfoBarDelegate(InfoBarTabHelper* infobar_helper) void InfoBarDelegate::StoreActiveEntryUniqueID( InfoBarTabHelper* infobar_helper) { - content::NavigationEntry* active_entry = + NavigationEntry* active_entry = infobar_helper->web_contents()->GetController().GetActiveEntry(); contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0; } diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 3644246..c91cd4a1 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -51,6 +51,8 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/codec/png_codec.h" +using content::NavigationEntry; + namespace { // Number of ms to delay before updating the omnibox bounds. This is only used @@ -142,7 +144,7 @@ void InstantLoader::FrameLoadObserver::Observe( switch (type) { case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: { int page_id = *(content::Details<int>(details).ptr()); - content::NavigationEntry* active_entry = + NavigationEntry* active_entry = tab_contents_->GetController().GetActiveEntry(); if (!active_entry || active_entry->GetPageID() != page_id || active_entry->GetUniqueID() != unique_id_) { @@ -332,7 +334,7 @@ void InstantLoader::TabContentsDelegateImpl::CommitHistory( add_page_vector_[i].get()); } - content::NavigationEntry* active_entry = + NavigationEntry* active_entry = tab->tab_contents()->GetController().GetActiveEntry(); if (!active_entry) { // It appears to be possible to get here with no active entry. This seems @@ -549,7 +551,7 @@ void InstantLoader::TabContentsDelegateImpl::OnSetSuggestions( const std::vector<std::string>& suggestions, InstantCompleteBehavior behavior) { TabContentsWrapper* source = loader_->preview_contents(); - content::NavigationEntry* entry = + NavigationEntry* entry = source->tab_contents()->GetController().GetActiveEntry(); if (!entry || page_id != entry->GetPageID()) return; diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index 9569c05..aaa2357 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -35,6 +35,7 @@ #endif using content::BrowserThread; +using content::NavigationEntry; // static std::string ProcessMemoryInformation::GetRendererTypeNameInEnglish( @@ -284,9 +285,9 @@ void MemoryDetails::CollectChildInfoOnUIThread() { // last committed entry. // // Either the pending or last committed entries can be NULL. - const content::NavigationEntry* pending_entry = + const NavigationEntry* pending_entry = contents->GetController().GetPendingEntry(); - const content::NavigationEntry* last_committed_entry = + const NavigationEntry* last_committed_entry = contents->GetController().GetLastCommittedEntry(); if ((last_committed_entry && LowerCaseEqualsASCII(last_committed_entry->GetVirtualURL().spec(), diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc index 751b055..92532a1 100644 --- a/chrome/browser/omnibox_search_hint.cc +++ b/chrome/browser/omnibox_search_hint.cc @@ -39,6 +39,8 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +using content::NavigationEntry; + // The URLs of search engines for which we want to trigger the infobar. const char* const kSearchEngineURLs[] = { "http://www.google.com/", @@ -175,7 +177,7 @@ void OmniboxSearchHint::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { - content::NavigationEntry* entry = + NavigationEntry* entry = tab_->tab_contents()->GetController().GetActiveEntry(); if (search_engine_urls_.find(entry->GetURL().spec()) == search_engine_urls_.end()) { diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 8a2e56e..8815789 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -104,6 +104,7 @@ // bringing up the dialog) isn't what we want. using content::BrowserThread; +using content::NavigationEntry; using content::WebContents; namespace internal_cloud_print_helpers { @@ -302,7 +303,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(); - content::NavigationEntry* pending_entry = controller->GetPendingEntry(); + NavigationEntry* pending_entry = controller->GetPendingEntry(); if (pending_entry) { Profile* profile = Profile::FromWebUI(web_ui_); pending_entry->SetURL( diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc index a191790..49f8087 100644 --- a/chrome/browser/rlz/rlz.cc +++ b/chrome/browser/rlz/rlz.cc @@ -37,6 +37,7 @@ #include "content/public/browser/notification_service.h" using content::BrowserThread; +using content::NavigationEntry; namespace { @@ -305,8 +306,8 @@ void RLZTracker::Observe(int type, content::NotificationService::AllSources()); break; case content::NOTIFICATION_NAV_ENTRY_PENDING: { - const content::NavigationEntry* entry = - content::Details<content::NavigationEntry>(details).ptr(); + const NavigationEntry* entry = + content::Details<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 1e28437..990c207 100644 --- a/chrome/browser/rlz/rlz_unittest.cc +++ b/chrome/browser/rlz/rlz_unittest.cc @@ -24,6 +24,7 @@ #include "testing/gtest/include/gtest/gtest.h" using base::win::RegKey; +using content::NavigationEntry; using registry_util::RegistryOverrideManager; using testing::AssertionResult; using testing::AssertionSuccess; @@ -237,13 +238,12 @@ void RlzLibTest::SimulateOmniboxUsage() { } void RlzLibTest::SimulateHomepageUsage() { - scoped_ptr<content::NavigationEntry> entry( - content::NavigationEntry::Create()); + scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); entry->SetPageID(0); entry->SetTransitionType(content::PAGE_TRANSITION_HOME_PAGE); tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, content::NotificationService::AllSources(), - content::Details<content::NavigationEntry>(entry.get())); + content::Details<NavigationEntry>(entry.get())); } void RlzLibTest::InvokeDelayedInit() { @@ -582,16 +582,15 @@ TEST_F(RlzLibTest, PingUpdatesRlzCache) { } TEST_F(RlzLibTest, ObserveHandlesBadArgs) { - scoped_ptr<content::NavigationEntry> entry( - content::NavigationEntry::Create()); + scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); entry->SetPageID(0); entry->SetTransitionType(content::PAGE_TRANSITION_LINK); tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, content::NotificationService::AllSources(), - content::Details<content::NavigationEntry>(NULL)); + content::Details<NavigationEntry>(NULL)); tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, content::NotificationService::AllSources(), - content::Details<content::NavigationEntry>(entry.get())); + content::Details<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 ccf8b69e..16cd5e2 100644 --- a/chrome/browser/safe_browsing/browser_feature_extractor.cc +++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc @@ -28,6 +28,7 @@ #include "googleurl/src/gurl.h" using content::BrowserThread; +using content::NavigationEntry; using content::WebContents; namespace safe_browsing { @@ -52,7 +53,7 @@ static void AddNavigationFeatures(const std::string& feature_prefix, int index, const std::vector<GURL>& redirect_chain, ClientPhishingRequest* request) { - content::NavigationEntry* entry = controller.GetEntryAtIndex(index); + NavigationEntry* entry = controller.GetEntryAtIndex(index); bool is_secure_referrer = entry->GetReferrer().url.SchemeIsSecure(); if (!is_secure_referrer) { AddFeature(StringPrintf("%s%s=%s", @@ -162,7 +163,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--) { - content::NavigationEntry* entry = controller.GetEntryAtIndex(index); + 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/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc index c8cc31e..86ee34a 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host.cc @@ -37,6 +37,7 @@ #include "googleurl/src/gurl.h" using content::BrowserThread; +using content::NavigationEntry; using content::WebContents; namespace safe_browsing { @@ -475,7 +476,7 @@ bool ClientSideDetectionHost::DidShowSBInterstitial() { if (unsafe_unique_page_id_ <= 0 || !web_contents()) { return false; } - const content::NavigationEntry* nav_entry = + const NavigationEntry* nav_entry = web_contents()->GetController().GetActiveEntry(); return (nav_entry && nav_entry->GetUniqueID() == unsafe_unique_page_id_); } diff --git a/chrome/browser/safe_browsing/malware_details.cc b/chrome/browser/safe_browsing/malware_details.cc index 5bc324e..f15af44 100644 --- a/chrome/browser/safe_browsing/malware_details.cc +++ b/chrome/browser/safe_browsing/malware_details.cc @@ -24,6 +24,7 @@ #include "net/url_request/url_request_context_getter.h" using content::BrowserThread; +using content::NavigationEntry; using content::WebContents; using safe_browsing::ClientMalwareReportRequest; @@ -168,8 +169,7 @@ void MalwareDetails::StartCollection() { } GURL referrer_url; - content::NavigationEntry* nav_entry = - web_contents()->GetController().GetActiveEntry(); + NavigationEntry* nav_entry = web_contents()->GetController().GetActiveEntry(); if (nav_entry) { referrer_url = nav_entry->GetReferrer().url; if (IsPublicUrl(referrer_url)) { 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 6165f1c..138fb1e 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc @@ -14,6 +14,7 @@ #include "content/test/test_browser_thread.h" using content::BrowserThread; +using content::NavigationEntry; static const char* kGoogleURL = "http://www.google.com/"; static const char* kGoodURL = "http://www.goodguys.com/"; @@ -115,8 +116,7 @@ class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness, } void GoBack(bool is_cross_site) { - content::NavigationEntry* entry = - contents()->GetController().GetEntryAtOffset(-1); + NavigationEntry* entry = contents()->GetController().GetEntryAtOffset(-1); ASSERT_TRUE(entry); contents()->GetController().GoBack(); diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 1b7c9bf..285847e 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -46,6 +46,7 @@ #endif using content::BrowserThread; +using content::NavigationEntry; namespace { @@ -1055,8 +1056,7 @@ void SafeBrowsingService::DoDisplayBlockingPage( CanReportStats()) { GURL page_url = tab_contents->GetURL(); GURL referrer_url; - content::NavigationEntry* entry = - tab_contents->GetController().GetActiveEntry(); + NavigationEntry* entry = tab_contents->GetController().GetActiveEntry(); if (entry) referrer_url = entry->GetReferrer().url; diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc index a4be31b..1ed1b4a 100644 --- a/chrome/browser/sessions/base_session_service.cc +++ b/chrome/browser/sessions/base_session_service.cc @@ -18,8 +18,9 @@ #include "content/public/common/referrer.h" #include "webkit/glue/webkit_glue.h" -using content::BrowserThread; using WebKit::WebReferrerPolicy; +using content::BrowserThread; +using content::NavigationEntry; // InternalGetCommandsRequest ------------------------------------------------- @@ -138,7 +139,7 @@ SessionCommand* BaseSessionService::CreateUpdateTabNavigationCommand( SessionID::id_type command_id, SessionID::id_type tab_id, int index, - const content::NavigationEntry& entry) { + const NavigationEntry& entry) { // Use pickle to handle marshalling. Pickle pickle; pickle.WriteInt(tab_id); diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 830d3bb..ff7cf00 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -43,6 +43,7 @@ #endif using base::Time; +using content::NavigationEntry; // Identifier for commands written to file. static const SessionCommand::id_type kCommandSetTabWindow = 0; @@ -362,7 +363,7 @@ void SessionService::UpdateTabNavigation( const SessionID& window_id, const SessionID& tab_id, int index, - const content::NavigationEntry& entry) { + const NavigationEntry& entry) { if (!ShouldTrackEntry(entry.GetVirtualURL()) || !ShouldTrackChangesToWindow(window_id)) { return; @@ -1139,7 +1140,7 @@ void SessionService::BuildCommandsForTab( wrapper->extension_tab_helper()->extension_app()->id())); } for (int i = min_index; i < max_index; ++i) { - const content::NavigationEntry* entry = (i == pending_index) ? + const NavigationEntry* entry = (i == pending_index) ? tab->tab_contents()->GetController().GetPendingEntry() : tab->tab_contents()->GetController().GetEntryAtIndex(i); DCHECK(entry); diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc index f93b475..7c3313e 100644 --- a/chrome/browser/sessions/session_service_unittest.cc +++ b/chrome/browser/sessions/session_service_unittest.cc @@ -28,6 +28,8 @@ #include "content/public/browser/notification_service.h" #include "testing/gtest/include/gtest/gtest.h" +using content::NavigationEntry; + class SessionServiceTest : public BrowserWithTestWindowTest, public content::NotificationObserver { public: @@ -69,8 +71,7 @@ class SessionServiceTest : public BrowserWithTestWindowTest, const TabNavigation& navigation, int index, bool select) { - scoped_ptr<content::NavigationEntry> entry( - content::NavigationEntry::Create()); + scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); entry->SetURL(navigation.virtual_url()); entry->SetReferrer(navigation.referrer()); entry->SetTitle(navigation.title()); diff --git a/chrome/browser/sessions/session_types.cc b/chrome/browser/sessions/session_types.cc index 30c2a11..ac689f0 100644 --- a/chrome/browser/sessions/session_types.cc +++ b/chrome/browser/sessions/session_types.cc @@ -10,6 +10,8 @@ #include "content/browser/tab_contents/navigation_controller.h" #include "content/public/browser/navigation_entry.h" +using content::NavigationEntry; + // TabNavigation -------------------------------------------------------------- TabNavigation::TabNavigation() @@ -58,9 +60,9 @@ TabNavigation& TabNavigation::operator=(const TabNavigation& tab) { } // static -content::NavigationEntry* TabNavigation::ToNavigationEntry( +NavigationEntry* TabNavigation::ToNavigationEntry( int page_id, Profile *profile) const { - content::NavigationEntry* entry = NavigationController::CreateNavigationEntry( + NavigationEntry* entry = NavigationController::CreateNavigationEntry( virtual_url_, referrer_, // Use a transition type of reload so that we don't incorrectly @@ -79,8 +81,7 @@ content::NavigationEntry* TabNavigation::ToNavigationEntry( return entry; } -void TabNavigation::SetFromNavigationEntry( - const content::NavigationEntry& entry) { +void TabNavigation::SetFromNavigationEntry(const NavigationEntry& entry) { virtual_url_ = entry.GetVirtualURL(); referrer_ = entry.GetReferrer(); title_ = entry.GetTitle(); @@ -93,7 +94,7 @@ void TabNavigation::SetFromNavigationEntry( void TabNavigation::CreateNavigationEntriesFromTabNavigations( Profile* profile, const std::vector<TabNavigation>& navigations, - std::vector<content::NavigationEntry*>* entries) { + std::vector<NavigationEntry*>* entries) { int page_id = 0; for (std::vector<TabNavigation>::const_iterator i = navigations.begin(); i != navigations.end(); ++i, ++page_id) { diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc index f6e9646..1fed2156 100644 --- a/chrome/browser/sessions/tab_restore_service.cc +++ b/chrome/browser/sessions/tab_restore_service.cc @@ -32,6 +32,7 @@ #include "content/public/browser/navigation_entry.h" using base::Time; +using content::NavigationEntry; // TimeFactory----------------------------------------------------------------- @@ -491,7 +492,7 @@ void TabRestoreService::PopulateTab(Tab* tab, entry_count++; tab->navigations.resize(static_cast<int>(entry_count)); for (int i = 0; i < entry_count; ++i) { - content::NavigationEntry* entry = (i == pending_index) ? + NavigationEntry* entry = (i == pending_index) ? controller->GetPendingEntry() : controller->GetEntryAtIndex(i); tab->navigations[i].SetFromNavigationEntry(*entry); } @@ -657,7 +658,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<content::NavigationEntry> entry( + scoped_ptr<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 991cfe3..d664597 100644 --- a/chrome/browser/sessions/tab_restore_service_browsertest.cc +++ b/chrome/browser/sessions/tab_restore_service_browsertest.cc @@ -21,6 +21,8 @@ typedef TabRestoreService::Tab Tab; +using content::NavigationEntry; + // Create subclass that overrides TimeNow so that we can control the time used // for closed tabs and windows. class TabRestoreTimeFactory : public TabRestoreService::TimeFactory { @@ -99,8 +101,7 @@ class TabRestoreServiceTest : public ChromeRenderViewHostTestHarness { session_service->SetSelectedTabInWindow(window_id, 0); if (pinned) session_service->SetPinnedState(window_id, tab_id, true); - scoped_ptr<content::NavigationEntry> entry( - content::NavigationEntry::Create());; + scoped_ptr<NavigationEntry> entry(NavigationEntry::Create());; entry->SetURL(url1_); session_service->UpdateTabNavigation(window_id, tab_id, 0, *entry.get()); } diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 1c516a5..b93921d 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -27,6 +27,8 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +using content::NavigationEntry; + namespace { enum SSLBlockingPageEvent { @@ -109,7 +111,7 @@ std::string SSLBlockingPage::GetHTMLContents() { return jstemplate_builder::GetI18nTemplateHtml(html, &strings); } -void SSLBlockingPage::UpdateEntry(content::NavigationEntry* entry) { +void SSLBlockingPage::UpdateEntry(NavigationEntry* entry) { const net::SSLInfo& ssl_info = handler_->ssl_info(); int cert_id = CertStore::GetInstance()->StoreCert( ssl_info.cert, tab()->GetRenderProcessHost()->GetID()); diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 10ed94b..02327e1 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -24,6 +24,7 @@ #include "net/base/cert_status_flags.h" #include "net/test/test_server.h" +using content::NavigationEntry; using content::SSLStatus; const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); @@ -51,7 +52,7 @@ class SSLUITest : public InProcessBrowserTest { void CheckAuthenticatedState(TabContents* tab, bool displayed_insecure_content) { ASSERT_FALSE(tab->IsCrashed()); - content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); + NavigationEntry* entry = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry); EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->GetPageType()); EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED, @@ -66,7 +67,7 @@ class SSLUITest : public InProcessBrowserTest { void CheckUnauthenticatedState(TabContents* tab) { ASSERT_FALSE(tab->IsCrashed()); - content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); + NavigationEntry* entry = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry); EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry->GetPageType()); EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED, @@ -83,7 +84,7 @@ class SSLUITest : public InProcessBrowserTest { bool ran_insecure_content, bool interstitial) { ASSERT_FALSE(tab->IsCrashed()); - content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); + NavigationEntry* entry = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry); EXPECT_EQ(interstitial ? content::PAGE_TYPE_INTERSTITIAL : content::PAGE_TYPE_NORMAL, @@ -328,7 +329,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSExpiredCertAndDontProceed) { https_server_.GetURL("files/ssl/google.html")); TabContents* tab = browser()->GetSelectedTabContents(); - content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); + NavigationEntry* entry = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry); GURL cross_site_url = @@ -373,7 +374,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("files/ssl/google.html")); TabContents* tab = browser()->GetSelectedTabContents(); - content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); + NavigationEntry* entry = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry); // Now go to a bad HTTPS page that shows an interstitial. @@ -409,7 +410,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoBackViaMenu) { ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("files/ssl/google.html")); TabContents* tab = browser()->GetSelectedTabContents(); - content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); + NavigationEntry* entry = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry); // Now go to a bad HTTPS page that shows an interstitial. @@ -436,11 +437,11 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoForward) { ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("files/ssl/google.html")); TabContents* tab = browser()->GetSelectedTabContents(); - content::NavigationEntry* entry1 = tab->GetController().GetActiveEntry(); + NavigationEntry* entry1 = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry1); ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("files/ssl/blank_page.html")); - content::NavigationEntry* entry2 = tab->GetController().GetActiveEntry(); + NavigationEntry* entry2 = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry2); // Now go back so that a page is in the forward history. @@ -452,7 +453,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoForward) { observer.Wait(); } ASSERT_TRUE(tab->GetController().CanGoForward()); - content::NavigationEntry* entry3 = tab->GetController().GetActiveEntry(); + NavigationEntry* entry3 = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry1 == entry3); // Now go to a bad HTTPS page that shows an interstitial. @@ -474,7 +475,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoForward) { EXPECT_FALSE(browser()->GetSelectedTabContents()->GetInterstitialPage()); CheckUnauthenticatedState(tab); EXPECT_FALSE(tab->GetController().CanGoForward()); - content::NavigationEntry* entry4 = tab->GetController().GetActiveEntry(); + NavigationEntry* entry4 = tab->GetController().GetActiveEntry(); EXPECT_TRUE(entry2 == entry4); } diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc index bbdc008..0a32957 100644 --- a/chrome/browser/sync/glue/session_model_associator.cc +++ b/chrome/browser/sync/glue/session_model_associator.cc @@ -38,11 +38,12 @@ #include <windows.h> #endif -namespace browser_sync { - using content::BrowserThread; +using content::NavigationEntry; using syncable::SESSIONS; +namespace browser_sync { + namespace { static const char kNoSessionsFolderError[] = "Server did not create the top-level sessions node. We " @@ -336,7 +337,7 @@ bool SessionModelAssociator::WriteTabContentsToSyncModel( tab_s->set_extension_app_id(tab.GetExtensionAppId()); } for (int i = min_index; i < max_index; ++i) { - const content::NavigationEntry* entry = (i == pending_index) ? + const NavigationEntry* entry = (i == pending_index) ? tab.GetPendingEntry() : tab.GetEntryAtIndex(i); DCHECK(entry); if (entry->GetVirtualURL().is_valid()) { @@ -1064,7 +1065,7 @@ bool SessionModelAssociator::IsValidTab(const SyncedTabDelegate& tab) const { tab.GetWindowId()); if (!window) return false; - const content::NavigationEntry* entry = tab.GetActiveEntry(); + const NavigationEntry* entry = tab.GetActiveEntry(); if (!entry) return false; if (entry->GetVirtualURL().is_valid() && diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 8cdb7e2..9c2e92b 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -88,6 +88,7 @@ #endif using content::DownloadManager; +using content::NavigationEntry; using content::OpenURLParams; using content::SSLStatus; using content::UserMetricsAction; @@ -1196,7 +1197,7 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { // the page) from the NavigationEntry because its reflects their origin // rather than the display one (returned by GetURL) which may be // different (like having "view-source:" on the front). - content::NavigationEntry* active_entry = + NavigationEntry* active_entry = source_tab_contents_->GetController().GetActiveEntry(); return SavePackage::IsSavableURL( (active_entry) ? active_entry->GetURL() : GURL()); @@ -1567,7 +1568,7 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { break; case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: { - content::NavigationEntry* nav_entry = + NavigationEntry* nav_entry = source_tab_contents_->GetController().GetActiveEntry(); source_tab_contents_->ShowPageInfo(nav_entry->GetURL(), nav_entry->GetSSL(), true); diff --git a/chrome/browser/tabs/pinned_tab_codec.cc b/chrome/browser/tabs/pinned_tab_codec.cc index abac1c0..74a9920 100644 --- a/chrome/browser/tabs/pinned_tab_codec.cc +++ b/chrome/browser/tabs/pinned_tab_codec.cc @@ -17,6 +17,8 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_entry.h" +using content::NavigationEntry; + typedef BrowserInit::LaunchWithProfile::Tab Tab; // Key used in dictionaries for the app id. @@ -54,7 +56,7 @@ static void EncodePinnedTab(TabStripModel* model, value->SetString(kURL, extension->GetFullLaunchURL().spec()); values->Append(value.release()); } else { - content::NavigationEntry* entry = + 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_finder.cc b/chrome/browser/tabs/tab_finder.cc index e5199cd..43d66f7 100644 --- a/chrome/browser/tabs/tab_finder.cc +++ b/chrome/browser/tabs/tab_finder.cc @@ -24,6 +24,7 @@ #include "content/public/common/frame_navigate_params.h" #include "content/public/common/page_transition_types.h" +using content::NavigationEntry; using content::WebContents; class TabFinder::WebContentsObserverImpl : public content::WebContentsObserver { @@ -211,7 +212,7 @@ void TabFinder::FetchRedirectStart(WebContents* tab) { if (profile->IsOffTheRecord()) return; - content::NavigationEntry* committed_entry = + NavigationEntry* committed_entry = tab->GetController().GetLastCommittedEntry(); if (!committed_entry || committed_entry->GetURL().is_empty()) return; diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index f85e616..277aea6 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -34,6 +34,7 @@ #include "content/public/browser/user_metrics.h" #include "content/public/browser/web_contents_delegate.h" +using content::NavigationEntry; using content::UserMetricsAction; using content::WebContents; @@ -216,14 +217,13 @@ TabContentsWrapper* TabStripModel::DiscardTabContentsAt(int index) { NULL /* base_tab_contents */, NULL /* session_storage_namespace */)); TabContentsWrapper* old_contents = GetContentsAt(index); - content::NavigationEntry* old_nav_entry = + NavigationEntry* old_nav_entry = old_contents->tab_contents()->GetController().GetActiveEntry(); if (old_nav_entry) { // Set the new tab contents to reload this URL when clicked. // This also allows the tab to keep drawing the favicon and page title. - content::NavigationEntry* new_nav_entry = - content::NavigationEntry::Create(*old_nav_entry); - std::vector<content::NavigationEntry*> entries; + NavigationEntry* new_nav_entry = NavigationEntry::Create(*old_nav_entry); + std::vector<NavigationEntry*> entries; entries.push_back(new_nav_entry); null_contents->tab_contents()->GetController().Restore(0, false, &entries); } diff --git a/chrome/browser/translate/options_menu_model.cc b/chrome/browser/translate/options_menu_model.cc index af19ca6..229195a 100644 --- a/chrome/browser/translate/options_menu_model.cc +++ b/chrome/browser/translate/options_menu_model.cc @@ -16,6 +16,7 @@ #include "grit/locale_settings.h" #include "ui/base/l10n/l10n_util.h" +using content::NavigationEntry; using content::OpenURLParams; using content::Referrer; using content::WebContents; @@ -100,7 +101,7 @@ bool OptionsMenuModel::IsCommandIdEnabled(int command_id) const { DCHECK(translate_infobar_delegate_ != NULL); DCHECK(translate_infobar_delegate_->owner() != NULL); DCHECK(translate_infobar_delegate_->owner()->web_contents() != NULL); - content::NavigationEntry* entry = translate_infobar_delegate_->owner()-> + NavigationEntry* entry = translate_infobar_delegate_->owner()-> web_contents()->GetController().GetActiveEntry(); // Delegate and tab contents should never be NULL, but active entry // can be NULL when running tests. We want to return false if NULL. diff --git a/chrome/browser/translate/translate_infobar_delegate.cc b/chrome/browser/translate/translate_infobar_delegate.cc index cb285d2..5f19dbf 100644 --- a/chrome/browser/translate/translate_infobar_delegate.cc +++ b/chrome/browser/translate/translate_infobar_delegate.cc @@ -23,6 +23,8 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +using content::NavigationEntry; + // static const size_t TranslateInfoBarDelegate::kNoIndex = static_cast<size_t>(-1); @@ -399,7 +401,7 @@ TranslateInfoBarDelegate* } std::string TranslateInfoBarDelegate::GetPageHost() { - content::NavigationEntry* entry = + NavigationEntry* entry = owner()->web_contents()->GetController().GetActiveEntry(); return entry ? entry->GetURL().HostNoBrackets() : std::string(); } diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index dd1ec5a..dcb2324 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -48,6 +48,7 @@ #include "net/url_request/url_request_status.h" #include "ui/base/resource/resource_bundle.h" +using content::NavigationEntry; using content::WebContents; namespace { @@ -262,7 +263,7 @@ void TranslateManager::Observe(int type, content::Source<NavigationController>(source).ptr(); content::LoadCommittedDetails* load_details = content::Details<content::LoadCommittedDetails>(details).ptr(); - content::NavigationEntry* entry = controller->GetActiveEntry(); + NavigationEntry* entry = controller->GetActiveEntry(); if (!entry) { NOTREACHED(); return; @@ -402,7 +403,7 @@ void TranslateManager::OnURLFetchComplete(const content::URLFetcher* source) { // The tab went away while we were retrieving the script. continue; } - content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); + NavigationEntry* entry = tab->GetController().GetActiveEntry(); if (!entry || entry->GetPageID() != request.page_id) { // We navigated away from the page the translation was triggered on. continue; @@ -468,7 +469,7 @@ void TranslateManager::InitiateTranslation(WebContents* tab, if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableTranslate)) return; - content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); + NavigationEntry* entry = tab->GetController().GetActiveEntry(); if (!entry) { // This can happen for popups created with window.open(""). return; @@ -553,8 +554,7 @@ void TranslateManager::InitiateTranslationPosted( void TranslateManager::TranslatePage(WebContents* web_contents, const std::string& source_lang, const std::string& target_lang) { - content::NavigationEntry* entry = - web_contents->GetController().GetActiveEntry(); + NavigationEntry* entry = web_contents->GetController().GetActiveEntry(); if (!entry) { NOTREACHED(); return; @@ -586,8 +586,7 @@ void TranslateManager::TranslatePage(WebContents* web_contents, } void TranslateManager::RevertTranslation(WebContents* web_contents) { - content::NavigationEntry* entry = - web_contents->GetController().GetActiveEntry(); + NavigationEntry* entry = web_contents->GetController().GetActiveEntry(); if (!entry) { NOTREACHED(); return; @@ -633,7 +632,7 @@ void TranslateManager::DoTranslatePage(WebContents* tab, const std::string& translate_script, const std::string& source_lang, const std::string& target_lang) { - content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); + NavigationEntry* entry = tab->GetController().GetActiveEntry(); if (!entry) { NOTREACHED(); return; diff --git a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc index 64f6930..908f4046 100644 --- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc +++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc @@ -15,6 +15,8 @@ #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" +using content::NavigationEntry; + BlockedContentTabHelper::BlockedContentTabHelper( TabContentsWrapper* tab_contents) : content::WebContentsObserver(tab_contents->web_contents()), @@ -81,7 +83,7 @@ void BlockedContentTabHelper::AddPopup(TabContentsWrapper* new_contents, // entry is the page to be loaded as we navigate away from the unloading // page. For this reason, we can't use GetURL() to get the opener URL, // because it returns the active entry. - content::NavigationEntry* entry = + NavigationEntry* entry = web_contents()->GetController().GetLastCommittedEntry(); GURL creator = entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); Profile* profile = diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 4a92d74..a2116b5 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -207,6 +207,7 @@ #endif using base::TimeDelta; +using content::NavigationEntry; using content::OpenURLParams; using content::PluginService; using content::Referrer; @@ -252,7 +253,7 @@ const int kUIUpdateCoalescingTimeMS = 200; const char kHashMark[] = "#"; // Returns |true| if entry has an internal chrome:// URL, |false| otherwise. -bool HasInternalURL(const content::NavigationEntry* entry) { +bool HasInternalURL(const NavigationEntry* entry) { if (!entry) return false; @@ -1306,7 +1307,7 @@ TabContents* Browser::AddRestoredTab( session_storage_namespace); TabContents* new_tab = wrapper->tab_contents(); wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); - std::vector<content::NavigationEntry*> entries; + std::vector<NavigationEntry*> entries; TabNavigation::CreateNavigationEntriesFromTabNavigations( profile_, navigations, &entries); new_tab->GetController().Restore( @@ -1356,7 +1357,7 @@ void Browser::ReplaceRestoredTab( session_storage_namespace); wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); TabContents* replacement = wrapper->tab_contents(); - std::vector<content::NavigationEntry*> entries; + std::vector<NavigationEntry*> entries; TabNavigation::CreateNavigationEntriesFromTabNavigations( profile_, navigations, &entries); replacement->GetController().Restore( @@ -1548,8 +1549,7 @@ void Browser::ReloadInternal(WindowOpenDisposition disposition, // If we are showing an interstitial, treat this as an OpenURL. TabContents* current_tab = GetSelectedTabContents(); if (current_tab && current_tab->ShowingInterstitialPage()) { - content::NavigationEntry* entry = - current_tab->GetController().GetActiveEntry(); + NavigationEntry* entry = current_tab->GetController().GetActiveEntry(); DCHECK(entry); // Should exist if interstitial is showing. OpenURL(OpenURLParams( entry->GetURL(), Referrer(), disposition, @@ -2068,7 +2068,7 @@ void Browser::OpenCreateShortcutsDialog() { web_app::IsValidUrl(current_tab->tab_contents()->GetURL())) << "Menu item should be disabled."; - content::NavigationEntry* entry = + NavigationEntry* entry = current_tab->tab_contents()->GetController().GetLastCommittedEntry(); if (!entry) return; @@ -2183,7 +2183,7 @@ void Browser::ShowAboutConflictsTab() { void Browser::ShowBrokenPageTab(TabContents* contents) { content::RecordAction(UserMetricsAction("ReportBug")); string16 page_title = contents->GetTitle(); - content::NavigationEntry* entry = contents->GetController().GetActiveEntry(); + NavigationEntry* entry = contents->GetController().GetActiveEntry(); if (!entry) return; std::string page_url = entry->GetURL().spec(); @@ -3545,8 +3545,7 @@ void Browser::LoadingStateChanged(TabContents* source) { // last committed entry is not NULL. Last committed entry could be NULL // when an interstitial page is injected (e.g. bad https certificate, // malware site etc). When this happens, we abort the shortcut update. - content::NavigationEntry* entry = - source->GetController().GetLastCommittedEntry(); + NavigationEntry* entry = source->GetController().GetLastCommittedEntry(); if (entry) { TabContentsWrapper::GetCurrentWrapperForContents(source)-> extension_tab_helper()->GetApplicationInfo(entry->GetPageID()); @@ -3991,7 +3990,7 @@ void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, if (GetSelectedTabContentsWrapper() != source) return; - content::NavigationEntry* entry = + NavigationEntry* entry = source->tab_contents()->GetController().GetLastCommittedEntry(); if (!entry || (entry->GetPageID() != page_id)) return; @@ -5211,7 +5210,7 @@ void Browser::CreateInstantIfNecessary() { void Browser::ViewSource(TabContentsWrapper* contents) { DCHECK(contents); - content::NavigationEntry* active_entry = + NavigationEntry* active_entry = contents->tab_contents()->GetController().GetActiveEntry(); if (!active_entry) return; @@ -5227,7 +5226,7 @@ void Browser::ViewSource(TabContentsWrapper* contents, TabContentsWrapper* view_source_contents = contents->Clone(); view_source_contents->tab_contents()->GetController().PruneAllButActive(); - content::NavigationEntry* active_entry = + NavigationEntry* active_entry = view_source_contents->tab_contents()->GetController().GetActiveEntry(); if (!active_entry) return; @@ -5282,7 +5281,7 @@ int Browser::GetContentRestrictionsForSelectedTab() { TabContents* current_tab = GetSelectedTabContents(); if (current_tab) { content_restrictions = current_tab->GetContentRestrictions(); - content::NavigationEntry* active_entry = + NavigationEntry* active_entry = current_tab->GetController().GetActiveEntry(); // See comment in UpdateCommandsForTabState about why we call url(). if (!SavePackage::IsSavableURL( diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index f8c9174a..97ece1e 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -62,6 +62,7 @@ #include "chrome/browser/browser_process.h" #endif +using content::NavigationEntry; using content::OpenURLParams; using content::Referrer; using content::WebContents; @@ -668,7 +669,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ui_test_utils::NavigateToURL(browser(), url); - content::NavigationEntry* entry = browser()->GetSelectedTabContents()-> + NavigationEntry* entry = browser()->GetSelectedTabContents()-> GetController().GetActiveEntry(); EXPECT_EQ(expected_favicon_url.spec(), entry->GetFavicon().url.spec()); } @@ -688,7 +689,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_FaviconChange) { ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme)); ui_test_utils::NavigateToURL(browser(), file_url); - content::NavigationEntry* entry = browser()->GetSelectedTabContents()-> + NavigationEntry* entry = browser()->GetSelectedTabContents()-> GetController().GetActiveEntry(); static const FilePath::CharType* kIcon = FILE_PATH_LITERAL("test1.png"); diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm index 299e999..323e17e 100644 --- a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm @@ -26,6 +26,7 @@ #include "content/public/browser/web_contents_delegate.h" #include "googleurl/src/gurl.h" +using content::NavigationEntry; using content::OpenURLParams; using content::Referrer; @@ -189,7 +190,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { return nil; } - content::NavigationEntry* entry = + NavigationEntry* entry = tabContents_->tab_contents()->GetController().GetActiveEntry(); if (!entry) { return nil; @@ -213,7 +214,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { return; } - content::NavigationEntry* entry = + NavigationEntry* entry = tabContents_->tab_contents()->GetController().GetActiveEntry(); if (!entry) return; @@ -228,7 +229,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (NSString*)title { - content::NavigationEntry* entry = + NavigationEntry* entry = tabContents_->tab_contents()->GetController().GetActiveEntry(); if (!entry) return nil; @@ -390,7 +391,7 @@ static NSAppleEventDescriptor* valueToDescriptor(Value* value) { } - (void)handlesViewSourceScriptCommand:(NSScriptCommand*)command { - content::NavigationEntry* entry = + NavigationEntry* entry = tabContents_->tab_contents()->GetController().GetLastCommittedEntry(); if (entry) { tabContents_->tab_contents()->OpenURL(OpenURLParams( diff --git a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm index 127cb21..8923653 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm @@ -15,6 +15,8 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/l10n/l10n_util_mac.h" +using content::NavigationEntry; + // The info-bubble point should look like it points to the bottom of the lock // icon. Determined with Pixie.app. const CGFloat kBubblePointYOffset = 2.0; @@ -95,7 +97,7 @@ bool LocationIconDecoration::OnMousePressed(NSRect frame) { return true; TabContents* tab = owner_->GetTabContents(); - content::NavigationEntry* nav_entry = tab->GetController().GetActiveEntry(); + NavigationEntry* nav_entry = tab->GetController().GetActiveEntry(); if (!nav_entry) { NOTREACHED(); return true; diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index f3ee402..f05f815 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -70,6 +70,7 @@ #include "ui/gfx/image/image.h" #include "webkit/glue/window_open_disposition.h" +using content::NavigationEntry; using content::OpenURLParams; namespace { @@ -1047,7 +1048,7 @@ gboolean LocationBarViewGtk::OnIconReleased(GtkWidget* sender, if (event->x == 0 && event->y == 0) return FALSE; - content::NavigationEntry* nav_entry = tab->GetController().GetActiveEntry(); + NavigationEntry* nav_entry = tab->GetController().GetActiveEntry(); if (!nav_entry) { NOTREACHED(); return FALSE; 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 21ce12b..1c02b63 100644 --- a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc +++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc @@ -16,12 +16,13 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/frame_navigate_params.h" +using content::NavigationEntry; using content::WebContents; namespace { // Returns true if the entry's transition type is FORM_SUBMIT. -bool IsFormSubmit(const content::NavigationEntry* entry) { +bool IsFormSubmit(const NavigationEntry* entry) { return (content::PageTransitionStripQualifier(entry->GetTransitionType()) == content::PAGE_TRANSITION_FORM_SUBMIT); } @@ -91,10 +92,10 @@ void SearchEngineTabHelper::OnPageHasOSDD( } const NavigationController& controller = web_contents()->GetController(); - const content::NavigationEntry* entry = controller.GetLastCommittedEntry(); + const NavigationEntry* entry = controller.GetLastCommittedEntry(); DCHECK(entry); - const content::NavigationEntry* base_entry = entry; + const NavigationEntry* base_entry = entry; if (IsFormSubmit(base_entry)) { // If the current page is a form submit, find the last page that was not // a form submit and use its url to generate the keyword from. @@ -148,7 +149,7 @@ void SearchEngineTabHelper::GenerateKeywordIfNecessary( // happen in new tabs. if (last_index <= 0) return; - const content::NavigationEntry* previous_entry = + const 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 623fee8..f4138d5 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 @@ -12,6 +12,8 @@ #include "chrome/common/extensions/extension.h" #include "content/public/browser/navigation_entry.h" +using content::NavigationEntry; + TabContentsWrapperSyncedTabDelegate::TabContentsWrapperSyncedTabDelegate( TabContentsWrapper* tab_contents_wrapper) : tab_contents_wrapper_(tab_contents_wrapper) {} @@ -59,21 +61,18 @@ int TabContentsWrapperSyncedTabDelegate::GetPendingEntryIndex() const { pending_entry_index(); } -content::NavigationEntry* - TabContentsWrapperSyncedTabDelegate::GetPendingEntry() const { +NavigationEntry* TabContentsWrapperSyncedTabDelegate::GetPendingEntry() const { return tab_contents_wrapper_->tab_contents()->GetController().GetPendingEntry(); } -content::NavigationEntry* - TabContentsWrapperSyncedTabDelegate::GetEntryAtIndex(int i) +NavigationEntry* TabContentsWrapperSyncedTabDelegate::GetEntryAtIndex(int i) const { return tab_contents_wrapper_->tab_contents()->GetController().GetEntryAtIndex(i); } -content::NavigationEntry* - TabContentsWrapperSyncedTabDelegate::GetActiveEntry() const { +NavigationEntry* TabContentsWrapperSyncedTabDelegate::GetActiveEntry() const { 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 9c4932b..093cb92 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc @@ -29,6 +29,7 @@ #include "ui/base/text/text_elider.h" #include "ui/gfx/codec/png_codec.h" +using content::NavigationEntry; using content::UserMetricsAction; const int BackForwardMenuModel::kMaxHistoryItems = 12; @@ -90,7 +91,7 @@ string16 BackForwardMenuModel::GetLabelAt(int index) const { // Return the entry title, escaping any '&' characters and eliding it if it's // super long. - content::NavigationEntry* entry = GetNavigationEntry(index); + NavigationEntry* entry = GetNavigationEntry(index); Profile* profile = Profile::FromBrowserContext(GetTabContents()->GetBrowserContext()); string16 menu_text(entry->GetTitleForDisplay( @@ -135,7 +136,7 @@ bool BackForwardMenuModel::GetIconAt(int index, SkBitmap* icon) { *icon = *ResourceBundle::GetSharedInstance().GetBitmapNamed( IDR_HISTORY_FAVICON); } else { - content::NavigationEntry* entry = GetNavigationEntry(index); + NavigationEntry* entry = GetNavigationEntry(index); *icon = entry->GetFavicon().bitmap; if (!entry->GetFavicon().valid && menu_model_delegate()) { FetchFavicon(entry); @@ -223,7 +224,7 @@ void BackForwardMenuModel::SetMenuModelDelegate( menu_model_delegate_ = menu_model_delegate; } -void BackForwardMenuModel::FetchFavicon(content::NavigationEntry* entry) { +void BackForwardMenuModel::FetchFavicon(NavigationEntry* entry) { // If the favicon has already been requested for this menu, don't do // anything. if (requested_favicons_.find(entry->GetUniqueID()) != @@ -248,7 +249,7 @@ void BackForwardMenuModel::OnFavIconDataAvailable( if (favicon.is_valid()) { int unique_id = load_consumer_.GetClientDataForCurrentRequest(); // Find the current model_index for the unique_id. - content::NavigationEntry* entry = NULL; + NavigationEntry* entry = NULL; int model_index = -1; for (int i = 0; i < GetItemCount() - 1; i++) { if (IsSeparator(i)) @@ -348,8 +349,7 @@ int BackForwardMenuModel::GetIndexOfNextChapterStop(int start_from, } } - content::NavigationEntry* start_entry = - controller.GetEntryAtIndex(start_from); + NavigationEntry* start_entry = controller.GetEntryAtIndex(start_from); const GURL& url = start_entry->GetURL(); if (!forward) { @@ -440,8 +440,7 @@ int BackForwardMenuModel::MenuIndexToNavEntryIndex(int index) const { return index; } -content::NavigationEntry* BackForwardMenuModel::GetNavigationEntry( - int index) const { +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/toolbar_model.cc b/chrome/browser/ui/toolbar/toolbar_model.cc index 9b5ae86..3db97da 100644 --- a/chrome/browser/ui/toolbar/toolbar_model.cc +++ b/chrome/browser/ui/toolbar/toolbar_model.cc @@ -27,6 +27,7 @@ #include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" +using content::NavigationEntry; using content::SSLStatus; ToolbarModel::ToolbarModel(Browser* browser) @@ -47,7 +48,7 @@ string16 ToolbarModel::GetText() const { Profile* profile = Profile::FromBrowserContext(navigation_controller->browser_context()); languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); - content::NavigationEntry* entry = navigation_controller->GetVisibleEntry(); + NavigationEntry* entry = navigation_controller->GetVisibleEntry(); if (!ShouldDisplayURL()) { url = GURL(); } else if (entry) { @@ -73,8 +74,7 @@ bool ToolbarModel::ShouldDisplayURL() const { // of view-source:chrome://newtab, which should display its URL despite what // chrome://newtab's WebUI says. NavigationController* controller = GetNavigationController(); - content::NavigationEntry* entry = - controller ? controller->GetVisibleEntry() : NULL; + NavigationEntry* entry = controller ? controller->GetVisibleEntry() : NULL; if (entry) { if (entry->IsViewSourceMode() || entry->GetPageType() == content::PAGE_TYPE_INTERSTITIAL) { @@ -100,7 +100,7 @@ ToolbarModel::SecurityLevel ToolbarModel::GetSecurityLevel() const { if (!navigation_controller) // We might not have a controller on init. return NONE; - content::NavigationEntry* entry = navigation_controller->GetVisibleEntry(); + NavigationEntry* entry = navigation_controller->GetVisibleEntry(); if (!entry) return NONE; diff --git a/chrome/browser/ui/views/location_bar/click_handler.cc b/chrome/browser/ui/views/location_bar/click_handler.cc index b6bbc35..a4f7a5d 100644 --- a/chrome/browser/ui/views/location_bar/click_handler.cc +++ b/chrome/browser/ui/views/location_bar/click_handler.cc @@ -11,6 +11,8 @@ #include "content/public/browser/navigation_entry.h" #include "ui/views/view.h" +using content::NavigationEntry; + ClickHandler::ClickHandler(const views::View* owner, LocationBarView* location_bar) : owner_(owner), @@ -27,7 +29,7 @@ void ClickHandler::OnMouseReleased(const views::MouseEvent& event) { return; TabContents* tab = location_bar_->GetTabContentsWrapper()->tab_contents(); - content::NavigationEntry* nav_entry = tab->GetController().GetActiveEntry(); + NavigationEntry* nav_entry = tab->GetController().GetActiveEntry(); if (!nav_entry) { NOTREACHED(); return; diff --git a/chrome/browser/ui/webui/cloud_print_signin_dialog.cc b/chrome/browser/ui/webui/cloud_print_signin_dialog.cc index 1374586..679b013 100644 --- a/chrome/browser/ui/webui/cloud_print_signin_dialog.cc +++ b/chrome/browser/ui/webui/cloud_print_signin_dialog.cc @@ -28,6 +28,7 @@ #include "content/public/browser/notification_types.h" using content::BrowserThread; +using content::NavigationEntry; using content::WebContents; // This module implements a sign in dialog for cloud print. @@ -64,7 +65,7 @@ void CloudPrintSigninFlowHandler::RegisterMessages() { if (web_ui_ && web_ui_->tab_contents()) { NavigationController* controller = &web_ui_->tab_contents()->GetController(); - content::NavigationEntry* pending_entry = controller->GetPendingEntry(); + NavigationEntry* pending_entry = controller->GetPendingEntry(); if (pending_entry) pending_entry->SetURL(CloudPrintURL( Profile::FromWebUI(web_ui_)).GetCloudPrintSigninURL()); diff --git a/chrome/browser/ui/webui/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview_handler.cc index 1c6600a..88bdc2d 100644 --- a/chrome/browser/ui/webui/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview_handler.cc @@ -58,6 +58,7 @@ #endif using content::BrowserThread; +using content::NavigationEntry; using content::OpenURLParams; using content::Referrer; using printing::Metafile; @@ -314,7 +315,7 @@ void PrintPreviewHandler::HandleGetPreview(const ListValue* args) { settings->SetString(printing::kSettingHeaderFooterTitle, initiator_tab->tab_contents()->GetTitle()); std::string url; - content::NavigationEntry* entry = + NavigationEntry* entry = initiator_tab->tab_contents()->GetController().GetActiveEntry(); if (entry) url = entry->GetVirtualURL().spec(); diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 1e6dc96..5cb2e63 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -68,6 +68,7 @@ #include "ui/aura/root_window.h" #endif +using content::NavigationEntry; using content::OpenURLParams; using content::Referrer; using content::WebContents; @@ -306,8 +307,7 @@ bool GetCurrentTabTitle(const Browser* browser, string16* title) { TabContents* tab_contents = browser->GetSelectedTabContents(); if (!tab_contents) return false; - content::NavigationEntry* last_entry = - tab_contents->GetController().GetActiveEntry(); + NavigationEntry* last_entry = tab_contents->GetController().GetActiveEntry(); if (!last_entry) return false; title->assign(last_entry->GetTitleForDisplay("")); diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index 5292d05..da2c8a9 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -46,6 +46,7 @@ using base::Time; using content::BrowserThread; using content::DownloadItem; +using content::NavigationEntry; using WebKit::WebPageSerializerClient; namespace { @@ -224,7 +225,7 @@ GURL SavePackage::GetUrlToBeSaved() { // from the NavigationEntry because it reflects its' origin // rather than the displayed one (returned by GetURL) which may be // different (like having "view-source:" on the front). - content::NavigationEntry* active_entry = + NavigationEntry* active_entry = web_contents()->GetController().GetActiveEntry(); return active_entry->GetURL(); } diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc index a8380e3..f0e6030 100644 --- a/content/browser/renderer_host/test_render_view_host.cc +++ b/content/browser/renderer_host/test_render_view_host.cc @@ -8,7 +8,7 @@ #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/test_tab_contents.h" #include "content/common/dom_storage_common.h" #include "content/common/view_messages.h" @@ -19,6 +19,7 @@ #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webpreferences.h" +using content::NavigationEntry; using webkit::forms::PasswordForm; void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, @@ -365,7 +366,7 @@ void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { } void RenderViewHostTestHarness::Reload() { - content::NavigationEntry* entry = controller().GetLastCommittedEntry(); + NavigationEntry* entry = controller().GetLastCommittedEntry(); DCHECK(entry); controller().Reload(false); rvh()->SendNavigate(entry->GetPageID(), entry->GetURL()); diff --git a/content/browser/site_instance_unittest.cc b/content/browser/site_instance_unittest.cc index 7857327..dcfcd3e 100644 --- a/content/browser/site_instance_unittest.cc +++ b/content/browser/site_instance_unittest.cc @@ -13,7 +13,7 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/site_instance.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/webui/empty_web_ui_factory.h" #include "content/public/common/content_client.h" @@ -25,6 +25,8 @@ using content::BrowserThread; using content::BrowserThreadImpl; +using content::NavigationEntry; +using content::NavigationEntryImpl; namespace { @@ -177,21 +179,18 @@ TEST_F(SiteInstanceTest, SiteInstanceDestructor) { &browsingDeleteCounter); EXPECT_EQ(0, siteDeleteCounter); - NavigationEntry* e1 = new NavigationEntry(instance, 0, url, - content::Referrer(), - string16(), - content::PAGE_TRANSITION_LINK, - false); + NavigationEntryImpl* e1 = new NavigationEntryImpl( + instance, 0, url, content::Referrer(), string16(), + content::PAGE_TRANSITION_LINK, false); // Redundantly setting e1's SiteInstance shouldn't affect the ref count. e1->set_site_instance(instance); EXPECT_EQ(0, siteDeleteCounter); // Add a second reference - NavigationEntry* e2 = new NavigationEntry(instance, 0, url, - content::Referrer(), string16(), - content::PAGE_TRANSITION_LINK, - false); + NavigationEntryImpl* e2 = new NavigationEntryImpl( + instance, 0, url, content::Referrer(), string16(), + content::PAGE_TRANSITION_LINK, false); // Now delete both entries and be sure the SiteInstance goes away. delete e1; @@ -244,12 +243,11 @@ TEST_F(SiteInstanceTest, CloneNavigationEntry) { TestSiteInstance::CreateTestSiteInstance(NULL, &siteDeleteCounter2, &browsingDeleteCounter); - NavigationEntry* e1 = new NavigationEntry(instance1, 0, url, - content::Referrer(), string16(), - content::PAGE_TRANSITION_LINK, - false); + NavigationEntryImpl* e1 = new NavigationEntryImpl( + instance1, 0, url, content::Referrer(), string16(), + content::PAGE_TRANSITION_LINK, false); // Clone the entry - NavigationEntry* e2 = new NavigationEntry(*e1); + NavigationEntryImpl* e2 = new NavigationEntryImpl(*e1); // Should be able to change the SiteInstance of the cloned entry. e2->set_site_instance(instance2); diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc index 55a7ba2..577b2d1 100644 --- a/content/browser/ssl/ssl_manager.cc +++ b/content/browser/ssl/ssl_manager.cc @@ -13,7 +13,7 @@ #include "content/browser/ssl/ssl_cert_error_handler.h" #include "content/browser/ssl/ssl_policy.h" #include "content/browser/ssl/ssl_request_info.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/provisional_load_details.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" @@ -24,6 +24,8 @@ #include "net/base/cert_status_flags.h" using content::BrowserThread; +using content::NavigationEntry; +using content::NavigationEntryImpl; using content::SSLStatus; using content::WebContents; @@ -130,8 +132,8 @@ void SSLManager::DidCommitProvisionalLoad( content::LoadCommittedDetails* details = content::Details<content::LoadCommittedDetails>(in_details).ptr(); - NavigationEntry* entry = - NavigationEntry::FromNavigationEntry(controller_->GetActiveEntry()); + NavigationEntryImpl* entry = + NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()); if (details->is_main_frame) { if (entry) { @@ -161,12 +163,12 @@ void SSLManager::DidCommitProvisionalLoad( void SSLManager::DidRunInsecureContent(const std::string& security_origin) { policy()->DidRunInsecureContent( - NavigationEntry::FromNavigationEntry(controller_->GetActiveEntry()), + NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()), security_origin); } bool SSLManager::ProcessedSSLErrorFromRequest() const { - content::NavigationEntry* entry = controller_->GetActiveEntry(); + NavigationEntry* entry = controller_->GetActiveEntry(); if (!entry) { NOTREACHED(); return false; @@ -244,10 +246,10 @@ void SSLManager::DidReceiveResourceRedirect(ResourceRedirectDetails* details) { void SSLManager::DidChangeSSLInternalState() { UpdateEntry( - NavigationEntry::FromNavigationEntry(controller_->GetActiveEntry())); + NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry())); } -void SSLManager::UpdateEntry(NavigationEntry* entry) { +void SSLManager::UpdateEntry(NavigationEntryImpl* entry) { // We don't always have a navigation entry to update, for example in the // case of the Web Inspector. if (!entry) diff --git a/content/browser/ssl/ssl_manager.h b/content/browser/ssl/ssl_manager.h index a5c65c2..6aa98cc 100644 --- a/content/browser/ssl/ssl_manager.h +++ b/content/browser/ssl/ssl_manager.h @@ -20,12 +20,15 @@ class LoadFromMemoryCacheDetails; class NavigationController; -class NavigationEntry; class ResourceDispatcherHost; class ResourceRedirectDetails; class ResourceRequestDetails; class SSLPolicy; +namespace content { +class NavigationEntryImpl; +} + namespace net { class SSLInfo; class URLRequest; @@ -110,7 +113,7 @@ class SSLManager : public content::NotificationObserver { void DidChangeSSLInternalState(); // Update the NavigationEntry with our current state. - void UpdateEntry(NavigationEntry* entry); + void UpdateEntry(content::NavigationEntryImpl* entry); // The backend for the SSLPolicy to actuate its decisions. SSLPolicyBackend backend_; diff --git a/content/browser/ssl/ssl_policy.cc b/content/browser/ssl/ssl_policy.cc index 57acc78..5202655 100644 --- a/content/browser/ssl/ssl_policy.cc +++ b/content/browser/ssl/ssl_policy.cc @@ -15,7 +15,7 @@ #include "content/browser/site_instance.h" #include "content/browser/ssl/ssl_cert_error_handler.h" #include "content/browser/ssl/ssl_request_info.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/ssl_status.h" @@ -24,6 +24,7 @@ #include "net/base/ssl_info.h" #include "webkit/glue/resource_type.h" +using content::NavigationEntryImpl; using content::SSLStatus; namespace { @@ -86,7 +87,7 @@ void SSLPolicy::OnCertError(SSLCertErrorHandler* handler) { } } -void SSLPolicy::DidRunInsecureContent(NavigationEntry* entry, +void SSLPolicy::DidRunInsecureContent(NavigationEntryImpl* entry, const std::string& security_origin) { if (!entry) return; @@ -108,7 +109,8 @@ void SSLPolicy::OnRequestStarted(SSLRequestInfo* info) { backend_->HostRanInsecureContent(info->url().host(), info->child_id()); } -void SSLPolicy::UpdateEntry(NavigationEntry* entry, TabContents* tab_contents) { +void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry, + TabContents* tab_contents) { DCHECK(entry); InitializeEntryIfNeeded(entry); @@ -206,7 +208,7 @@ void SSLPolicy::OnCertErrorInternal(SSLCertErrorHandler* handler, base::Bind(&SSLPolicy::OnAllowCertificate, base::Unretained(this))); } -void SSLPolicy::InitializeEntryIfNeeded(NavigationEntry* entry) { +void SSLPolicy::InitializeEntryIfNeeded(NavigationEntryImpl* entry) { if (entry->GetSSL().security_style != content::SECURITY_STYLE_UNKNOWN) return; diff --git a/content/browser/ssl/ssl_policy.h b/content/browser/ssl/ssl_policy.h index 302207d..1cf0de1 100644 --- a/content/browser/ssl/ssl_policy.h +++ b/content/browser/ssl/ssl_policy.h @@ -10,12 +10,15 @@ #include "webkit/glue/resource_type.h" -class NavigationEntry; class SSLCertErrorHandler; class SSLPolicyBackend; class SSLRequestInfo; class TabContents; +namespace content { +class NavigationEntryImpl; +} + // SSLPolicy // // This class is responsible for making the security decisions that concern the @@ -29,7 +32,7 @@ class SSLPolicy { // An error occurred with the certificate in an SSL connection. void OnCertError(SSLCertErrorHandler* handler); - void DidRunInsecureContent(NavigationEntry* entry, + void DidRunInsecureContent(content::NavigationEntryImpl* entry, const std::string& security_origin); // We have started a resource request with the given info. @@ -37,7 +40,8 @@ class SSLPolicy { // Update the SSL information in |entry| to match the current state. // |tab_contents| is the TabContents associated with this entry. - void UpdateEntry(NavigationEntry* entry, TabContents* tab_contents); + void UpdateEntry(content::NavigationEntryImpl* entry, + TabContents* tab_contents); SSLPolicyBackend* backend() const { return backend_; } @@ -54,7 +58,7 @@ class SSLPolicy { // If the security style of |entry| has not been initialized, then initialize // it with the default style for its URL. - void InitializeEntryIfNeeded(NavigationEntry* entry); + void InitializeEntryIfNeeded(content::NavigationEntryImpl* entry); // Mark |origin| as having run insecure content in the process with ID |pid|. void OriginRanInsecureContent(const std::string& origin, int pid); diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index d9590e1..75369a9 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -18,7 +18,7 @@ #include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/common/dom_storage_common.h" @@ -34,6 +34,8 @@ #include "net/url_request/url_request_context_getter.h" using content::BrowserThread; +using content::NavigationEntry; +using content::NavigationEntryImpl; using content::WebContents; using WebKit::WebDragOperation; using WebKit::WebDragOperationsMask; @@ -186,7 +188,7 @@ void InterstitialPage::Show() { (*tab_to_interstitial_page_)[tab_] = this; if (new_navigation_) { - NavigationEntry* entry = new NavigationEntry; + NavigationEntryImpl* entry = new NavigationEntryImpl; entry->SetURL(url_); entry->SetVirtualURL(url_); entry->set_page_type(content::PAGE_TYPE_INTERSTITIAL); @@ -238,7 +240,7 @@ void InterstitialPage::Hide() { if (tab_->GetInterstitialPage()) tab_->remove_interstitial_page(); // Let's revert to the original title if necessary. - content::NavigationEntry* entry = tab_->GetController().GetActiveEntry(); + NavigationEntry* entry = tab_->GetController().GetActiveEntry(); if (!new_navigation_ && should_revert_tab_title_) { entry->SetTitle(original_tab_title_); tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); @@ -370,7 +372,7 @@ void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host, const string16& title, base::i18n::TextDirection title_direction) { DCHECK(render_view_host == render_view_host_); - content::NavigationEntry* entry = tab_->GetController().GetActiveEntry(); + NavigationEntry* entry = tab_->GetController().GetActiveEntry(); if (!entry) { // Crash reports from the field indicate this can be NULL. // This is unexpected as InterstitialPages constructed with the diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc index 2e1b31d..c22532b 100644 --- a/content/browser/tab_contents/navigation_controller.cc +++ b/content/browser/tab_contents/navigation_controller.cc @@ -16,7 +16,7 @@ #include "content/browser/renderer_host/render_view_host.h" // Temporary #include "content/browser/site_instance.h" #include "content/browser/tab_contents/interstitial_page.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_context.h" @@ -32,6 +32,8 @@ #include "webkit/glue/webkit_glue.h" using content::GlobalRequestID; +using content::NavigationEntry; +using content::NavigationEntryImpl; using content::UserMetricsAction; namespace { @@ -60,7 +62,7 @@ void NotifyPrunedEntries(NavigationController* nav_controller, // losing the navigation entries and generating a new navigation entry after // this one. We don't want that. To avoid this we create a valid state which // WebKit will not treat as a new navigation. -void SetContentStateIfEmpty(NavigationEntry* entry) { +void SetContentStateIfEmpty(NavigationEntryImpl* entry) { if (entry->GetContentState().empty()) { entry->SetContentState( webkit_glue::CreateHistoryStateForURL(entry->GetURL())); @@ -70,15 +72,15 @@ void SetContentStateIfEmpty(NavigationEntry* entry) { // Configure all the NavigationEntries in entries for restore. This resets // the transition type to reload and makes sure the content state isn't empty. void ConfigureEntriesForRestore( - std::vector<linked_ptr<NavigationEntry> >* entries, + std::vector<linked_ptr<NavigationEntryImpl> >* entries, bool from_last_session) { 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]->SetTransitionType(content::PAGE_TRANSITION_RELOAD); (*entries)[i]->set_restore_type(from_last_session ? - NavigationEntry::RESTORE_LAST_SESSION : - NavigationEntry::RESTORE_CURRENT_SESSION); + NavigationEntryImpl::RESTORE_LAST_SESSION : + NavigationEntryImpl::RESTORE_CURRENT_SESSION); // NOTE(darin): This code is only needed for backwards compat. SetContentStateIfEmpty((*entries)[i].get()); } @@ -149,7 +151,7 @@ NavigationController::~NavigationController() { void NavigationController::Restore( int selected_navigation, bool from_last_session, - std::vector<content::NavigationEntry*>* entries) { + std::vector<NavigationEntry*>* entries) { // Verify that this controller is unused and that the input is valid. DCHECK(entry_count() == 0 && !GetPendingEntry()); DCHECK(selected_navigation >= 0 && @@ -157,9 +159,9 @@ void NavigationController::Restore( needs_reload_ = true; for (size_t i = 0; i < entries->size(); ++i) { - NavigationEntry* entry = - NavigationEntry::FromNavigationEntry((*entries)[i]); - entries_.push_back(linked_ptr<NavigationEntry>(entry)); + NavigationEntryImpl* entry = + NavigationEntryImpl::FromNavigationEntry((*entries)[i]); + entries_.push_back(linked_ptr<NavigationEntryImpl>(entry)); } entries->clear(); @@ -230,7 +232,7 @@ bool NavigationController::IsInitialNavigation() { } // static -content::NavigationEntry* NavigationController::CreateNavigationEntry( +NavigationEntry* NavigationController::CreateNavigationEntry( const GURL& url, const content::Referrer& referrer, content::PageTransition transition, @@ -243,7 +245,7 @@ content::NavigationEntry* NavigationController::CreateNavigationEntry( } // static -NavigationEntry* NavigationController::CreateNavigationEntryImpl( +NavigationEntryImpl* NavigationController::CreateNavigationEntryImpl( const GURL& url, const content::Referrer& referrer, content::PageTransition transition, bool is_renderer_initiated, const std::string& extra_headers, @@ -257,7 +259,7 @@ NavigationEntry* NavigationController::CreateNavigationEntryImpl( BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( &loaded_url, browser_context, &reverse_on_redirect); - NavigationEntry* entry = new NavigationEntry( + NavigationEntryImpl* entry = new NavigationEntryImpl( NULL, // The site instance for tabs is sent on navigation // (TabContents::GetSiteInstance). -1, @@ -273,13 +275,13 @@ NavigationEntry* NavigationController::CreateNavigationEntryImpl( return entry; } -NavigationEntry* NavigationController::GetEntryWithPageID( +NavigationEntryImpl* NavigationController::GetEntryWithPageID( SiteInstance* instance, int32 page_id) const { int index = GetEntryIndexWithPageID(instance, page_id); return (index != -1) ? entries_[index].get() : NULL; } -void NavigationController::LoadEntry(NavigationEntry* entry) { +void NavigationController::LoadEntry(NavigationEntryImpl* entry) { // Don't navigate to URLs disabled by policy. This prevents showing the URL // on the Omnibar when it is also going to be blocked by // ChildProcessSecurityPolicy::CanRequestURL. @@ -301,11 +303,11 @@ void NavigationController::LoadEntry(NavigationEntry* entry) { content::NotificationService::current()->Notify( content::NOTIFICATION_NAV_ENTRY_PENDING, content::Source<NavigationController>(this), - content::Details<content::NavigationEntry>(entry)); + content::Details<NavigationEntry>(entry)); NavigateToPendingEntry(NO_RELOAD); } -content::NavigationEntry* NavigationController::GetActiveEntry() const { +NavigationEntry* NavigationController::GetActiveEntry() const { if (transient_entry_index_ != -1) return entries_[transient_entry_index_].get(); if (pending_entry_) @@ -313,7 +315,7 @@ content::NavigationEntry* NavigationController::GetActiveEntry() const { return GetLastCommittedEntry(); } -content::NavigationEntry* NavigationController::GetVisibleEntry() const { +NavigationEntry* NavigationController::GetVisibleEntry() const { if (transient_entry_index_ != -1) return entries_[transient_entry_index_].get(); // Only return the pending_entry for new (non-history), browser-initiated @@ -337,7 +339,7 @@ int NavigationController::GetCurrentEntryIndex() const { return last_committed_entry_index_; } -content::NavigationEntry* NavigationController::GetLastCommittedEntry() const { +NavigationEntry* NavigationController::GetLastCommittedEntry() const { if (last_committed_entry_index_ == -1) return NULL; return entries_[last_committed_entry_index_].get(); @@ -346,17 +348,17 @@ content::NavigationEntry* NavigationController::GetLastCommittedEntry() const { bool NavigationController::CanViewSource() const { bool is_supported_mime_type = net::IsSupportedNonImageMimeType( tab_contents_->GetContentsMimeType().c_str()); - content::NavigationEntry* active_entry = GetActiveEntry(); + NavigationEntry* active_entry = GetActiveEntry(); return active_entry && !active_entry->IsViewSourceMode() && is_supported_mime_type && !tab_contents_->GetInterstitialPage(); } -content::NavigationEntry* NavigationController::GetEntryAtIndex( +NavigationEntry* NavigationController::GetEntryAtIndex( int index) const { return entries_.at(index).get(); } -content::NavigationEntry* NavigationController::GetEntryAtOffset( +NavigationEntry* NavigationController::GetEntryAtOffset( int offset) const { int index = (transient_entry_index_ != -1) ? transient_entry_index_ + offset : @@ -466,7 +468,7 @@ void NavigationController::RemoveEntryAtIndex(int index) { } void NavigationController::UpdateVirtualURLToURL( - NavigationEntry* entry, const GURL& new_url) { + NavigationEntryImpl* entry, const GURL& new_url) { GURL new_virtual_url(new_url); if (BrowserURLHandler::GetInstance()->ReverseURLRewrite( &new_virtual_url, entry->GetVirtualURL(), browser_context_)) { @@ -474,13 +476,14 @@ void NavigationController::UpdateVirtualURLToURL( } } -void NavigationController::AddTransientEntry(NavigationEntry* entry) { +void NavigationController::AddTransientEntry(NavigationEntryImpl* entry) { // Discard any current transient entry, we can only have one at a time. int index = 0; if (last_committed_entry_index_ != -1) index = last_committed_entry_index_ + 1; DiscardTransientEntry(); - entries_.insert(entries_.begin() + index, linked_ptr<NavigationEntry>(entry)); + entries_.insert( + entries_.begin() + index, linked_ptr<NavigationEntryImpl>(entry)); transient_entry_index_ = index; tab_contents_->NotifyNavigationStateChanged(kInvalidateAll); } @@ -495,10 +498,9 @@ void NavigationController::TransferURL( // The user initiated a load, we don't need to reload anymore. needs_reload_ = false; - NavigationEntry* entry = CreateNavigationEntryImpl(url, referrer, transition, - is_renderer_initiated, - extra_headers, - browser_context_); + NavigationEntryImpl* entry = CreateNavigationEntryImpl( + url, referrer, transition, is_renderer_initiated, extra_headers, + browser_context_); entry->set_transferred_global_request_id(transferred_global_request_id); LoadEntry(entry); @@ -512,10 +514,8 @@ void NavigationController::LoadURL( // The user initiated a load, we don't need to reload anymore. needs_reload_ = false; - NavigationEntry* entry = CreateNavigationEntryImpl(url, referrer, transition, - false, - extra_headers, - browser_context_); + NavigationEntryImpl* entry = CreateNavigationEntryImpl( + url, referrer, transition, false, extra_headers, browser_context_); LoadEntry(entry); } @@ -528,10 +528,8 @@ void NavigationController::LoadURLFromRenderer( // The user initiated a load, we don't need to reload anymore. needs_reload_ = false; - NavigationEntry* entry = CreateNavigationEntryImpl(url, referrer, transition, - true, - extra_headers, - browser_context_); + NavigationEntryImpl* entry = CreateNavigationEntryImpl( + url, referrer, transition, true, extra_headers, browser_context_); LoadEntry(entry); } @@ -602,8 +600,8 @@ bool NavigationController::RendererDidNavigate( // All committed entries should have nonempty content state so WebKit doesn't // get confused when we go back to them (see the function for details). DCHECK(!params.content_state.empty()); - NavigationEntry* active_entry = - NavigationEntry::FromNavigationEntry(GetActiveEntry()); + NavigationEntryImpl* active_entry = + NavigationEntryImpl::FromNavigationEntry(GetActiveEntry()); active_entry->SetContentState(params.content_state); // Once committed, we do not need to track if the entry was initiated by @@ -711,7 +709,7 @@ content::NavigationType NavigationController::ClassifyNavigation( tab_contents_->GetRenderViewHost()->Send(new ViewMsg_TempCrashWithData(url)); return content::NAVIGATION_TYPE_NAV_IGNORE; } - NavigationEntry* existing_entry = entries_[existing_entry_index].get(); + NavigationEntryImpl* existing_entry = entries_[existing_entry_index].get(); if (!content::PageTransitionIsMainFrame(params.transition)) { // All manual subframes would get new IDs and were handled above, so we @@ -761,13 +759,13 @@ bool NavigationController::IsRedirect( void NavigationController::RendererDidNavigateToNewPage( const ViewHostMsg_FrameNavigate_Params& params, bool* did_replace_entry) { - NavigationEntry* new_entry; + NavigationEntryImpl* new_entry; bool update_virtual_url; if (pending_entry_) { // TODO(brettw) this assumes that the pending entry is appropriate for the // new page that was just loaded. I don't think this is necessarily the // case! We should have some more tracking to know for sure. - new_entry = new NavigationEntry(*pending_entry_); + new_entry = new NavigationEntryImpl(*pending_entry_); // Don't use the page type from the pending entry. Some interstitial page // may have set the type to interstitial. Once we commit, however, the page @@ -775,7 +773,7 @@ void NavigationController::RendererDidNavigateToNewPage( new_entry->set_page_type(content::PAGE_TYPE_NORMAL); update_virtual_url = new_entry->update_virtual_url_with_url(); } else { - new_entry = new NavigationEntry; + new_entry = new NavigationEntryImpl; // When navigating to a new page, give the browser URL handler a chance to // update the virtual URL based on the new URL. For example, this is needed // to show chrome://bookmarks/#1 when the bookmarks webui extension changes @@ -807,7 +805,7 @@ void NavigationController::RendererDidNavigateToExistingPage( params.page_id); DCHECK(entry_index >= 0 && entry_index < static_cast<int>(entries_.size())); - NavigationEntry* entry = entries_[entry_index].get(); + NavigationEntryImpl* entry = entries_[entry_index].get(); // The URL may have changed due to redirects. The site instance will normally // be the same except during session restore, when no site instance will be @@ -844,9 +842,8 @@ void NavigationController::RendererDidNavigateToSamePage( // This mode implies we have a pending entry that's the same as an existing // entry for this page ID. This entry is guaranteed to exist by // ClassifyNavigation. All we need to do is update the existing entry. - NavigationEntry* existing_entry = GetEntryWithPageID( - tab_contents_->GetSiteInstance(), - params.page_id); + NavigationEntryImpl* existing_entry = GetEntryWithPageID( + tab_contents_->GetSiteInstance(), params.page_id); // We assign the entry's unique ID to be that of the new one. Since this is // always the result of a user action, we want to dismiss infobars, etc. like @@ -866,9 +863,8 @@ void NavigationController::RendererDidNavigateInPage( DCHECK(content::PageTransitionIsMainFrame(params.transition)) << "WebKit should only tell us about in-page navs for the main frame."; // We're guaranteed to have an entry for this one. - NavigationEntry* existing_entry = GetEntryWithPageID( - tab_contents_->GetSiteInstance(), - params.page_id); + NavigationEntryImpl* existing_entry = GetEntryWithPageID( + tab_contents_->GetSiteInstance(), params.page_id); // Reference fragment navigation. We're guaranteed to have the last_committed // entry and it will be the same page as the new navigation (minus the @@ -904,8 +900,8 @@ void NavigationController::RendererDidNavigateNewSubframe( // band with the actual navigations. DCHECK(GetLastCommittedEntry()) << "ClassifyNavigation should guarantee " << "that a last committed entry exists."; - NavigationEntry* new_entry = new NavigationEntry( - *NavigationEntry::FromNavigationEntry(GetLastCommittedEntry())); + NavigationEntryImpl* new_entry = new NavigationEntryImpl( + *NavigationEntryImpl::FromNavigationEntry(GetLastCommittedEntry())); new_entry->SetPageID(params.page_id); InsertOrReplaceEntry(new_entry, false); } @@ -937,7 +933,7 @@ bool NavigationController::RendererDidNavigateAutoSubframe( } int NavigationController::GetIndexOfEntry( - const NavigationEntry* entry) const { + const NavigationEntryImpl* entry) const { const NavigationEntries::const_iterator i(std::find( entries_.begin(), entries_.end(), @@ -946,7 +942,7 @@ int NavigationController::GetIndexOfEntry( } bool NavigationController::IsURLInPageNavigation(const GURL& url) const { - content::NavigationEntry* last_committed = GetLastCommittedEntry(); + NavigationEntry* last_committed = GetLastCommittedEntry(); if (!last_committed) return false; return AreURLsInPageNavigation(last_committed->GetURL(), url); @@ -971,8 +967,8 @@ void NavigationController::CopyStateFromAndPrune(NavigationController* source) { // The SiteInstance and page_id of the last committed entry needs to be // remembered at this point, in case there is only one committed entry // and it is pruned. - NavigationEntry* last_committed = - NavigationEntry::FromNavigationEntry(GetLastCommittedEntry()); + NavigationEntryImpl* last_committed = + NavigationEntryImpl::FromNavigationEntry(GetLastCommittedEntry()); SiteInstance* site_instance = last_committed ? last_committed->site_instance() : NULL; int32 minimum_page_id = last_committed ? last_committed->GetPageID() : -1; @@ -1074,18 +1070,19 @@ void NavigationController::DiscardNonCommittedEntries() { } } -content::NavigationEntry* NavigationController::GetPendingEntry() const { +NavigationEntry* NavigationController::GetPendingEntry() const { return pending_entry_; } -void NavigationController::InsertOrReplaceEntry(NavigationEntry* entry, +void NavigationController::InsertOrReplaceEntry(NavigationEntryImpl* entry, bool replace) { DCHECK(entry->GetTransitionType() != content::PAGE_TRANSITION_AUTO_SUBFRAME); // Copy the pending entry's unique ID to the committed entry. // I don't know if pending_entry_index_ can be other than -1 here. - const NavigationEntry* const pending_entry = (pending_entry_index_ == -1) ? - pending_entry_ : entries_[pending_entry_index_].get(); + const NavigationEntryImpl* const pending_entry = + (pending_entry_index_ == -1) ? + pending_entry_ : entries_[pending_entry_index_].get(); if (pending_entry) entry->set_unique_id(pending_entry->GetUniqueID()); @@ -1118,7 +1115,7 @@ void NavigationController::InsertOrReplaceEntry(NavigationEntry* entry, NotifyPrunedEntries(this, true, 1); } - entries_.push_back(linked_ptr<NavigationEntry>(entry)); + entries_.push_back(linked_ptr<NavigationEntryImpl>(entry)); last_committed_entry_index_ = static_cast<int>(entries_.size()) - 1; // This is a new page ID, so we need everybody to know about it. @@ -1137,7 +1134,7 @@ void NavigationController::NavigateToPendingEntry(ReloadType reload_type) { if (pending_entry_index_ != -1 && pending_entry_index_ == last_committed_entry_index_ && (entries_[pending_entry_index_]->restore_type() == - NavigationEntry::RESTORE_NONE) && + NavigationEntryImpl::RESTORE_NONE) && (entries_[pending_entry_index_]->GetTransitionType() & content::PAGE_TRANSITION_FORWARD_BACK)) { tab_contents_->Stop(); @@ -1172,9 +1169,9 @@ void NavigationController::NavigateToPendingEntry(ReloadType reload_type) { // This works for browser-initiated navigations. We handle renderer-initiated // navigations to restored entries in TabContents::OnGoToEntryAtOffset. if (pending_entry_ && !pending_entry_->site_instance() && - pending_entry_->restore_type() != NavigationEntry::RESTORE_NONE) { + pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE) { pending_entry_->set_site_instance(tab_contents_->GetPendingSiteInstance()); - pending_entry_->set_restore_type(NavigationEntry::RESTORE_NONE); + pending_entry_->set_restore_type(NavigationEntryImpl::RESTORE_NONE); } } @@ -1228,8 +1225,8 @@ void NavigationController::LoadIfNecessary() { NavigateToPendingEntry(NO_RELOAD); } -void NavigationController::NotifyEntryChanged( - const content::NavigationEntry* entry, int index) { +void NavigationController::NotifyEntryChanged(const NavigationEntry* entry, + int index) { content::EntryChangedDetails det; det.changed_entry = entry; det.index = index; @@ -1277,7 +1274,7 @@ int NavigationController::GetEntryIndexWithPageID( return -1; } -content::NavigationEntry* NavigationController::GetTransientEntry() const { +NavigationEntry* NavigationController::GetTransientEntry() const { if (transient_entry_index_ == -1) return NULL; return entries_[transient_entry_index_].get(); @@ -1293,8 +1290,8 @@ void NavigationController::InsertEntriesFrom( if (source.entries_[i].get()->GetPageType() != content::PAGE_TYPE_INTERSTITIAL) { entries_.insert(entries_.begin() + insert_index++, - linked_ptr<NavigationEntry>( - new NavigationEntry(*source.entries_[i]))); + linked_ptr<NavigationEntryImpl>( + new NavigationEntryImpl(*source.entries_[i]))); } } } diff --git a/content/browser/tab_contents/navigation_controller.h b/content/browser/tab_contents/navigation_controller.h index 79372a26..36a5ef9 100644 --- a/content/browser/tab_contents/navigation_controller.h +++ b/content/browser/tab_contents/navigation_controller.h @@ -21,7 +21,6 @@ #include "content/public/common/page_transition_types.h" #include "content/public/common/referrer.h" -class NavigationEntry; class SessionStorageNamespace; class SiteInstance; class TabContents; @@ -30,6 +29,7 @@ struct ViewHostMsg_FrameNavigate_Params; namespace content { class BrowserContext; class NavigationEntry; +class NavigationEntryImpl; struct LoadCommittedDetails; struct Referrer; } @@ -129,7 +129,7 @@ class CONTENT_EXPORT NavigationController { // Returns the index of the specified entry, or -1 if entry is not contained // in this NavigationController. - int GetIndexOfEntry(const NavigationEntry* entry) const; + int GetIndexOfEntry(const content::NavigationEntryImpl* entry) const; // Return the index of the entry with the corresponding instance and page_id, // or -1 if not found. @@ -138,8 +138,8 @@ class CONTENT_EXPORT NavigationController { // Return the entry with the corresponding instance and page_id, or NULL if // not found. - NavigationEntry* GetEntryWithPageID(SiteInstance* instance, - int32 page_id) const; + content::NavigationEntryImpl* GetEntryWithPageID(SiteInstance* instance, + int32 page_id) const; // Pending entry ------------------------------------------------------------- @@ -165,7 +165,7 @@ class CONTENT_EXPORT NavigationController { // represented as an entry, but should go away when the user navigates away // from them. // Note that adding a transient entry does not change the active contents. - void AddTransientEntry(NavigationEntry* entry); + void AddTransientEntry(content::NavigationEntryImpl* entry); // Returns the transient entry if any. Note that the returned entry is owned // by the navigation controller and may be deleted at any time. @@ -354,7 +354,7 @@ class CONTENT_EXPORT NavigationController { bool is_renderer_initiated, const std::string& extra_headers, content::BrowserContext* browser_context); - static NavigationEntry* CreateNavigationEntryImpl( + static content::NavigationEntryImpl* CreateNavigationEntryImpl( const GURL& url, const content::Referrer& referrer, content::PageTransition transition, @@ -374,7 +374,7 @@ class CONTENT_EXPORT NavigationController { // Causes the controller to load the specified entry. The function assumes // ownership of the pointer since it is put in the navigation list. // NOTE: Do not pass an entry that the controller already owns! - void LoadEntry(NavigationEntry* entry); + void LoadEntry(content::NavigationEntryImpl* entry); // Handlers for the different types of navigation types. They will actually // handle the navigations corresponding to the different NavClasses above. @@ -413,7 +413,8 @@ class CONTENT_EXPORT NavigationController { // Updates the virtual URL of an entry to match a new URL, for cases where // the real renderer URL is derived from the virtual URL, like view-source: - void UpdateVirtualURLToURL(NavigationEntry* entry, const GURL& new_url); + void UpdateVirtualURLToURL(content::NavigationEntryImpl* entry, + const GURL& new_url); // Invoked after session/tab restore or cloning a tab. Resets the transition // type of the entries, updates the max page id and creates the active @@ -422,7 +423,7 @@ class CONTENT_EXPORT NavigationController { // Inserts a new entry or replaces the current entry with a new one, removing // all entries after it. The new entry will become the active one. - void InsertOrReplaceEntry(NavigationEntry* entry, bool replace); + void InsertOrReplaceEntry(content::NavigationEntryImpl* entry, bool replace); // Removes the entry at |index|, as long as it is not the current entry. void RemoveEntryAtIndexInternal(int index); @@ -452,7 +453,8 @@ class CONTENT_EXPORT NavigationController { content::BrowserContext* browser_context_; // List of NavigationEntry for this tab - typedef std::vector<linked_ptr<NavigationEntry> > NavigationEntries; + typedef std::vector<linked_ptr<content::NavigationEntryImpl> > + NavigationEntries; NavigationEntries entries_; // An entry we haven't gotten a response for yet. This will be discarded @@ -462,7 +464,7 @@ class CONTENT_EXPORT NavigationController { // This may refer to an item in the entries_ list if the pending_entry_index_ // == -1, or it may be its own entry that should be deleted. Be careful with // the memory management. - NavigationEntry* pending_entry_; + content::NavigationEntryImpl* pending_entry_; // currently visible entry int last_committed_entry_index_; diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc index e533f5f..eb40586 100644 --- a/content/browser/tab_contents/navigation_controller_unittest.cc +++ b/content/browser/tab_contents/navigation_controller_unittest.cc @@ -19,7 +19,7 @@ #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/test_tab_contents.h" #include "content/common/view_messages.h" @@ -34,6 +34,8 @@ #include "webkit/glue/webkit_glue.h" using base::Time; +using content::NavigationEntry; +using content::NavigationEntryImpl; // NavigationControllerTest ---------------------------------------------------- @@ -727,7 +729,7 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) { // We know all the entries have the same site instance, so we can just grab // a random one for looking up other entries. - SiteInstance* site_instance = NavigationEntry::FromNavigationEntry( + SiteInstance* site_instance = NavigationEntryImpl::FromNavigationEntry( controller().GetLastCommittedEntry())->site_instance(); // That second URL should be the last committed and it should have gotten the @@ -1475,7 +1477,7 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { TEST_F(NavigationControllerTest, RestoreNavigate) { // Create a NavigationController with a restored set of tabs. GURL url("http://foo"); - std::vector<content::NavigationEntry*> entries; + std::vector<NavigationEntry*> entries; NavigationEntry* entry = NavigationController::CreateNavigationEntryImpl( url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, std::string(), browser_context()); @@ -1491,10 +1493,10 @@ 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, - NavigationEntry::FromNavigationEntry( + EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, + NavigationEntryImpl::FromNavigationEntry( our_controller.GetEntryAtIndex(0))->restore_type()); - EXPECT_FALSE(NavigationEntry::FromNavigationEntry( + EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( our_controller.GetEntryAtIndex(0))->site_instance()); // After navigating, we should have one entry, and it should be "pending". @@ -1504,10 +1506,10 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { EXPECT_EQ(our_controller.GetEntryAtIndex(0), our_controller.GetPendingEntry()); EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); - EXPECT_EQ(NavigationEntry::RESTORE_NONE, - NavigationEntry::FromNavigationEntry + EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, + NavigationEntryImpl::FromNavigationEntry (our_controller.GetEntryAtIndex(0))->restore_type()); - EXPECT_TRUE(NavigationEntry::FromNavigationEntry( + EXPECT_TRUE(NavigationEntryImpl::FromNavigationEntry( our_controller.GetEntryAtIndex(0))->site_instance()); // Say we navigated to that entry. @@ -1529,11 +1531,11 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { EXPECT_EQ(0, our_controller.last_committed_entry_index()); EXPECT_FALSE(our_controller.GetPendingEntry()); EXPECT_EQ(url, - NavigationEntry::FromNavigationEntry( + NavigationEntryImpl::FromNavigationEntry( our_controller.GetLastCommittedEntry())->site_instance()-> site()); - EXPECT_EQ(NavigationEntry::RESTORE_NONE, - NavigationEntry::FromNavigationEntry( + EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, + NavigationEntryImpl::FromNavigationEntry( our_controller.GetEntryAtIndex(0))->restore_type()); } @@ -1542,7 +1544,7 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { // Create a NavigationController with a restored set of tabs. GURL url("http://foo"); - std::vector<content::NavigationEntry*> entries; + std::vector<NavigationEntry*> entries; NavigationEntry* entry = NavigationController::CreateNavigationEntryImpl( url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, std::string(), browser_context()); @@ -1558,10 +1560,10 @@ 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, - NavigationEntry::FromNavigationEntry( + EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, + NavigationEntryImpl::FromNavigationEntry( our_controller.GetEntryAtIndex(0))->restore_type()); - EXPECT_FALSE(NavigationEntry::FromNavigationEntry( + EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( our_controller.GetEntryAtIndex(0))->site_instance()); // After navigating, we should have one entry, and it should be "pending". @@ -1571,10 +1573,10 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { EXPECT_EQ(our_controller.GetEntryAtIndex(0), our_controller.GetPendingEntry()); EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); - EXPECT_EQ(NavigationEntry::RESTORE_NONE, - NavigationEntry::FromNavigationEntry( + EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, + NavigationEntryImpl::FromNavigationEntry( our_controller.GetEntryAtIndex(0))->restore_type()); - EXPECT_TRUE(NavigationEntry::FromNavigationEntry( + EXPECT_TRUE(NavigationEntryImpl::FromNavigationEntry( our_controller.GetEntryAtIndex(0))->site_instance()); // This pending navigation may have caused a different navigation to fail, @@ -1609,11 +1611,11 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { EXPECT_EQ(0, our_controller.last_committed_entry_index()); EXPECT_FALSE(our_controller.GetPendingEntry()); EXPECT_EQ(url, - NavigationEntry::FromNavigationEntry( + NavigationEntryImpl::FromNavigationEntry( our_controller.GetLastCommittedEntry())->site_instance()-> site()); - EXPECT_EQ(NavigationEntry::RESTORE_NONE, - NavigationEntry::FromNavigationEntry( + EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, + NavigationEntryImpl::FromNavigationEntry( our_controller.GetEntryAtIndex(0))->restore_type()); } @@ -1629,7 +1631,7 @@ TEST_F(NavigationControllerTest, Interstitial) { const GURL url2("http://bar"); controller().LoadURL( url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - NavigationEntry::FromNavigationEntry(controller().GetPendingEntry())-> + NavigationEntryImpl::FromNavigationEntry(controller().GetPendingEntry())-> set_page_type(content::PAGE_TYPE_INTERSTITIAL); // At this point the interstitial will be displayed and the load will still @@ -1717,7 +1719,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { notifications.Reset(); // Adding a transient with no pending entry. - NavigationEntry* transient_entry = new NavigationEntry; + NavigationEntryImpl* transient_entry = new NavigationEntryImpl; transient_entry->SetURL(transient_url); controller().AddTransientEntry(transient_entry); @@ -1745,7 +1747,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { EXPECT_EQ(controller().entry_count(), 3); // Add a transient again, then navigate with no pending entry this time. - transient_entry = new NavigationEntry; + transient_entry = new NavigationEntryImpl; transient_entry->SetURL(transient_url); controller().AddTransientEntry(transient_entry); EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL()); @@ -1757,7 +1759,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Initiate a navigation, add a transient then commit navigation. controller().LoadURL( url4, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - transient_entry = new NavigationEntry; + transient_entry = new NavigationEntryImpl; transient_entry->SetURL(transient_url); controller().AddTransientEntry(transient_entry); EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL()); @@ -1766,7 +1768,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { EXPECT_EQ(controller().entry_count(), 5); // Add a transient and go back. This should simply remove the transient. - transient_entry = new NavigationEntry; + transient_entry = new NavigationEntryImpl; transient_entry->SetURL(transient_url); controller().AddTransientEntry(transient_entry); EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL()); @@ -1779,7 +1781,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { rvh()->SendNavigate(3, url3); // Add a transient and go to an entry before the current one. - transient_entry = new NavigationEntry; + transient_entry = new NavigationEntryImpl; transient_entry->SetURL(transient_url); controller().AddTransientEntry(transient_entry); EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL()); @@ -1792,7 +1794,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { EXPECT_EQ(url1, controller().GetVisibleEntry()->GetURL()); // Add a transient and go to an entry after the current one. - transient_entry = new NavigationEntry; + transient_entry = new NavigationEntryImpl; transient_entry->SetURL(transient_url); controller().AddTransientEntry(transient_entry); EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL()); @@ -1806,7 +1808,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { EXPECT_EQ(url2, controller().GetVisibleEntry()->GetURL()); // Add a transient and go forward. - transient_entry = new NavigationEntry; + transient_entry = new NavigationEntryImpl; transient_entry->SetURL(transient_url); controller().AddTransientEntry(transient_entry); EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL()); @@ -1853,7 +1855,7 @@ TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { EXPECT_EQ(url1, controller().GetActiveEntry()->GetURL()); EXPECT_EQ(url0, controller().GetVisibleEntry()->GetURL()); EXPECT_TRUE( - NavigationEntry::FromNavigationEntry(controller().GetPendingEntry())-> + NavigationEntryImpl::FromNavigationEntry(controller().GetPendingEntry())-> is_renderer_initiated()); // After commit, both should be updated, and we should no longer treat the @@ -1862,7 +1864,7 @@ TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { EXPECT_EQ(url1, controller().GetActiveEntry()->GetURL()); EXPECT_EQ(url1, controller().GetVisibleEntry()->GetURL()); EXPECT_FALSE( - NavigationEntry::FromNavigationEntry( + NavigationEntryImpl::FromNavigationEntry( controller().GetLastCommittedEntry())->is_renderer_initiated()); notifications.Reset(); @@ -1951,7 +1953,7 @@ TEST_F(NavigationControllerTest, CloneOmitsInterstitials) { NavigateAndCommit(url2); // Add an interstitial entry. Should be deleted with controller. - NavigationEntry* interstitial_entry = new NavigationEntry(); + NavigationEntryImpl* interstitial_entry = new NavigationEntryImpl(); interstitial_entry->set_page_type(content::PAGE_TYPE_INTERSTITIAL); controller().AddTransientEntry(interstitial_entry); @@ -2009,7 +2011,7 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune) { NavigationController& other_controller = other_contents->GetController(); other_contents->NavigateAndCommit(url3); other_contents->ExpectSetHistoryLengthAndPrune( - NavigationEntry::FromNavigationEntry( + NavigationEntryImpl::FromNavigationEntry( other_controller.GetEntryAtIndex(0))->site_instance(), 2, other_controller.GetEntryAtIndex(0)->GetPageID()); other_controller.CopyStateFromAndPrune(&controller()); @@ -2208,7 +2210,7 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForTransient) { rvh()->SendNavigate(1, url1); // Adding a transient with no pending entry. - NavigationEntry* transient_entry = new NavigationEntry; + NavigationEntryImpl* transient_entry = new NavigationEntryImpl; transient_entry->SetURL(transient_url); controller().AddTransientEntry(transient_entry); diff --git a/content/browser/tab_contents/navigation_entry.cc b/content/browser/tab_contents/navigation_entry_impl.cc index 4649514..e0b924c 100644 --- a/content/browser/tab_contents/navigation_entry.cc +++ b/content/browser/tab_contents/navigation_entry_impl.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -12,9 +12,6 @@ #include "net/base/net_util.h" #include "ui/base/text/text_elider.h" -using content::FaviconStatus; -using content::SSLStatus; - // Use this to get a new unique ID for a NavigationEntry during construction. // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). static int GetUniqueIDInConstructor() { @@ -25,42 +22,40 @@ static int GetUniqueIDInConstructor() { namespace content { NavigationEntry* NavigationEntry::Create() { - return new ::NavigationEntry(); + return new NavigationEntryImpl(); } NavigationEntry* NavigationEntry::Create(const NavigationEntry& copy) { - return new ::NavigationEntry(static_cast<const ::NavigationEntry&>(copy)); -} - + return new NavigationEntryImpl(static_cast<const NavigationEntryImpl&>(copy)); } -NavigationEntry* NavigationEntry::FromNavigationEntry( - content::NavigationEntry* entry) { - return static_cast<NavigationEntry*>(entry); +NavigationEntryImpl* NavigationEntryImpl::FromNavigationEntry( + NavigationEntry* entry) { + return static_cast<NavigationEntryImpl*>(entry); } -NavigationEntry::NavigationEntry() +NavigationEntryImpl::NavigationEntryImpl() : unique_id_(GetUniqueIDInConstructor()), site_instance_(NULL), - page_type_(content::PAGE_TYPE_NORMAL), + page_type_(PAGE_TYPE_NORMAL), update_virtual_url_with_url_(false), page_id_(-1), - transition_type_(content::PAGE_TRANSITION_LINK), + transition_type_(PAGE_TRANSITION_LINK), has_post_data_(false), restore_type_(RESTORE_NONE), is_renderer_initiated_(false) { } -NavigationEntry::NavigationEntry(SiteInstance* instance, - int page_id, - const GURL& url, - const content::Referrer& referrer, - const string16& title, - content::PageTransition transition_type, - bool is_renderer_initiated) +NavigationEntryImpl::NavigationEntryImpl(SiteInstance* instance, + int page_id, + const GURL& url, + const Referrer& referrer, + const string16& title, + PageTransition transition_type, + bool is_renderer_initiated) : unique_id_(GetUniqueIDInConstructor()), site_instance_(instance), - page_type_(content::PAGE_TYPE_NORMAL), + page_type_(PAGE_TYPE_NORMAL), url_(url), referrer_(referrer), update_virtual_url_with_url_(false), @@ -72,73 +67,73 @@ NavigationEntry::NavigationEntry(SiteInstance* instance, is_renderer_initiated_(is_renderer_initiated) { } -NavigationEntry::~NavigationEntry() { +NavigationEntryImpl::~NavigationEntryImpl() { } -int NavigationEntry::GetUniqueID() const { +int NavigationEntryImpl::GetUniqueID() const { return unique_id_; } -content::PageType NavigationEntry::GetPageType() const { +PageType NavigationEntryImpl::GetPageType() const { return page_type_; } -void NavigationEntry::SetURL(const GURL& url) { +void NavigationEntryImpl::SetURL(const GURL& url) { url_ = url; cached_display_title_.clear(); } -const GURL& NavigationEntry::GetURL() const { +const GURL& NavigationEntryImpl::GetURL() const { return url_; } -void NavigationEntry::SetReferrer(const content::Referrer& referrer) { +void NavigationEntryImpl::SetReferrer(const Referrer& referrer) { referrer_ = referrer; } -const content::Referrer& NavigationEntry::GetReferrer() const { +const Referrer& NavigationEntryImpl::GetReferrer() const { return referrer_; } -void NavigationEntry::SetVirtualURL(const GURL& url) { +void NavigationEntryImpl::SetVirtualURL(const GURL& url) { virtual_url_ = (url == url_) ? GURL() : url; cached_display_title_.clear(); } -const GURL& NavigationEntry::GetVirtualURL() const { +const GURL& NavigationEntryImpl::GetVirtualURL() const { return virtual_url_.is_empty() ? url_ : virtual_url_; } -void NavigationEntry::SetTitle(const string16& title) { +void NavigationEntryImpl::SetTitle(const string16& title) { title_ = title; cached_display_title_.clear(); } -const string16& NavigationEntry::GetTitle() const { +const string16& NavigationEntryImpl::GetTitle() const { return title_; } -void NavigationEntry::SetContentState(const std::string& state) { +void NavigationEntryImpl::SetContentState(const std::string& state) { content_state_ = state; } -const std::string& NavigationEntry::GetContentState() const { +const std::string& NavigationEntryImpl::GetContentState() const { return content_state_; } -void NavigationEntry::SetPageID(int page_id) { +void NavigationEntryImpl::SetPageID(int page_id) { page_id_ = page_id; } -int32 NavigationEntry::GetPageID() const { +int32 NavigationEntryImpl::GetPageID() const { return page_id_; } -void NavigationEntry::set_site_instance(SiteInstance* site_instance) { +void NavigationEntryImpl::set_site_instance(SiteInstance* site_instance) { site_instance_ = site_instance; } -const string16& NavigationEntry::GetTitleForDisplay( +const string16& NavigationEntryImpl::GetTitleForDisplay( const std::string& languages) const { // Most pages have real titles. Don't even bother caching anything if this is // the case. @@ -165,47 +160,49 @@ const string16& NavigationEntry::GetTitleForDisplay( title = title.substr(slashpos + 1); } - ui::ElideString(title, content::kMaxTitleChars, &cached_display_title_); + ui::ElideString(title, kMaxTitleChars, &cached_display_title_); return cached_display_title_; } -bool NavigationEntry::IsViewSourceMode() const { +bool NavigationEntryImpl::IsViewSourceMode() const { return virtual_url_.SchemeIs(chrome::kViewSourceScheme); } -void NavigationEntry::SetTransitionType( - content::PageTransition transition_type) { +void NavigationEntryImpl::SetTransitionType( + PageTransition transition_type) { transition_type_ = transition_type; } -content::PageTransition NavigationEntry::GetTransitionType() const { +PageTransition NavigationEntryImpl::GetTransitionType() const { return transition_type_; } -const GURL& NavigationEntry::GetUserTypedURL() const { +const GURL& NavigationEntryImpl::GetUserTypedURL() const { return user_typed_url_; } -void NavigationEntry::SetHasPostData(bool has_post_data) { +void NavigationEntryImpl::SetHasPostData(bool has_post_data) { has_post_data_ = has_post_data; } -bool NavigationEntry::GetHasPostData() const { +bool NavigationEntryImpl::GetHasPostData() const { return has_post_data_; } -const FaviconStatus& NavigationEntry::GetFavicon() const { +const FaviconStatus& NavigationEntryImpl::GetFavicon() const { return favicon_; } -FaviconStatus& NavigationEntry::GetFavicon() { +FaviconStatus& NavigationEntryImpl::GetFavicon() { return favicon_; } -const SSLStatus& NavigationEntry::GetSSL() const { +const SSLStatus& NavigationEntryImpl::GetSSL() const { return ssl_; } -SSLStatus& NavigationEntry::GetSSL() { +SSLStatus& NavigationEntryImpl::GetSSL() { return ssl_; } + +} // namespace content diff --git a/content/browser/tab_contents/navigation_entry.h b/content/browser/tab_contents/navigation_entry_impl.h index d2e18dd..4032441 100644 --- a/content/browser/tab_contents/navigation_entry.h +++ b/content/browser/tab_contents/navigation_entry_impl.h @@ -2,12 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ -#define CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ +#ifndef CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_ +#define CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_ #pragma once #include "base/basictypes.h" -#include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/global_request_id.h" @@ -16,29 +15,29 @@ class SiteInstance; -class CONTENT_EXPORT NavigationEntry - : public NON_EXPORTED_BASE(content::NavigationEntry) { - public: - - static NavigationEntry* FromNavigationEntry(content::NavigationEntry* entry); - - NavigationEntry(); - NavigationEntry(SiteInstance* instance, - int page_id, - const GURL& url, - const content::Referrer& referrer, - const string16& title, - content::PageTransition transition_type, - bool is_renderer_initiated); - virtual ~NavigationEntry(); +namespace content { - // content::NavigationEntry implementation: +class NavigationEntryImpl : public NavigationEntry { + public: + static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); + + NavigationEntryImpl(); + NavigationEntryImpl(SiteInstance* instance, + int page_id, + const GURL& url, + const Referrer& referrer, + const string16& title, + PageTransition transition_type, + bool is_renderer_initiated); + virtual ~NavigationEntryImpl(); + + // NavigationEntry implementation: virtual int GetUniqueID() const OVERRIDE; - virtual content::PageType GetPageType() const OVERRIDE; + virtual 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 SetReferrer(const Referrer& referrer) OVERRIDE; + virtual const Referrer& GetReferrer() const OVERRIDE; virtual void SetVirtualURL(const GURL& url) OVERRIDE; virtual const GURL& GetVirtualURL() const OVERRIDE; virtual void SetTitle(const string16& title) OVERRIDE; @@ -50,16 +49,15 @@ 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 void SetTransitionType(PageTransition transition_type) OVERRIDE; + virtual PageTransition GetTransitionType() const OVERRIDE; virtual const GURL& GetUserTypedURL() const OVERRIDE; virtual void SetHasPostData(bool has_post_data) OVERRIDE; virtual bool GetHasPostData() const OVERRIDE; - virtual const content::FaviconStatus& GetFavicon() const OVERRIDE; - virtual content::FaviconStatus& GetFavicon() OVERRIDE; - virtual const content::SSLStatus& GetSSL() const OVERRIDE; - virtual content::SSLStatus& GetSSL() OVERRIDE; + virtual const FaviconStatus& GetFavicon() const OVERRIDE; + virtual FaviconStatus& GetFavicon() OVERRIDE; + virtual const SSLStatus& GetSSL() const OVERRIDE; + virtual SSLStatus& GetSSL() OVERRIDE; void set_unique_id(int unique_id) { unique_id_ = unique_id; @@ -77,7 +75,7 @@ class CONTENT_EXPORT NavigationEntry return site_instance_; } - void set_page_type(content::PageType page_type) { + void set_page_type(PageType page_type) { page_type_ = page_type; } @@ -136,11 +134,11 @@ class CONTENT_EXPORT NavigationEntry } void set_transferred_global_request_id( - const content::GlobalRequestID& transferred_global_request_id) { + const GlobalRequestID& transferred_global_request_id) { transferred_global_request_id_ = transferred_global_request_id; } - content::GlobalRequestID transferred_global_request_id() const { + GlobalRequestID transferred_global_request_id() const { return transferred_global_request_id_; } @@ -154,17 +152,17 @@ class CONTENT_EXPORT NavigationEntry // See the accessors above for descriptions. int unique_id_; scoped_refptr<SiteInstance> site_instance_; - content::PageType page_type_; + PageType page_type_; GURL url_; - content::Referrer referrer_; + Referrer referrer_; GURL virtual_url_; bool update_virtual_url_with_url_; string16 title_; - content::FaviconStatus favicon_; + FaviconStatus favicon_; std::string content_state_; int32 page_id_; - content::SSLStatus ssl_; - content::PageTransition transition_type_; + SSLStatus ssl_; + PageTransition transition_type_; GURL user_typed_url_; bool has_post_data_; RestoreType restore_type_; @@ -190,9 +188,11 @@ class CONTENT_EXPORT NavigationEntry // carries this |transferred_global_request_id_| annotation. Once the request // is transferred to the new process, this is cleared and the request // continues as normal. - content::GlobalRequestID transferred_global_request_id_; + GlobalRequestID transferred_global_request_id_; // Copy and assignment is explicitly allowed for this class. }; -#endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ +} // namespace content + +#endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_ diff --git a/content/browser/tab_contents/navigation_entry_unittest.cc b/content/browser/tab_contents/navigation_entry_impl_unittest.cc index 2e8712d..dc8d9e9 100644 --- a/content/browser/tab_contents/navigation_entry_unittest.cc +++ b/content/browser/tab_contents/navigation_entry_impl_unittest.cc @@ -6,11 +6,11 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "content/browser/site_instance.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/public/browser/ssl_status.h" #include "testing/gtest/include/gtest/gtest.h" -using content::SSLStatus; +namespace content { class NavigationEntryTest : public testing::Test { public: @@ -18,15 +18,15 @@ class NavigationEntryTest : public testing::Test { } virtual void SetUp() { - entry1_.reset(new NavigationEntry); + entry1_.reset(new NavigationEntryImpl); instance_ = SiteInstance::CreateSiteInstance(NULL); - entry2_.reset(new NavigationEntry( + entry2_.reset(new NavigationEntryImpl( instance_, 3, GURL("test:url"), - content::Referrer(GURL("from"), WebKit::WebReferrerPolicyDefault), + Referrer(GURL("from"), WebKit::WebReferrerPolicyDefault), ASCIIToUTF16("title"), - content::PAGE_TRANSITION_TYPED, + PAGE_TRANSITION_TYPED, false)); } @@ -34,8 +34,8 @@ class NavigationEntryTest : public testing::Test { } protected: - scoped_ptr<NavigationEntry> entry1_; - scoped_ptr<NavigationEntry> entry2_; + scoped_ptr<NavigationEntryImpl> entry1_; + scoped_ptr<NavigationEntryImpl> entry2_; // SiteInstances are deleted when their NavigationEntries are gone. SiteInstance* instance_; }; @@ -101,10 +101,8 @@ TEST_F(NavigationEntryTest, NavigationEntryFavicons) { // Test SSLStatus inner class TEST_F(NavigationEntryTest, NavigationEntrySSLStatus) { // Default (unknown) - EXPECT_EQ(content::SECURITY_STYLE_UNKNOWN, - entry1_.get()->GetSSL().security_style); - EXPECT_EQ(content::SECURITY_STYLE_UNKNOWN, - entry2_.get()->GetSSL().security_style); + EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry1_.get()->GetSSL().security_style); + EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry2_.get()->GetSSL().security_style); EXPECT_EQ(0, entry1_.get()->GetSSL().cert_id); EXPECT_EQ(0U, entry1_.get()->GetSSL().cert_status); EXPECT_EQ(-1, entry1_.get()->GetSSL().security_bits); @@ -122,16 +120,16 @@ TEST_F(NavigationEntryTest, NavigationEntryAccessors) { EXPECT_EQ(instance_, entry1_.get()->site_instance()); // Page type - EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry1_.get()->GetPageType()); - EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry2_.get()->GetPageType()); - entry2_.get()->set_page_type(content::PAGE_TYPE_INTERSTITIAL); - EXPECT_EQ(content::PAGE_TYPE_INTERSTITIAL, entry2_.get()->GetPageType()); + EXPECT_EQ(PAGE_TYPE_NORMAL, entry1_.get()->GetPageType()); + EXPECT_EQ(PAGE_TYPE_NORMAL, entry2_.get()->GetPageType()); + entry2_.get()->set_page_type(PAGE_TYPE_INTERSTITIAL); + EXPECT_EQ(PAGE_TYPE_INTERSTITIAL, entry2_.get()->GetPageType()); // Referrer EXPECT_EQ(GURL(), entry1_.get()->GetReferrer().url); EXPECT_EQ(GURL("from"), entry2_.get()->GetReferrer().url); entry2_.get()->SetReferrer( - content::Referrer(GURL("from2"), WebKit::WebReferrerPolicyDefault)); + Referrer(GURL("from2"), WebKit::WebReferrerPolicyDefault)); EXPECT_EQ(GURL("from2"), entry2_.get()->GetReferrer().url); // Title @@ -153,11 +151,10 @@ TEST_F(NavigationEntryTest, NavigationEntryAccessors) { EXPECT_EQ(2, entry2_.get()->GetPageID()); // Transition type - EXPECT_EQ(content::PAGE_TRANSITION_LINK, entry1_.get()->GetTransitionType()); - EXPECT_EQ(content::PAGE_TRANSITION_TYPED, entry2_.get()->GetTransitionType()); - entry2_.get()->SetTransitionType(content::PAGE_TRANSITION_RELOAD); - EXPECT_EQ(content::PAGE_TRANSITION_RELOAD, - entry2_.get()->GetTransitionType()); + EXPECT_EQ(PAGE_TRANSITION_LINK, entry1_.get()->GetTransitionType()); + EXPECT_EQ(PAGE_TRANSITION_TYPED, entry2_.get()->GetTransitionType()); + entry2_.get()->SetTransitionType(PAGE_TRANSITION_RELOAD); + EXPECT_EQ(PAGE_TRANSITION_RELOAD, entry2_.get()->GetTransitionType()); // Is renderer initiated EXPECT_FALSE(entry1_.get()->is_renderer_initiated()); @@ -172,8 +169,10 @@ TEST_F(NavigationEntryTest, NavigationEntryAccessors) { EXPECT_TRUE(entry2_.get()->GetHasPostData()); // Restored - EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type()); - EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type()); - entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION); - EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type()); + EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, entry1_->restore_type()); + EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, entry2_->restore_type()); + entry2_->set_restore_type(NavigationEntryImpl::RESTORE_LAST_SESSION); + EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, entry2_->restore_type()); } + +} // namespace content diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc index 3cd70f2..4c4c636 100644 --- a/content/browser/tab_contents/render_view_host_manager.cc +++ b/content/browser/tab_contents/render_view_host_manager.cc @@ -13,7 +13,7 @@ #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/webui/web_ui.h" #include "content/browser/webui/web_ui_factory.h" @@ -24,9 +24,8 @@ #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" -namespace base { -class WaitableEvent; -} +using content::NavigationEntry; +using content::NavigationEntryImpl; RenderViewHostManager::RenderViewHostManager( RenderViewHostDelegate* render_view_delegate, @@ -79,7 +78,8 @@ RenderWidgetHostView* RenderViewHostManager::GetRenderWidgetHostView() const { return render_view_host_->view(); } -RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) { +RenderViewHost* RenderViewHostManager::Navigate( + const NavigationEntryImpl& entry) { // Create a pending RenderViewHost. It will give us the one we should use RenderViewHost* dest_render_view_host = UpdateRendererStateForNavigate(entry); if (!dest_render_view_host) @@ -329,8 +329,8 @@ bool RenderViewHostManager::ShouldTransitionCrossSite() { } bool RenderViewHostManager::ShouldSwapProcessesForNavigation( - const content::NavigationEntry* cur_entry, - const NavigationEntry* new_entry) const { + const NavigationEntry* cur_entry, + const NavigationEntryImpl* new_entry) const { DCHECK(new_entry); // Check for reasons to swap processes even if we are in a process model that @@ -374,7 +374,7 @@ bool RenderViewHostManager::ShouldSwapProcessesForNavigation( } SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( - const NavigationEntry& entry, + const NavigationEntryImpl& entry, SiteInstance* curr_instance) { // NOTE: This is only called when ShouldTransitionCrossSite is true. @@ -429,7 +429,7 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( // In the case of session restore, as it loads all the pages immediately // we need to set the site first, otherwise after a restore none of the // pages would share renderers in process-per-site. - if (entry.restore_type() != NavigationEntry::RESTORE_NONE) + if (entry.restore_type() != NavigationEntryImpl::RESTORE_NONE) curr_instance->SetSite(dest_url); return curr_instance; @@ -445,7 +445,7 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( // For now, though, we're in a hybrid model where you only switch // SiteInstances if you type in a cross-site URL. This means we have to // compare the entry's URL to the last committed entry's URL. - content::NavigationEntry* curr_entry = controller.GetLastCommittedEntry(); + NavigationEntry* curr_entry = controller.GetLastCommittedEntry(); if (interstitial_page_) { // The interstitial is currently the last committed entry, but we want to // compare against the last non-interstitial entry. @@ -489,8 +489,8 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( } bool RenderViewHostManager::CreatePendingRenderView( - const NavigationEntry& entry, SiteInstance* instance) { - content::NavigationEntry* curr_entry = + const NavigationEntryImpl& entry, SiteInstance* instance) { + NavigationEntry* curr_entry = delegate_->GetControllerForRenderManager().GetLastCommittedEntry(); if (curr_entry) { DCHECK(!curr_entry->GetContentState().empty()); @@ -531,7 +531,7 @@ bool RenderViewHostManager::CreatePendingRenderView( } bool RenderViewHostManager::InitRenderView(RenderViewHost* render_view_host, - const NavigationEntry& entry) { + const NavigationEntryImpl& entry) { // If the pending navigation is to a WebUI, tell the RenderView about any // bindings it will need enabled. if (pending_web_ui_.get()) @@ -636,7 +636,7 @@ void RenderViewHostManager::CommitPending() { } RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate( - const NavigationEntry& entry) { + const NavigationEntryImpl& entry) { // If we are cross-navigating, then we want to get back to normal and navigate // as usual. if (cross_navigation_pending_) { diff --git a/content/browser/tab_contents/render_view_host_manager.h b/content/browser/tab_contents/render_view_host_manager.h index 4c524f7..a8051f2 100644 --- a/content/browser/tab_contents/render_view_host_manager.h +++ b/content/browser/tab_contents/render_view_host_manager.h @@ -17,7 +17,6 @@ class InterstitialPage; class NavigationController; -class NavigationEntry; class RenderViewHost; class RenderWidgetHostView; class WebUI; @@ -25,6 +24,7 @@ class WebUI; namespace content { class BrowserContext; class NavigationEntry; +class NavigationEntryImpl; } // Manages RenderViewHosts for a TabContents. Normally there is only one and @@ -132,7 +132,7 @@ class CONTENT_EXPORT RenderViewHostManager // navigation entry. It may create a new RenderViewHost or re-use an existing // one. The RenderViewHost to navigate will be returned. Returns NULL if one // could not be created. - RenderViewHost* Navigate(const NavigationEntry& entry); + RenderViewHost* Navigate(const content::NavigationEntryImpl& entry); // Instructs the various live views to stop. Called when the user directed the // page to stop loading. @@ -215,23 +215,24 @@ class CONTENT_EXPORT RenderViewHostManager // Either of the entries may be NULL. bool ShouldSwapProcessesForNavigation( const content::NavigationEntry* cur_entry, - const NavigationEntry* new_entry) const; + const content::NavigationEntryImpl* new_entry) const; // Returns an appropriate SiteInstance object for the given NavigationEntry, // possibly reusing the current SiteInstance. // Never called if --process-per-tab is used. - SiteInstance* GetSiteInstanceForEntry(const NavigationEntry& entry, - SiteInstance* curr_instance); + SiteInstance* GetSiteInstanceForEntry( + const content::NavigationEntryImpl& entry, + SiteInstance* curr_instance); // Helper method to create a pending RenderViewHost for a cross-site // navigation. - bool CreatePendingRenderView(const NavigationEntry& entry, + bool CreatePendingRenderView(const content::NavigationEntryImpl& entry, SiteInstance* instance); // Sets up the necessary state for a new RenderViewHost navigating to the // given entry. bool InitRenderView(RenderViewHost* render_view_host, - const NavigationEntry& entry); + const content::NavigationEntryImpl& entry); // Sets the pending RenderViewHost/WebUI to be the active one. Note that this // doesn't require the pending render_view_host_ pointer to be non-NULL, since @@ -241,7 +242,8 @@ class CONTENT_EXPORT RenderViewHostManager // Helper method to terminate the pending RenderViewHost. void CancelPending(); - RenderViewHost* UpdateRendererStateForNavigate(const NavigationEntry& entry); + RenderViewHost* UpdateRendererStateForNavigate( + const content::NavigationEntryImpl& entry); // Called when a renderer process is starting to close. We should not // schedule new navigations in its swapped out RenderViewHosts after this. 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 497cd5f..6ad75931 100644 --- a/content/browser/tab_contents/render_view_host_manager_unittest.cc +++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc @@ -8,7 +8,7 @@ #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/render_view_host_manager.h" #include "content/browser/tab_contents/test_tab_contents.h" #include "content/browser/webui/empty_web_ui_factory.h" @@ -27,6 +27,8 @@ using content::BrowserThread; using content::BrowserThreadImpl; +using content::NavigationEntry; +using content::NavigationEntryImpl; namespace { @@ -139,8 +141,8 @@ class RenderViewHostManagerTest : public RenderViewHostTestHarness { } bool ShouldSwapProcesses(RenderViewHostManager* manager, - const NavigationEntry* cur_entry, - const NavigationEntry* new_entry) const { + const NavigationEntryImpl* cur_entry, + const NavigationEntryImpl* new_entry) const { return manager->ShouldSwapProcessesForNavigation(cur_entry, new_entry); } @@ -303,10 +305,10 @@ TEST_F(RenderViewHostManagerTest, Navigate) { // 1) The first navigation. -------------------------- const GURL kUrl1("http://www.google.com/"); - NavigationEntry entry1(NULL /* instance */, -1 /* page_id */, kUrl1, - content::Referrer(), string16() /* title */, - content::PAGE_TRANSITION_TYPED, - false /* is_renderer_init */); + NavigationEntryImpl entry1( + NULL /* instance */, -1 /* page_id */, kUrl1, content::Referrer(), + string16() /* title */, content::PAGE_TRANSITION_TYPED, + false /* is_renderer_init */); host = manager.Navigate(entry1); // The RenderViewHost created in Init will be reused. @@ -323,7 +325,7 @@ TEST_F(RenderViewHostManagerTest, Navigate) { // 2) Navigate to next site. ------------------------- const GURL kUrl2("http://www.google.com/foo"); - NavigationEntry entry2( + NavigationEntryImpl entry2( NULL /* instance */, -1 /* page_id */, kUrl2, content::Referrer(kUrl1, WebKit::WebReferrerPolicyDefault), string16() /* title */, content::PAGE_TRANSITION_LINK, @@ -342,7 +344,7 @@ TEST_F(RenderViewHostManagerTest, Navigate) { // 3) Cross-site navigate to next site. -------------- const GURL kUrl3("http://webkit.org/"); - NavigationEntry entry3( + NavigationEntryImpl entry3( NULL /* instance */, -1 /* page_id */, kUrl3, content::Referrer(kUrl2, WebKit::WebReferrerPolicyDefault), string16() /* title */, content::PAGE_TRANSITION_LINK, @@ -389,10 +391,10 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) { // 1) The first navigation. -------------------------- const GURL kUrl1("http://www.google.com/"); - NavigationEntry entry1(NULL /* instance */, -1 /* page_id */, kUrl1, - content::Referrer(), string16() /* title */, - content::PAGE_TRANSITION_TYPED, - false /* is_renderer_init */); + NavigationEntryImpl entry1(NULL /* instance */, -1 /* page_id */, kUrl1, + content::Referrer(), string16() /* title */, + content::PAGE_TRANSITION_TYPED, + false /* is_renderer_init */); RenderViewHost* host = manager.Navigate(entry1); // The RenderViewHost created in Init will be reused. @@ -415,10 +417,10 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) { // 2) Cross-site navigate to next site. ------------------------- const GURL kUrl2("http://www.example.com"); - NavigationEntry entry2(NULL /* instance */, -1 /* page_id */, kUrl2, - content::Referrer(), string16() /* title */, - content::PAGE_TRANSITION_TYPED, - false /* is_renderer_init */); + NavigationEntryImpl entry2( + NULL /* instance */, -1 /* page_id */, kUrl2, content::Referrer(), + string16() /* title */, content::PAGE_TRANSITION_TYPED, + false /* is_renderer_init */); RenderViewHost* host2 = manager.Navigate(entry2); // A new RenderViewHost should be created. @@ -463,10 +465,10 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) { // 3) Cross-site navigate to next site before 2) has committed. -------------- const GURL kUrl3("http://webkit.org/"); - NavigationEntry entry3(NULL /* instance */, -1 /* page_id */, kUrl3, - content::Referrer(), string16() /* title */, - content::PAGE_TRANSITION_TYPED, - false /* is_renderer_init */); + NavigationEntryImpl entry3(NULL /* instance */, -1 /* page_id */, kUrl3, + content::Referrer(), string16() /* title */, + content::PAGE_TRANSITION_TYPED, + false /* is_renderer_init */); RenderViewHost* host3 = manager.Navigate(entry3); // A new RenderViewHost should be created. @@ -515,10 +517,10 @@ TEST_F(RenderViewHostManagerTest, WebUI) { manager.Init(browser_context(), instance, MSG_ROUTING_NONE); const GURL kUrl(chrome::kTestNewTabURL); - NavigationEntry entry(NULL /* instance */, -1 /* page_id */, kUrl, - content::Referrer(), string16() /* title */, - content::PAGE_TRANSITION_TYPED, - false /* is_renderer_init */); + NavigationEntryImpl entry(NULL /* instance */, -1 /* page_id */, kUrl, + content::Referrer(), string16() /* title */, + content::PAGE_TRANSITION_TYPED, + false /* is_renderer_init */); RenderViewHost* host = manager.Navigate(entry); EXPECT_TRUE(host); @@ -554,17 +556,17 @@ TEST_F(RenderViewHostManagerTest, NonWebUIChromeURLs) { // NTP is a Web UI page. const GURL kNtpUrl(chrome::kTestNewTabURL); - NavigationEntry ntp_entry(NULL /* instance */, -1 /* page_id */, kNtpUrl, - content::Referrer(), string16() /* title */, - content::PAGE_TRANSITION_TYPED, - false /* is_renderer_init */); + NavigationEntryImpl ntp_entry(NULL /* instance */, -1 /* page_id */, kNtpUrl, + content::Referrer(), string16() /* title */, + content::PAGE_TRANSITION_TYPED, + false /* is_renderer_init */); // A URL with the Chrome UI scheme, that isn't handled by Web UI. GURL about_url(kChromeUISchemeButNotWebUIURL); - NavigationEntry about_entry(NULL /* instance */, -1 /* page_id */, about_url, - content::Referrer(), string16() /* title */, - content::PAGE_TRANSITION_TYPED, - false /* is_renderer_init */); + NavigationEntryImpl about_entry( + NULL /* instance */, -1 /* page_id */, about_url, + content::Referrer(), string16() /* title */, + content::PAGE_TRANSITION_TYPED, false /* is_renderer_init */); EXPECT_TRUE(ShouldSwapProcesses(&manager, &ntp_entry, &about_entry)); } @@ -610,8 +612,7 @@ TEST_F(RenderViewHostManagerTest, PageDoesBackAndReload) { EXPECT_EQ(evil_rvh, contents()->GetRenderManagerForTesting()->current_host()); // Also we should not have a pending navigation entry. - content::NavigationEntry* entry = - contents()->GetController().GetActiveEntry(); + NavigationEntry* entry = contents()->GetController().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_EQ(kUrl2, entry->GetURL()); } diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 215dcde..b7b5b05 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -28,7 +28,7 @@ #include "content/browser/renderer_host/resource_request_details.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/interstitial_page.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/provisional_load_details.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/tab_contents/title_updated_details.h" @@ -112,6 +112,8 @@ using content::DevToolsManagerImpl; using content::DownloadItem; using content::DownloadManager; using content::GlobalRequestID; +using content::NavigationEntry; +using content::NavigationEntryImpl; using content::OpenURLParams; using content::SSLStatus; using content::UserMetricsAction; @@ -139,7 +141,7 @@ BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) { #endif ViewMsg_Navigate_Type::Value GetNavigationType( - content::BrowserContext* browser_context, const NavigationEntry& entry, + content::BrowserContext* browser_context, const NavigationEntryImpl& entry, NavigationController::ReloadType reload_type) { switch (reload_type) { case NavigationController::RELOAD: @@ -150,14 +152,14 @@ ViewMsg_Navigate_Type::Value GetNavigationType( break; // Fall through to rest of function. } - if (entry.restore_type() == NavigationEntry::RESTORE_LAST_SESSION && + if (entry.restore_type() == NavigationEntryImpl::RESTORE_LAST_SESSION && browser_context->DidLastSessionExitCleanly()) return ViewMsg_Navigate_Type::RESTORE; return ViewMsg_Navigate_Type::NORMAL; } -void MakeNavigateParams(const NavigationEntry& entry, +void MakeNavigateParams(const NavigationEntryImpl& entry, const NavigationController& controller, content::WebContentsDelegate* delegate, NavigationController::ReloadType reload_type, @@ -372,7 +374,7 @@ content::ViewType TabContents::GetViewType() const { const GURL& TabContents::GetURL() const { // We may not have a navigation entry yet - content::NavigationEntry* entry = controller_.GetActiveEntry(); + NavigationEntry* entry = controller_.GetActiveEntry(); return entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); } @@ -431,7 +433,7 @@ WebUI* TabContents::GetCommittedWebUI() const { const string16& TabContents::GetTitle() const { // Transient entries take precedence. They are used for interstitial pages // that are shown on top of existing pages. - content::NavigationEntry* entry = controller_.GetTransientEntry(); + NavigationEntry* entry = controller_.GetTransientEntry(); std::string accept_languages = content::GetContentClient()->browser()->GetAcceptLangs( GetBrowserContext()); @@ -779,12 +781,12 @@ WebContents* TabContents::OpenURL(const OpenURLParams& params) { bool TabContents::NavigateToPendingEntry( NavigationController::ReloadType reload_type) { return NavigateToEntry( - *NavigationEntry::FromNavigationEntry(controller_.GetPendingEntry()), + *NavigationEntryImpl::FromNavigationEntry(controller_.GetPendingEntry()), reload_type); } bool TabContents::NavigateToEntry( - const NavigationEntry& entry, + const NavigationEntryImpl& entry, NavigationController::ReloadType reload_type) { // The renderer will reject IPC messages with URLs longer than // this limit, so don't attempt to navigate with a longer URL. @@ -917,8 +919,8 @@ bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path, } bool TabContents::IsActiveEntry(int32 page_id) { - NavigationEntry* active_entry = - NavigationEntry::FromNavigationEntry(controller_.GetActiveEntry()); + NavigationEntryImpl* active_entry = + NavigationEntryImpl::FromNavigationEntry(controller_.GetActiveEntry()); return (active_entry != NULL && active_entry->site_instance() == GetSiteInstance() && active_entry->GetPageID() == page_id); @@ -999,7 +1001,7 @@ double TabContents::GetZoomLevel() const { GetRenderProcessHost()->GetID(), GetRenderViewHost()->routing_id()); } else { GURL url; - content::NavigationEntry* active_entry = GetController().GetActiveEntry(); + NavigationEntry* active_entry = GetController().GetActiveEntry(); // Since zoom map is updated using rewritten URL, use rewritten URL // to get the zoom level. url = active_entry ? active_entry->GetURL() : GURL::EmptyGURL(); @@ -1024,7 +1026,7 @@ void TabContents::ViewSource() { if (!delegate_) return; - content::NavigationEntry* active_entry = GetController().GetActiveEntry(); + NavigationEntry* active_entry = GetController().GetActiveEntry(); if (!active_entry) return; @@ -1105,7 +1107,7 @@ bool TabContents::FocusLocationBarByDefault() { WebUI* web_ui = GetWebUIForCurrentState(); if (web_ui) return web_ui->focus_location_bar_by_default(); - content::NavigationEntry* entry = controller_.GetActiveEntry(); + NavigationEntry* entry = controller_.GetActiveEntry(); if (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)) return true; return false; @@ -1163,7 +1165,7 @@ 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. - content::NavigationEntry* entry; + NavigationEntry* entry; if (page_id == -1) entry = controller_.GetPendingEntry(); else @@ -1329,7 +1331,7 @@ void TabContents::OnUpdateContentRestrictions(int restrictions) { void TabContents::OnGoToEntryAtOffset(int offset) { if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) { - NavigationEntry* entry = NavigationEntry::FromNavigationEntry( + NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( controller_.GetEntryAtOffset(offset)); if (!entry) return; @@ -1345,7 +1347,7 @@ void TabContents::OnGoToEntryAtOffset(int offset) { // If the entry is being restored and doesn't have a SiteInstance yet, fill // it in now that we know. This allows us to find the entry when it commits. if (!entry->site_instance() && - entry->restore_type() != NavigationEntry::RESTORE_NONE) { + entry->restore_type() != NavigationEntryImpl::RESTORE_NONE) { entry->set_site_instance(GetPendingSiteInstance()); } } @@ -1509,7 +1511,7 @@ void TabContents::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { UpdateMaxPageIDForSiteInstance(rvh->site_instance(), max_restored_page_id); } -bool TabContents::UpdateTitleForEntry(NavigationEntry* entry, +bool TabContents::UpdateTitleForEntry(NavigationEntryImpl* entry, const string16& title) { // For file URLs without a title, use the pathname instead. In the case of a // synthesized title, we don't want the update to count toward the "one set @@ -1613,7 +1615,7 @@ void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, content::Source<TabContents>(this), content::Details<RenderViewHost>(render_view_host)); - content::NavigationEntry* entry = controller_.GetActiveEntry(); + NavigationEntry* entry = controller_.GetActiveEntry(); if (!entry) return; @@ -1760,7 +1762,7 @@ void TabContents::UpdateState(RenderViewHost* rvh, rvh->site_instance(), page_id); if (entry_index < 0) return; - content::NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); + NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); if (state == entry->GetContentState()) return; // Nothing to update. @@ -1777,8 +1779,8 @@ void TabContents::UpdateTitle(RenderViewHost* rvh, SetNotWaitingForResponse(); DCHECK(rvh == GetRenderViewHost()); - NavigationEntry* entry = controller_.GetEntryWithPageID(rvh->site_instance(), - page_id); + NavigationEntryImpl* entry = controller_.GetEntryWithPageID( + rvh->site_instance(), page_id); // TODO(evan): make use of title_direction. // http://code.google.com/p/chromium/issues/detail?id=27094 @@ -1853,7 +1855,7 @@ void TabContents::DidStartLoading() { void TabContents::DidStopLoading() { scoped_ptr<LoadNotificationDetails> details; - content::NavigationEntry* entry = controller_.GetActiveEntry(); + NavigationEntry* entry = controller_.GetActiveEntry(); // An entry may not exist for a stop when loading an initial blank page or // if an iframe injected by script into a blank page finishes loading. if (entry) { @@ -2163,8 +2165,8 @@ WebUI* TabContents::CreateWebUIForRenderManager(const GURL& url) { return content::WebUIFactory::Get()->CreateWebUIForURL(this, url); } -content::NavigationEntry* -TabContents::GetLastCommittedNavigationEntryForRenderManager() { +NavigationEntry* + TabContents::GetLastCommittedNavigationEntryForRenderManager() { return controller_.GetLastCommittedEntry(); } diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 809c6ed..ddf9a1c 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -466,12 +466,13 @@ class CONTENT_EXPORT TabContents // This is used as the backend for state updates, which include a new title, // or the dedicated set title message. It returns true if the new title is // different and was therefore updated. - bool UpdateTitleForEntry(NavigationEntry* entry, const string16& title); + bool UpdateTitleForEntry(content::NavigationEntryImpl* entry, + const string16& title); // Causes the TabContents to navigate in the right renderer to |entry|, which // must be already part of the entries in the navigation controller. // This does not change the NavigationController state. - bool NavigateToEntry(const NavigationEntry& entry, + bool NavigateToEntry(const content::NavigationEntryImpl& entry, NavigationController::ReloadType reload_type); // Sets the history for this tab_contents to |history_length| entries, and diff --git a/content/browser/tab_contents/tab_contents_unittest.cc b/content/browser/tab_contents/tab_contents_unittest.cc index 4a2fdfd..bd73255 100644 --- a/content/browser/tab_contents/tab_contents_unittest.cc +++ b/content/browser/tab_contents/tab_contents_unittest.cc @@ -10,7 +10,7 @@ #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/interstitial_page.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/test_tab_contents.h" #include "content/browser/webui/empty_web_ui_factory.h" #include "content/common/view_messages.h" @@ -26,6 +26,8 @@ #include "webkit/glue/webkit_glue.h" using content::BrowserThread; +using content::NavigationEntry; +using content::NavigationEntryImpl; using webkit::forms::PasswordForm; namespace { @@ -305,7 +307,7 @@ TEST_F(TabContentsTest, SimpleNavigation) { // Controller's pending entry will have a NULL site instance until we assign // it in DidNavigate. EXPECT_TRUE( - NavigationEntry::FromNavigationEntry(controller().GetActiveEntry())-> + NavigationEntryImpl::FromNavigationEntry(controller().GetActiveEntry())-> site_instance() == NULL); // DidNavigate from the page @@ -317,7 +319,7 @@ TEST_F(TabContentsTest, SimpleNavigation) { // able to find it later. EXPECT_EQ( instance1, - NavigationEntry::FromNavigationEntry(controller().GetActiveEntry())-> + NavigationEntryImpl::FromNavigationEntry(controller().GetActiveEntry())-> site_instance()); } @@ -658,14 +660,14 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) { url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); TestRenderViewHost* ntp_rvh = rvh(); contents()->TestDidNavigate(ntp_rvh, 1, url1, content::PAGE_TRANSITION_TYPED); - content::NavigationEntry* entry1 = controller().GetLastCommittedEntry(); + NavigationEntry* entry1 = controller().GetLastCommittedEntry(); SiteInstance* instance1 = contents()->GetSiteInstance(); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(ntp_rvh, contents()->GetRenderViewHost()); EXPECT_EQ(url1, entry1->GetURL()); EXPECT_EQ(instance1, - NavigationEntry::FromNavigationEntry(entry1)->site_instance()); + NavigationEntryImpl::FromNavigationEntry(entry1)->site_instance()); EXPECT_TRUE(ntp_rvh->enabled_bindings() & content::BINDINGS_POLICY_WEB_UI); // Navigate to new site. @@ -682,7 +684,7 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) { // DidNavigate from the pending page. contents()->TestDidNavigate( google_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); - content::NavigationEntry* entry2 = controller().GetLastCommittedEntry(); + NavigationEntry* entry2 = controller().GetLastCommittedEntry(); SiteInstance* instance2 = contents()->GetSiteInstance(); EXPECT_FALSE(contents()->cross_navigation_pending()); @@ -691,7 +693,7 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) { EXPECT_FALSE(contents()->pending_rvh()); EXPECT_EQ(url2, entry2->GetURL()); EXPECT_EQ(instance2, - NavigationEntry::FromNavigationEntry(entry2)->site_instance()); + NavigationEntryImpl::FromNavigationEntry(entry2)->site_instance()); EXPECT_FALSE(google_rvh->enabled_bindings() & content::BINDINGS_POLICY_WEB_UI); @@ -702,7 +704,7 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) { EXPECT_FALSE(contents()->cross_navigation_pending()); contents()->TestDidNavigate( google_rvh, 2, url3, content::PAGE_TRANSITION_TYPED); - content::NavigationEntry* entry3 = controller().GetLastCommittedEntry(); + NavigationEntry* entry3 = controller().GetLastCommittedEntry(); SiteInstance* instance3 = contents()->GetSiteInstance(); EXPECT_FALSE(contents()->cross_navigation_pending()); @@ -711,7 +713,7 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) { EXPECT_FALSE(contents()->pending_rvh()); EXPECT_EQ(url3, entry3->GetURL()); EXPECT_EQ(instance3, - NavigationEntry::FromNavigationEntry(entry3)->site_instance()); + NavigationEntryImpl::FromNavigationEntry(entry3)->site_instance()); // Go back within the site. controller().GoBack(); @@ -740,11 +742,11 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) { // We should not have corrupted the NTP entry. EXPECT_EQ(instance3, - NavigationEntry::FromNavigationEntry(entry3)->site_instance()); + NavigationEntryImpl::FromNavigationEntry(entry3)->site_instance()); EXPECT_EQ(instance2, - NavigationEntry::FromNavigationEntry(entry2)->site_instance()); + NavigationEntryImpl::FromNavigationEntry(entry2)->site_instance()); EXPECT_EQ(instance1, - NavigationEntry::FromNavigationEntry(entry1)->site_instance()); + NavigationEntryImpl::FromNavigationEntry(entry1)->site_instance()); EXPECT_EQ(url1, entry1->GetURL()); } @@ -921,7 +923,7 @@ TEST_F(TabContentsTest, NavigationEntryContentState) { const GURL url("http://www.google.com"); controller().LoadURL( url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - content::NavigationEntry* entry = controller().GetLastCommittedEntry(); + NavigationEntry* entry = controller().GetLastCommittedEntry(); EXPECT_TRUE(entry == NULL); // Committed entry should have content state after DidNavigate. @@ -961,7 +963,7 @@ TEST_F(TabContentsTest, NavigationEntryContentStateNewWindow) { contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); // Should have a content state here. - content::NavigationEntry* entry = controller().GetLastCommittedEntry(); + NavigationEntry* entry = controller().GetLastCommittedEntry(); EXPECT_FALSE(entry->GetContentState().empty()); } @@ -1001,7 +1003,7 @@ TEST_F(TabContentsTest, EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); - content::NavigationEntry* entry = controller().GetActiveEntry(); + NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == url2); @@ -1046,7 +1048,7 @@ TEST_F(TabContentsTest, EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); - content::NavigationEntry* entry = controller().GetActiveEntry(); + NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == url2); @@ -1089,7 +1091,7 @@ TEST_F(TabContentsTest, ShowInterstitialNoNewNavigationDontProceed) { EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); - content::NavigationEntry* entry = controller().GetActiveEntry(); + NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); // The URL specified to the interstitial should have been ignored. EXPECT_TRUE(entry->GetURL() == url1); @@ -1138,7 +1140,7 @@ TEST_F(TabContentsTest, EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); - content::NavigationEntry* entry = controller().GetActiveEntry(); + NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == url2); @@ -1193,7 +1195,7 @@ TEST_F(TabContentsTest, EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); - content::NavigationEntry* entry = controller().GetActiveEntry(); + NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == url2); @@ -1247,7 +1249,7 @@ TEST_F(TabContentsTest, ShowInterstitialNoNewNavigationProceed) { EXPECT_TRUE(interstitial->is_showing()); EXPECT_TRUE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial); - content::NavigationEntry* entry = controller().GetActiveEntry(); + NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); // The URL specified to the interstitial should have been ignored. EXPECT_TRUE(entry->GetURL() == url1); @@ -1315,7 +1317,7 @@ TEST_F(TabContentsTest, ShowInterstitialThenGoBack) { // gone. EXPECT_TRUE(deleted); EXPECT_EQ(TestInterstitialPage::CANCELED, state); - content::NavigationEntry* entry = controller().GetActiveEntry(); + NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry); EXPECT_EQ(url1.spec(), entry->GetURL().spec()); } @@ -1353,7 +1355,7 @@ TEST_F(TabContentsTest, ShowInterstitialCrashRendererThenGoBack) { // gone. EXPECT_TRUE(deleted); EXPECT_EQ(TestInterstitialPage::CANCELED, state); - content::NavigationEntry* entry = controller().GetActiveEntry(); + NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry); EXPECT_EQ(url1.spec(), entry->GetURL().spec()); } @@ -1482,7 +1484,7 @@ TEST_F(TabContentsTest, ShowInterstitialOnInterstitial) { EXPECT_TRUE(deleted2); EXPECT_FALSE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == NULL); - content::NavigationEntry* entry = controller().GetActiveEntry(); + NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == landing_url); EXPECT_EQ(2, controller().entry_count()); @@ -1537,7 +1539,7 @@ TEST_F(TabContentsTest, ShowInterstitialProceedShowInterstitial) { EXPECT_TRUE(deleted2); EXPECT_FALSE(contents()->ShowingInterstitialPage()); EXPECT_TRUE(contents()->GetInterstitialPage() == NULL); - content::NavigationEntry* entry = controller().GetActiveEntry(); + NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == landing_url); EXPECT_EQ(2, controller().entry_count()); @@ -1680,8 +1682,7 @@ TEST_F(TabContentsTest, NewInterstitialDoesNotCancelPendingEntry) { interstitial2->TestDidNavigate(1, kGURL); // Make sure we still have an entry. - content::NavigationEntry* entry = - contents()->GetController().GetPendingEntry(); + NavigationEntry* entry = contents()->GetController().GetPendingEntry(); ASSERT_TRUE(entry); EXPECT_EQ(kUrl, entry->GetURL().spec()); @@ -1757,7 +1758,7 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) { NavigationController& other_controller = other_contents->GetController(); other_contents->NavigateAndCommit(url3); other_contents->ExpectSetHistoryLengthAndPrune( - NavigationEntry::FromNavigationEntry( + NavigationEntryImpl::FromNavigationEntry( other_controller.GetEntryAtIndex(0))->site_instance(), 1, other_controller.GetEntryAtIndex(0)->GetPageID()); other_controller.CopyStateFromAndPrune(&controller()); @@ -1801,7 +1802,7 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneTargetInterstitial) { EXPECT_TRUE(interstitial->is_showing()); EXPECT_EQ(2, other_controller.entry_count()); other_contents->ExpectSetHistoryLengthAndPrune( - NavigationEntry::FromNavigationEntry( + NavigationEntryImpl::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 f989f5d..8b664f9 100644 --- a/content/browser/tab_contents/test_tab_contents.cc +++ b/content/browser/tab_contents/test_tab_contents.cc @@ -11,12 +11,14 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/site_instance.h" -#include "content/browser/tab_contents/navigation_entry.h" +#include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/common/view_messages.h" #include "content/public/common/page_transition_types.h" #include "webkit/glue/webkit_glue.h" #include "webkit/forms/password_form.h" +using content::NavigationEntry; + TestTabContents::TestTabContents(content::BrowserContext* browser_context, SiteInstance* instance) : TabContents(browser_context, instance, MSG_ROUTING_NONE, NULL, NULL), @@ -111,7 +113,7 @@ void TestTabContents::CommitPendingNavigation() { if (!rvh) rvh = static_cast<TestRenderViewHost*>(old_rvh); - const content::NavigationEntry* entry = GetController().GetPendingEntry(); + const NavigationEntry* entry = GetController().GetPendingEntry(); DCHECK(entry); int page_id = entry->GetPageID(); if (page_id == -1) { diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 89c7193..0d13edc 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -592,8 +592,8 @@ 'browser/tab_contents/interstitial_page.h', 'browser/tab_contents/navigation_controller.cc', 'browser/tab_contents/navigation_controller.h', - 'browser/tab_contents/navigation_entry.cc', - 'browser/tab_contents/navigation_entry.h', + 'browser/tab_contents/navigation_entry_impl.cc', + 'browser/tab_contents/navigation_entry_impl.h', 'browser/tab_contents/popup_menu_helper_mac.h', 'browser/tab_contents/popup_menu_helper_mac.mm', 'browser/tab_contents/provisional_load_details.cc', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index e636229..f4d321b 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -234,7 +234,7 @@ 'browser/speech/speech_recognizer_unittest.cc', 'browser/ssl/ssl_host_state_unittest.cc', 'browser/tab_contents/navigation_controller_unittest.cc', - 'browser/tab_contents/navigation_entry_unittest.cc', + 'browser/tab_contents/navigation_entry_impl_unittest.cc', 'browser/tab_contents/render_view_host_manager_unittest.cc', 'browser/tab_contents/tab_contents_delegate_unittest.cc', 'browser/tab_contents/tab_contents_unittest.cc', |