diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 16:35:08 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 16:35:08 +0000 |
commit | 610cbb8cd46f9fdfa36d8935d5048d92445ae102 (patch) | |
tree | e4073d1addceb33cac8ab8e0824fbde9279d3d7a | |
parent | d8865c2179a327f85e7be4e6d8925f559269043a (diff) | |
download | chromium_src-610cbb8cd46f9fdfa36d8935d5048d92445ae102.zip chromium_src-610cbb8cd46f9fdfa36d8935d5048d92445ae102.tar.gz chromium_src-610cbb8cd46f9fdfa36d8935d5048d92445ae102.tar.bz2 |
Move navigation_types.h from content/common to content/public/browser, and put it in the content namespace. There was no reason for it to be in common since it's only used by browser. I also updated the enum names to match the rest of the enums in the Content API.
BUG=98716
TBR=joi
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=106029
Review URL: http://codereview.chromium.org/8339006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106070 0039d316-1c4b-4281-b951-d872f2087c98
35 files changed, 124 insertions, 131 deletions
diff --git a/chrome/browser/chromeos/login/enrollment/enterprise_enrollment_view.cc b/chrome/browser/chromeos/login/enrollment/enterprise_enrollment_view.cc index 1d22f17..48d77fe 100644 --- a/chrome/browser/chromeos/login/enrollment/enterprise_enrollment_view.cc +++ b/chrome/browser/chromeos/login/enrollment/enterprise_enrollment_view.cc @@ -50,7 +50,7 @@ class EnrollmentDomView : public WebPageDomView, virtual bool IsPopup(TabContents* source) { return false; } virtual bool ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type) { + content::NavigationType navigation_type) { return false; } virtual bool HandleContextMenu(const ContextMenuParams& params) { diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc index add12169..b80512c 100644 --- a/chrome/browser/chromeos/login/eula_view.cc +++ b/chrome/browser/chromeos/login/eula_view.cc @@ -207,7 +207,7 @@ bool EULATabContentsDelegate::IsPopup(TabContents* source) { bool EULATabContentsDelegate::ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type) { + content::NavigationType navigation_type) { return false; } diff --git a/chrome/browser/chromeos/login/eula_view.h b/chrome/browser/chromeos/login/eula_view.h index 6d9d2c1..6339651 100644 --- a/chrome/browser/chromeos/login/eula_view.h +++ b/chrome/browser/chromeos/login/eula_view.h @@ -42,7 +42,7 @@ class EULATabContentsDelegate : public TabContentsDelegate { virtual bool IsPopup(TabContents* source); virtual bool ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type); + content::NavigationType navigation_type); virtual bool HandleContextMenu(const ContextMenuParams& params); private: diff --git a/chrome/browser/chromeos/login/web_page_screen.cc b/chrome/browser/chromeos/login/web_page_screen.cc index ae5d33f..fd35711 100644 --- a/chrome/browser/chromeos/login/web_page_screen.cc +++ b/chrome/browser/chromeos/login/web_page_screen.cc @@ -30,7 +30,7 @@ bool WebPageScreen::IsPopup(TabContents* source) { bool WebPageScreen::ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type) { + content::NavigationType navigation_type) { return false; } diff --git a/chrome/browser/chromeos/login/web_page_screen.h b/chrome/browser/chromeos/login/web_page_screen.h index e1c581e..e314dae 100644 --- a/chrome/browser/chromeos/login/web_page_screen.h +++ b/chrome/browser/chromeos/login/web_page_screen.h @@ -28,7 +28,7 @@ class WebPageScreen : public TabContentsDelegate { virtual bool IsPopup(TabContents* source); virtual bool ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type); + content::NavigationType navigation_type); virtual bool HandleContextMenu(const ContextMenuParams& params); // Called by |timeout_timer_|. Stops page fetching and closes screen. diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 2def7ea..3f58d2a 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -425,7 +425,7 @@ void ExternalTabContainer::NavigationStateChanged(const TabContents* source, unsigned changed_flags) { if (automation_) { NavigationInfo nav_info; - if (InitNavigationInfo(&nav_info, NavigationType::NAV_IGNORE, 0)) + if (InitNavigationInfo(&nav_info, content::NAVIGATION_TYPE_NAV_IGNORE, 0)) automation_->Send(new AutomationMsg_NavigationStateChanged( tab_handle_, changed_flags, nav_info)); } @@ -971,7 +971,7 @@ bool ExternalTabContainer::ProcessUnhandledKeyStroke(HWND window, } bool ExternalTabContainer::InitNavigationInfo(NavigationInfo* nav_info, - NavigationType::Type nav_type, + content::NavigationType nav_type, int relative_offset) { DCHECK(nav_info); NavigationEntry* entry = tab_contents_->controller().GetActiveEntry(); diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h index de478ea..275c4eb 100644 --- a/chrome/browser/external_tab_container_win.h +++ b/chrome/browser/external_tab_container_win.h @@ -21,7 +21,7 @@ #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" #include "content/browser/tab_contents/tab_contents_delegate.h" #include "content/browser/tab_contents/tab_contents_observer.h" -#include "content/common/navigation_types.h" +#include "content/public/browser/navigation_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "views/accelerator.h" @@ -243,7 +243,7 @@ class ExternalTabContainer : public TabContentsDelegate, virtual void OnFinalMessage(HWND window); bool InitNavigationInfo(NavigationInfo* nav_info, - NavigationType::Type nav_type, + content::NavigationType nav_type, int relative_offset); void Navigate(const GURL& url, const GURL& referrer); diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 3a00147..af74814 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -221,7 +221,7 @@ class InstantLoader::TabContentsDelegateImpl virtual bool OnGoToEntryOffset(int offset) OVERRIDE; virtual bool ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type) OVERRIDE; + content::NavigationType navigation_type) OVERRIDE; // TabContentsWrapperDelegate: virtual void SwapTabContents(TabContentsWrapper* old_tc, @@ -490,9 +490,11 @@ bool InstantLoader::TabContentsDelegateImpl::OnGoToEntryOffset(int offset) { bool InstantLoader::TabContentsDelegateImpl::ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type) { - if (waiting_for_new_page_ && navigation_type == NavigationType::NEW_PAGE) + content::NavigationType navigation_type) { + if (waiting_for_new_page_ && + navigation_type == content::NAVIGATION_TYPE_NEW_PAGE) { waiting_for_new_page_ = false; + } if (!waiting_for_new_page_) { add_page_vector_.push_back( diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index df56653..0ab7285 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -91,7 +91,7 @@ class PrerenderContents::TabContentsDelegateImpl // TabContentsDelegate implementation: virtual bool ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type) OVERRIDE { + content::NavigationType navigation_type) OVERRIDE { add_page_vector_.push_back( scoped_refptr<history::HistoryAddPageArgs>(add_page_args.Clone())); return false; diff --git a/chrome/browser/printing/print_preview_tab_controller.cc b/chrome/browser/printing/print_preview_tab_controller.cc index 42976f7..330eca5 100644 --- a/chrome/browser/printing/print_preview_tab_controller.cc +++ b/chrome/browser/printing/print_preview_tab_controller.cc @@ -197,11 +197,11 @@ void PrintPreviewTabController::OnNavEntryCommitted( bool source_tab_is_preview_tab = (tab == preview_tab); if (details) { content::PageTransition transition_type = details->entry->transition_type(); - NavigationType::Type nav_type = details->type; + content::NavigationType nav_type = details->type; // Don't update/erase the map entry if the page has not changed. if (transition_type == content::PAGE_TRANSITION_RELOAD || - nav_type == NavigationType::SAME_PAGE) { + nav_type == content::NAVIGATION_TYPE_SAME_PAGE) { if (source_tab_is_preview_tab) SetInitiatorTabURLAndTitle(preview_tab); return; @@ -210,7 +210,7 @@ void PrintPreviewTabController::OnNavEntryCommitted( // New |preview_tab| is created. Don't update/erase map entry. if (waiting_for_new_preview_page_ && transition_type == content::PAGE_TRANSITION_LINK && - nav_type == NavigationType::NEW_PAGE && + nav_type == content::NAVIGATION_TYPE_NEW_PAGE && source_tab_is_preview_tab) { waiting_for_new_preview_page_ = false; SetInitiatorTabURLAndTitle(preview_tab); @@ -220,7 +220,7 @@ void PrintPreviewTabController::OnNavEntryCommitted( // User navigated to a preview tab using forward/back button. if (source_tab_is_preview_tab && transition_type == content::PAGE_TRANSITION_FORWARD_BACK && - nav_type == NavigationType::EXISTING_PAGE) { + nav_type == content::NAVIGATION_TYPE_EXISTING_PAGE) { return; } } diff --git a/chrome/browser/printing/print_preview_tab_controller.h b/chrome/browser/printing/print_preview_tab_controller.h index b954bfe..afd8b93 100644 --- a/chrome/browser/printing/print_preview_tab_controller.h +++ b/chrome/browser/printing/print_preview_tab_controller.h @@ -111,7 +111,7 @@ class PrintPreviewTabController NotificationRegistrar registrar_; // True if the controller is waiting for a new preview tab via - // NavigationType::NEW_PAGE. + // content::NAVIGATION_TYPE_NEW_PAGE. bool waiting_for_new_preview_page_; DISALLOW_COPY_AND_ASSIGN(PrintPreviewTabController); diff --git a/chrome/browser/printing/print_preview_tab_controller_unittest.cc b/chrome/browser/printing/print_preview_tab_controller_unittest.cc index 2305a16..8b418d4 100644 --- a/chrome/browser/printing/print_preview_tab_controller_unittest.cc +++ b/chrome/browser/printing/print_preview_tab_controller_unittest.cc @@ -97,7 +97,7 @@ TEST_F(PrintPreviewTabControllerUnitTest, TitleAfterReload) { entry.reset(new NavigationEntry()); entry->set_transition_type(content::PAGE_TRANSITION_RELOAD); content::LoadCommittedDetails details; - details.type = NavigationType::SAME_PAGE; + details.type = content::NAVIGATION_TYPE_SAME_PAGE; details.entry = entry.get(); NotificationService::current()->Notify( content::NOTIFICATION_NAV_ENTRY_COMMITTED, diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index d5cbfe9..94b7050 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -621,8 +621,8 @@ void SessionService::Observe(int type, current_entry_index, *tab->controller().GetEntryAtIndex(current_entry_index)); Details<content::LoadCommittedDetails> changed(details); - if (changed->type == NavigationType::NEW_PAGE || - changed->type == NavigationType::EXISTING_PAGE) { + if (changed->type == content::NAVIGATION_TYPE_NEW_PAGE || + changed->type == content::NAVIGATION_TYPE_EXISTING_PAGE) { RecordSessionUpdateHistogramData( content::NOTIFICATION_NAV_ENTRY_COMMITTED, &last_updated_nav_entry_commit_time_); diff --git a/chrome/browser/tab_contents/language_state.cc b/chrome/browser/tab_contents/language_state.cc index 06ef773..dec04b7 100644 --- a/chrome/browser/tab_contents/language_state.cc +++ b/chrome/browser/tab_contents/language_state.cc @@ -26,7 +26,7 @@ void LanguageState::DidNavigate( bool reload = details.entry->transition_type() == content::PAGE_TRANSITION_RELOAD || - details.type == NavigationType::SAME_PAGE; + details.type == content::NAVIGATION_TYPE_SAME_PAGE; if (reload) { // We might not get a LanguageDetermined notifications on reloads. Make sure // to keep the original language and to set current_lang_ so diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index 0e76619c..6f5d663 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -281,7 +281,7 @@ void TranslateManager::Observe(int type, return; } if (entry->transition_type() != content::PAGE_TRANSITION_RELOAD && - load_details->type != NavigationType::SAME_PAGE) { + load_details->type != content::NAVIGATION_TYPE_SAME_PAGE) { return; } // When doing a page reload, we don't get a TAB_LANGUAGE_DETERMINED diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index c927578..c3acd10e 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc @@ -666,7 +666,7 @@ TEST_F(TranslateManagerTest, Reload) { const content::LoadCommittedDetails& nav_details = nav_observer.get_load_commited_details(); EXPECT_TRUE(nav_details.entry != NULL); // There was a navigation. - EXPECT_EQ(NavigationType::EXISTING_PAGE, nav_details.type); + EXPECT_EQ(content::NAVIGATION_TYPE_EXISTING_PAGE, nav_details.type); // The TranslateManager class processes the navigation entry committed // notification in a posted task; process that task. @@ -697,7 +697,7 @@ TEST_F(TranslateManagerTest, ReloadFromLocationBar) { const content::LoadCommittedDetails& nav_details = nav_observer.get_load_commited_details(); EXPECT_TRUE(nav_details.entry != NULL); // There was a navigation. - EXPECT_EQ(NavigationType::SAME_PAGE, nav_details.type); + EXPECT_EQ(content::NAVIGATION_TYPE_SAME_PAGE, nav_details.type); // The TranslateManager class processes the navigation entry committed // notification in a posted task; process that task. diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 78fd45d..3557df7 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -3776,7 +3776,7 @@ void Browser::ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) { bool Browser::ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type) { + content::NavigationType navigation_type) { // Don't update history if running as app. return !IsApplication(); } diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index cb5b348..a0fdacc 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -958,7 +958,7 @@ class Browser : public TabHandlerDelegate, virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) OVERRIDE; virtual bool ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type) OVERRIDE; + content::NavigationType navigation_type) OVERRIDE; virtual void ContentRestrictionsChanged(TabContents* source) OVERRIDE; virtual void RendererUnresponsive(TabContents* source) OVERRIDE; virtual void RendererResponsive(TabContents* source) OVERRIDE; diff --git a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc index 2f37f1a..c502015 100644 --- a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc +++ b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc @@ -91,6 +91,6 @@ bool HtmlDialogTabContentsDelegate::IsPopup(const TabContents* source) const { bool HtmlDialogTabContentsDelegate::ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type) { + content::NavigationType navigation_type) { return false; } diff --git a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h index 2ff03f0..8353bc6 100644 --- a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h +++ b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h @@ -53,7 +53,7 @@ class HtmlDialogTabContentsDelegate : public TabContentsDelegate { virtual bool IsPopup(const TabContents* source) const; virtual bool ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type); + content::NavigationType navigation_type); private: Profile* profile_; // Weak pointer. Always an original profile. diff --git a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate_unittest.cc b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate_unittest.cc index 6789add..93353a4 100644 --- a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate_unittest.cc +++ b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate_unittest.cc @@ -59,7 +59,7 @@ TEST_F(HtmlDialogTabContentsDelegateTest, DoNothingMethodsTest) { GURL(), base::Time::Now(), 0, 0, GURL(), history::RedirectList(), content::PAGE_TRANSITION_TYPED, history::SOURCE_SYNCED, false)); EXPECT_FALSE(test_tab_contents_delegate_->ShouldAddNavigationToHistory( - *should_add_args, NavigationType::NEW_PAGE)); + *should_add_args, content::NAVIGATION_TYPE_NEW_PAGE)); test_tab_contents_delegate_->NavigationStateChanged(NULL, 0); test_tab_contents_delegate_->ActivateContents(NULL); test_tab_contents_delegate_->LoadingStateChanged(NULL); diff --git a/chrome/common/automation_messages_internal.h b/chrome/common/automation_messages_internal.h index ac032dbb..1532006 100644 --- a/chrome/common/automation_messages_internal.h +++ b/chrome/common/automation_messages_internal.h @@ -9,7 +9,6 @@ #include "base/string16.h" #include "chrome/common/content_settings.h" -#include "content/common/navigation_types.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message_macros.h" #include "net/base/cert_status_flags.h" @@ -31,6 +30,7 @@ // __COUNTER__, in which case we can get rid of the __LINE__. + #define IPC_MESSAGE_START AutomationMsgStart // This message is fired when the AutomationProvider is up and running diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index 4f77f78..b1fdc25 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -35,7 +35,6 @@ #include "chrome_frame/crash_reporting/crash_metrics.h" #include "chrome_frame/utils.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/navigation_types.h" #include "content/common/page_zoom.h" #include "grit/generated_resources.h" diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc index f46b5d4..9c926a0 100644 --- a/content/browser/tab_contents/navigation_controller.cc +++ b/content/browser/tab_contents/navigation_controller.cc @@ -21,7 +21,6 @@ #include "content/browser/tab_contents/tab_contents_delegate.h" #include "content/browser/user_metrics.h" #include "content/common/content_constants.h" -#include "content/common/navigation_types.h" #include "content/common/notification_service.h" #include "content/common/view_messages.h" #include "content/public/browser/notification_types.h" @@ -557,26 +556,26 @@ bool NavigationController::RendererDidNavigate( details->type = ClassifyNavigation(params); switch (details->type) { - case NavigationType::NEW_PAGE: + case content::NAVIGATION_TYPE_NEW_PAGE: RendererDidNavigateToNewPage(params, &(details->did_replace_entry)); break; - case NavigationType::EXISTING_PAGE: + case content::NAVIGATION_TYPE_EXISTING_PAGE: RendererDidNavigateToExistingPage(params); break; - case NavigationType::SAME_PAGE: + case content::NAVIGATION_TYPE_SAME_PAGE: RendererDidNavigateToSamePage(params); break; - case NavigationType::IN_PAGE: + case content::NAVIGATION_TYPE_IN_PAGE: RendererDidNavigateInPage(params, &(details->did_replace_entry)); break; - case NavigationType::NEW_SUBFRAME: + case content::NAVIGATION_TYPE_NEW_SUBFRAME: RendererDidNavigateNewSubframe(params); break; - case NavigationType::AUTO_SUBFRAME: + case content::NAVIGATION_TYPE_AUTO_SUBFRAME: if (!RendererDidNavigateAutoSubframe(params)) return false; break; - case NavigationType::NAV_IGNORE: + case content::NAVIGATION_TYPE_NAV_IGNORE: // If a pending navigation was in progress, this canceled it. We should // discard it and make sure it is removed from the URL bar. After that, // there is nothing we can do with this navigation, so we just return to @@ -615,7 +614,7 @@ bool NavigationController::RendererDidNavigate( return true; } -NavigationType::Type NavigationController::ClassifyNavigation( +content::NavigationType NavigationController::ClassifyNavigation( const ViewHostMsg_FrameNavigate_Params& params) const { if (params.page_id == -1) { // The renderer generates the page IDs, and so if it gives us the invalid @@ -636,7 +635,7 @@ NavigationType::Type NavigationController::ClassifyNavigation( // list. // // In these cases, there's nothing we can do with them, so ignore. - return NavigationType::NAV_IGNORE; + return content::NAVIGATION_TYPE_NAV_IGNORE; } if (params.page_id > tab_contents_->GetMaxPageID()) { @@ -644,7 +643,7 @@ NavigationType::Type NavigationController::ClassifyNavigation( // not have a pending entry for the page, and this may or may not be the // main frame. if (content::PageTransitionIsMainFrame(params.transition)) - return NavigationType::NEW_PAGE; + return content::NAVIGATION_TYPE_NEW_PAGE; // When this is a new subframe navigation, we should have a committed page // for which it's a suframe in. This may not be the case when an iframe is @@ -652,10 +651,10 @@ NavigationType::Type NavigationController::ClassifyNavigation( // written into the popup by script on the main page). For these cases, // there isn't any navigation stuff we can do, so just ignore it. if (!GetLastCommittedEntry()) - return NavigationType::NAV_IGNORE; + return content::NAVIGATION_TYPE_NAV_IGNORE; // Valid subframe navigation. - return NavigationType::NEW_SUBFRAME; + return content::NAVIGATION_TYPE_NEW_SUBFRAME; } // Now we know that the notification is for an existing page. Find that entry. @@ -674,7 +673,7 @@ NavigationType::Type NavigationController::ClassifyNavigation( UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_NC")); if (tab_contents_->GetSiteInstance()->HasProcess()) tab_contents_->GetSiteInstance()->GetProcess()->ReceivedBadMessage(); - return NavigationType::NAV_IGNORE; + return content::NAVIGATION_TYPE_NAV_IGNORE; } NavigationEntry* existing_entry = entries_[existing_entry_index].get(); @@ -683,7 +682,7 @@ NavigationType::Type NavigationController::ClassifyNavigation( // know this is auto. Since the current page was found in the navigation // entry list, we're guaranteed to have a last committed entry. DCHECK(GetLastCommittedEntry()); - return NavigationType::AUTO_SUBFRAME; + return content::NAVIGATION_TYPE_AUTO_SUBFRAME; } // Anything below here we know is a main frame navigation. @@ -698,7 +697,7 @@ NavigationType::Type NavigationController::ClassifyNavigation( // (the user doesn't want to have a new back/forward entry when they do // this). If this matches the last committed entry, we want to just ignore // the pending entry and go back to where we were (the "existing entry"). - return NavigationType::SAME_PAGE; + return content::NAVIGATION_TYPE_SAME_PAGE; } // Any toplevel navigations with the same base (minus the reference fragment) @@ -707,11 +706,11 @@ NavigationType::Type NavigationController::ClassifyNavigation( // navigations that don't actually navigate, but it can happen when there is // an encoding override (it always sends a navigation request). if (AreURLsInPageNavigation(existing_entry->url(), params.url)) - return NavigationType::IN_PAGE; + return content::NAVIGATION_TYPE_IN_PAGE; // Since we weeded out "new" navigations above, we know this is an existing // (back/forward) navigation. - return NavigationType::EXISTING_PAGE; + return content::NAVIGATION_TYPE_EXISTING_PAGE; } bool NavigationController::IsRedirect( diff --git a/content/browser/tab_contents/navigation_controller.h b/content/browser/tab_contents/navigation_controller.h index 7127057..e9bc0d3 100644 --- a/content/browser/tab_contents/navigation_controller.h +++ b/content/browser/tab_contents/navigation_controller.h @@ -16,7 +16,7 @@ #include "googleurl/src/gurl.h" #include "content/browser/ssl/ssl_manager.h" #include "content/common/content_export.h" -#include "content/common/navigation_types.h" +#include "content/public/browser/navigation_types.h" #include "content/public/common/page_transition_types.h" class NavigationEntry; @@ -348,7 +348,7 @@ class CONTENT_EXPORT NavigationController { friend class TabContents; // For invoking OnReservedPageIDRange. // Classifies the given renderer navigation (see the NavigationType enum). - NavigationType::Type ClassifyNavigation( + content::NavigationType ClassifyNavigation( const ViewHostMsg_FrameNavigate_Params& params) const; // Causes the controller to load the specified entry. The function assumes diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc index d897748..3ef5f39 100644 --- a/content/browser/tab_contents/navigation_controller_unittest.cc +++ b/content/browser/tab_contents/navigation_controller_unittest.cc @@ -889,7 +889,7 @@ TEST_F(NavigationControllerTest, Redirect) { EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_TRUE(details.type == NavigationType::SAME_PAGE); + EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_SAME_PAGE); EXPECT_EQ(controller().entry_count(), 1); EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); @@ -947,7 +947,7 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_TRUE(details.type == NavigationType::SAME_PAGE); + EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_SAME_PAGE); EXPECT_EQ(controller().entry_count(), 1); EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); @@ -994,7 +994,7 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) { EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_TRUE(details.type == NavigationType::NEW_PAGE); + EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_NEW_PAGE); EXPECT_EQ(controller().entry_count(), 1); EXPECT_EQ(controller().last_committed_entry_index(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); diff --git a/content/browser/tab_contents/navigation_details.cc b/content/browser/tab_contents/navigation_details.cc index ad44208..1709f31 100644 --- a/content/browser/tab_contents/navigation_details.cc +++ b/content/browser/tab_contents/navigation_details.cc @@ -8,7 +8,7 @@ namespace content { LoadCommittedDetails::LoadCommittedDetails() : entry(NULL), - type(NavigationType::UNKNOWN), + type(content::NAVIGATION_TYPE_UNKNOWN), previous_entry_index(-1), did_replace_entry(false), is_in_page(false), diff --git a/content/browser/tab_contents/navigation_details.h b/content/browser/tab_contents/navigation_details.h index 7ed97ae..b43e72d 100644 --- a/content/browser/tab_contents/navigation_details.h +++ b/content/browser/tab_contents/navigation_details.h @@ -7,8 +7,8 @@ #pragma once #include <string> -#include "content/common/navigation_types.h" #include "content/common/content_export.h" +#include "content/public/browser/navigation_types.h" #include "googleurl/src/gurl.h" class NavigationEntry; @@ -30,7 +30,7 @@ struct CONTENT_EXPORT LoadCommittedDetails { // The type of navigation that just occurred. Note that not all types of // navigations in the enum are valid here, since some of them don't actually // cause a "commit" and won't generate this notification. - NavigationType::Type type; + content::NavigationType type; // The index of the previously committed navigation entry. This will be -1 // if there are no previous entries. diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 35951e4..6e70c65 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -43,9 +43,9 @@ #include "content/common/content_constants.h" #include "content/common/content_restriction.h" #include "content/common/intents_messages.h" -#include "content/common/navigation_types.h" #include "content/common/notification_service.h" #include "content/common/view_messages.h" +#include "content/public/browser/navigation_types.h" #include "content/public/common/bindings_policy.h" #include "content/public/common/url_constants.h" #include "content/public/common/view_types.h" @@ -1500,7 +1500,7 @@ void TabContents::DidNavigate(RenderViewHost* rvh, // Send notification about committed provisional loads. This notification is // different from the NAV_ENTRY_COMMITTED notification which doesn't include // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. - if (details.type != NavigationType::NAV_IGNORE) { + if (details.type != content::NAVIGATION_TYPE_NAV_IGNORE) { // For AUTO_SUBFRAME navigations, an event for the main frame is generated // that is not recorded in the navigation history. For the purpose of // tracking navigation events, we treat this event as a sub frame navigation diff --git a/content/browser/tab_contents/tab_contents_delegate.cc b/content/browser/tab_contents/tab_contents_delegate.cc index 723775d..e25f8b6 100644 --- a/content/browser/tab_contents/tab_contents_delegate.cc +++ b/content/browser/tab_contents/tab_contents_delegate.cc @@ -205,7 +205,7 @@ bool TabContentsDelegate::OnGoToEntryOffset(int offset) { bool TabContentsDelegate::ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type) { + content::NavigationType navigation_type) { return true; } diff --git a/content/browser/tab_contents/tab_contents_delegate.h b/content/browser/tab_contents/tab_contents_delegate.h index 43ddf6a..f64dfff 100644 --- a/content/browser/tab_contents/tab_contents_delegate.h +++ b/content/browser/tab_contents/tab_contents_delegate.h @@ -12,7 +12,7 @@ #include "base/basictypes.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/common/content_export.h" -#include "content/common/navigation_types.h" +#include "content/public/browser/navigation_types.h" #include "content/public/common/page_transition_types.h" #include "ui/gfx/native_widget_types.h" #include "webkit/glue/window_open_disposition.h" @@ -259,7 +259,7 @@ class CONTENT_EXPORT TabContentsDelegate { // history. virtual bool ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, - NavigationType::Type navigation_type); + content::NavigationType navigation_type); // Returns the native window framing the view containing the tab contents. virtual gfx::NativeWindow GetFrameNativeWindow(); diff --git a/content/common/navigation_types.h b/content/common/navigation_types.h deleted file mode 100644 index bff569d..0000000 --- a/content/common/navigation_types.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_NAVIGATION_TYPES_H_ -#define CONTENT_COMMON_NAVIGATION_TYPES_H_ -#pragma once - -#include "base/basictypes.h" - -// Indicates different types of navigations that can occur that we will handle -// separately. -class NavigationType { - public: - enum Type { - // Unknown type. - UNKNOWN, - - // A new page was navigated in the main frame. - NEW_PAGE, - - // Renavigating to an existing navigation entry. The entry is guaranteed to - // exist in the list, or else it would be a new page or IGNORE navigation. - EXISTING_PAGE, - - // The same page has been reloaded as a result of the user requesting - // navigation to that same page (like pressing Enter in the URL bar). This - // is not the same as an in-page navigation because we'll actually have a - // pending entry for the load, which is then meaningless. - SAME_PAGE, - - // In page navigations are when the reference fragment changes. This will - // be in the main frame only (we won't even get notified of in-page - // subframe navigations). It may be for any page, not necessarily the last - // committed one (for example, whey going back to a page with a ref). - IN_PAGE, - - // A new subframe was manually navigated by the user. We will create a new - // NavigationEntry so they can go back to the previous subframe content - // using the back button. - NEW_SUBFRAME, - - // A subframe in the page was automatically loaded or navigated to such that - // a new navigation entry should not be created. There are two cases: - // 1. Stuff like iframes containing ads that the page loads automatically. - // The user doesn't want to see these, so we just update the existing - // navigation entry. - // 2. Going back/forward to previous subframe navigations. We don't create - // a new entry here either, just update the last committed entry. - // These two cases are actually pretty different, they just happen to - // require almost the same code to handle. - AUTO_SUBFRAME, - - // Nothing happened. This happens when we get information about a page we - // don't know anything about. It can also happen when an iframe in a popup - // navigated to about:blank is navigated. Nothing needs to be done. - NAV_IGNORE, - }; - - private: - // This class is for scoping only, so you shouldn't create an instance of it. - NavigationType() {} - - DISALLOW_COPY_AND_ASSIGN(NavigationType); -}; - -#endif // CONTENT_COMMON_NAVIGATION_TYPES_H_ diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 973cbc6..5977a39 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -559,6 +559,7 @@ 'browser/zygote_host_linux.h', 'browser/zygote_main_linux.cc', 'public/browser/native_web_keyboard_event.h', + 'public/browser/navigation_types.h', 'public/browser/notification_types.h', ], 'conditions': [ diff --git a/content/content_common.gypi b/content/content_common.gypi index 0b22e3d..36de997 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -159,7 +159,6 @@ 'common/message_router.h', 'common/mime_registry_messages.h', 'common/navigation_gesture.h', - 'common/navigation_types.h', 'common/net/url_fetcher.cc', 'common/net/url_fetcher.h', 'common/notification_details.cc', diff --git a/content/public/browser/navigation_types.h b/content/public/browser/navigation_types.h new file mode 100644 index 0000000..4ce04b8 --- /dev/null +++ b/content/public/browser/navigation_types.h @@ -0,0 +1,60 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_TYPES_H_ +#define CONTENT_PUBLIC_BROWSER_NAVIGATION_TYPES_H_ +#pragma once + +namespace content { + +// Indicates different types of navigations that can occur that we will handle +// separately. +enum NavigationType { + // Unknown type. + NAVIGATION_TYPE_UNKNOWN, + + // A new page was navigated in the main frame. + NAVIGATION_TYPE_NEW_PAGE, + + // Renavigating to an existing navigation entry. The entry is guaranteed to + // exist in the list, or else it would be a new page or IGNORE navigation. + NAVIGATION_TYPE_EXISTING_PAGE, + + // The same page has been reloaded as a result of the user requesting + // navigation to that same page (like pressing Enter in the URL bar). This + // is not the same as an in-page navigation because we'll actually have a + // pending entry for the load, which is then meaningless. + NAVIGATION_TYPE_SAME_PAGE, + + // In page navigations are when the reference fragment changes. This will + // be in the main frame only (we won't even get notified of in-page + // subframe navigations). It may be for any page, not necessarily the last + // committed one (for example, whey going back to a page with a ref). + NAVIGATION_TYPE_IN_PAGE, + + // A new subframe was manually navigated by the user. We will create a new + // NavigationEntry so they can go back to the previous subframe content + // using the back button. + NAVIGATION_TYPE_NEW_SUBFRAME, + + // A subframe in the page was automatically loaded or navigated to such that + // a new navigation entry should not be created. There are two cases: + // 1. Stuff like iframes containing ads that the page loads automatically. + // The user doesn't want to see these, so we just update the existing + // navigation entry. + // 2. Going back/forward to previous subframe navigations. We don't create + // a new entry here either, just update the last committed entry. + // These two cases are actually pretty different, they just happen to + // require almost the same code to handle. + NAVIGATION_TYPE_AUTO_SUBFRAME, + + // Nothing happened. This happens when we get information about a page we + // don't know anything about. It can also happen when an iframe in a popup + // navigated to about:blank is navigated. Nothing needs to be done. + NAVIGATION_TYPE_NAV_IGNORE, +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_TYPES_H_ |