diff options
Diffstat (limited to 'content')
10 files changed, 27 insertions, 67 deletions
diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc index 1ee7492..85780cd 100644 --- a/content/browser/tab_contents/navigation_controller.cc +++ b/content/browser/tab_contents/navigation_controller.cc @@ -221,7 +221,6 @@ bool NavigationController::IsInitialNavigation() { // static NavigationEntry* NavigationController::CreateNavigationEntry( const GURL& url, const GURL& referrer, PageTransition::Type transition, - const std::string& extra_headers, content::BrowserContext* browser_context) { // Allow the browser URL handler to rewrite the URL. This will, for example, // remove "view-source:" from the beginning of the URL to get the URL that @@ -243,7 +242,6 @@ NavigationEntry* NavigationController::CreateNavigationEntry( entry->set_virtual_url(url); entry->set_user_typed_url(url); entry->set_update_virtual_url_with_url(reverse_on_redirect); - entry->set_extra_headers(extra_headers); return entry; } @@ -275,7 +273,7 @@ void NavigationController::LoadEntry(NavigationEntry* entry) { NotificationService::current()->Notify( content::NOTIFICATION_NAV_ENTRY_PENDING, Source<NavigationController>(this), - Details<NavigationEntry>(entry)); + NotificationService::NoDetails()); NavigateToPendingEntry(NO_RELOAD); } @@ -485,21 +483,10 @@ void NavigationController::AddTransientEntry(NavigationEntry* entry) { void NavigationController::LoadURL(const GURL& url, const GURL& referrer, PageTransition::Type transition) { - LoadURLWithHeaders(url, referrer, transition, std::string()); -} - -// TODO(rogerta): Remove this call and put the extra_headers argument directly -// in LoadURL(). -void NavigationController::LoadURLWithHeaders( - const GURL& url, - const GURL& referrer, - PageTransition::Type transition, - const std::string& extra_headers) { // The user initiated a load, we don't need to reload anymore. needs_reload_ = false; NavigationEntry* entry = CreateNavigationEntry(url, referrer, transition, - extra_headers, browser_context_); LoadEntry(entry); diff --git a/content/browser/tab_contents/navigation_controller.h b/content/browser/tab_contents/navigation_controller.h index a410c4d..c7d9d03 100644 --- a/content/browser/tab_contents/navigation_controller.h +++ b/content/browser/tab_contents/navigation_controller.h @@ -176,13 +176,6 @@ class NavigationController { void LoadURL(const GURL& url, const GURL& referrer, PageTransition::Type type); - // Loads the specified URL, specifying extra http headers to add to the - // request. Extra headers are separated by \n. - void LoadURLWithHeaders(const GURL& url, - const GURL& referrer, - PageTransition::Type type, - const std::string& extra_headers); - // Loads the current page if this NavigationController was restored from // history and the current page has not loaded yet. void LoadIfNecessary(); @@ -334,13 +327,11 @@ class NavigationController { bool IsInitialNavigation(); // Creates navigation entry and translates the virtual url to a real one. - // Used when navigating to a new URL using LoadURL. Extra headers are - // separated by \n. + // Used when navigating to a new URL using LoadURL. static NavigationEntry* CreateNavigationEntry( const GURL& url, const GURL& referrer, PageTransition::Type transition, - const std::string& extra_headers, content::BrowserContext* browser_context); private: diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc index fbb9b01..0830650 100644 --- a/content/browser/tab_contents/navigation_controller_unittest.cc +++ b/content/browser/tab_contents/navigation_controller_unittest.cc @@ -1438,7 +1438,7 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { GURL url("http://foo"); std::vector<NavigationEntry*> entries; NavigationEntry* entry = NavigationController::CreateNavigationEntry( - url, GURL(), PageTransition::RELOAD, std::string(), profile()); + url, GURL(), PageTransition::RELOAD, profile()); entry->set_page_id(0); entry->set_title(ASCIIToUTF16("Title")); entry->set_content_state("state"); @@ -1496,7 +1496,7 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { GURL url("http://foo"); std::vector<NavigationEntry*> entries; NavigationEntry* entry = NavigationController::CreateNavigationEntry( - url, GURL(), PageTransition::RELOAD, std::string(), profile()); + url, GURL(), PageTransition::RELOAD, profile()); entry->set_page_id(0); entry->set_title(ASCIIToUTF16("Title")); entry->set_content_state("state"); diff --git a/content/browser/tab_contents/navigation_entry.h b/content/browser/tab_contents/navigation_entry.h index c86e75d..a43eba9 100644 --- a/content/browser/tab_contents/navigation_entry.h +++ b/content/browser/tab_contents/navigation_entry.h @@ -318,14 +318,6 @@ class NavigationEntry { return ssl_; } - // Extra headers (separated by \n) to send during the request. - void set_extra_headers(const std::string& extra_headers) { - extra_headers_ = extra_headers; - } - const std::string& extra_headers() const { - return extra_headers_; - } - // Page-related helpers ------------------------------------------------------ // Returns the title to be displayed on the tab. This could be the title of @@ -425,11 +417,8 @@ class NavigationEntry { bool has_post_data_; RestoreType restore_type_; - // This member is not persisted with sesssion restore. - std::string extra_headers_; - // This is a cached version of the result of GetTitleForDisplay. It prevents - // us from having to do URL formatting on the URL every time the title is + // us from having to do URL formatting on the URL evey time the title is // displayed. When the URL, virtual URL, or title is set, this should be // cleared to force a refresh. mutable string16 cached_display_title_; diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index f87c69e..9271d1b 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -140,7 +140,6 @@ ViewMsg_Navigate_Type::Value GetNavigationType( void MakeNavigateParams(const NavigationEntry& entry, const NavigationController& controller, - TabContentsDelegate* delegate, NavigationController::ReloadType reload_type, ViewMsg_Navigate_Params* params) { params->page_id = entry.page_id(); @@ -154,10 +153,6 @@ void MakeNavigateParams(const NavigationEntry& entry, params->navigation_type = GetNavigationType(controller.browser_context(), entry, reload_type); params->request_time = base::Time::Now(); - params->extra_headers = entry.extra_headers(); - - if (delegate) - delegate->AddNavigationHeaders(params->url, ¶ms->extra_headers); } } // namespace @@ -592,8 +587,11 @@ bool TabContents::NavigateToEntry( // Navigate in the desired RenderViewHost. ViewMsg_Navigate_Params navigate_params; - MakeNavigateParams(entry, controller_, delegate_, reload_type, - &navigate_params); + MakeNavigateParams(entry, controller_, reload_type, &navigate_params); + if (delegate_) { + navigate_params.extra_headers = + delegate_->GetNavigationHeaders(navigate_params.url); + } dest_render_view_host->Navigate(navigate_params); if (entry.page_id() == -1) { diff --git a/content/browser/tab_contents/tab_contents_delegate.cc b/content/browser/tab_contents/tab_contents_delegate.cc index 7247a7a..a6bdb98 100644 --- a/content/browser/tab_contents/tab_contents_delegate.cc +++ b/content/browser/tab_contents/tab_contents_delegate.cc @@ -34,8 +34,8 @@ void TabContentsDelegate::NavigationStateChanged(const TabContents* source, unsigned changed_flags) { } -void TabContentsDelegate::AddNavigationHeaders(const GURL& url, - std::string* headers) { +std::string TabContentsDelegate::GetNavigationHeaders(const GURL& url) { + return std::string(); } void TabContentsDelegate::AddNewContents(TabContents* source, diff --git a/content/browser/tab_contents/tab_contents_delegate.h b/content/browser/tab_contents/tab_contents_delegate.h index b1f0d52..9638775 100644 --- a/content/browser/tab_contents/tab_contents_delegate.h +++ b/content/browser/tab_contents/tab_contents_delegate.h @@ -75,9 +75,9 @@ class TabContentsDelegate { virtual void NavigationStateChanged(const TabContents* source, unsigned changed_flags); - // Adds the navigation request headers to |headers|. Use + // Returns the set of headers to add to the navigation request. Use // net::HttpUtil::AppendHeaderIfMissing to build the set of headers. - virtual void AddNavigationHeaders(const GURL& url, std::string* headers); + virtual std::string GetNavigationHeaders(const GURL& url); // Creates a new tab with the already-created TabContents 'new_contents'. // The window for the added contents should be reparented correctly when this diff --git a/content/browser/tab_contents/tab_contents_delegate_unittest.cc b/content/browser/tab_contents/tab_contents_delegate_unittest.cc index fab9edb..55a25b8 100644 --- a/content/browser/tab_contents/tab_contents_delegate_unittest.cc +++ b/content/browser/tab_contents/tab_contents_delegate_unittest.cc @@ -33,33 +33,31 @@ class MockTabContentsDelegate : public TabContentsDelegate { } virtual void NavigationStateChanged(const TabContents* source, - unsigned changed_flags) OVERRIDE {} + unsigned changed_flags) {} - virtual void AddNavigationHeaders( - const GURL& url, std::string* headers) OVERRIDE { + virtual std::string GetNavigationHeaders(const GURL& url) { + return ""; } virtual void AddNewContents(TabContents* source, TabContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, - bool user_gesture) OVERRIDE {} + bool user_gesture) {} - virtual void ActivateContents(TabContents* contents) OVERRIDE {} + virtual void ActivateContents(TabContents* contents) {} - virtual void DeactivateContents(TabContents* contents) OVERRIDE {} + virtual void DeactivateContents(TabContents* contents) {} - virtual void LoadingStateChanged(TabContents* source) OVERRIDE {} + virtual void LoadingStateChanged(TabContents* source) {} - virtual void LoadProgressChanged(double progress) OVERRIDE {} + virtual void LoadProgressChanged(double progress) {} - virtual void CloseContents(TabContents* source) OVERRIDE {} + virtual void CloseContents(TabContents* source) {} - virtual void MoveContents(TabContents* source, - const gfx::Rect& pos) OVERRIDE { - } + virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {} - virtual void UpdateTargetURL(TabContents* source, const GURL& url) OVERRIDE {} + virtual void UpdateTargetURL(TabContents* source, const GURL& url) {} }; TEST(TabContentsDelegateTest, UnregisterInDestructor) { diff --git a/content/common/content_notification_types.h b/content/common/content_notification_types.h index 144ebb7..14e72f7 100644 --- a/content/common/content_notification_types.h +++ b/content/common/content_notification_types.h @@ -43,8 +43,8 @@ enum NotificationType { // // This notification is called after the pending entry is created, but // before we actually try to navigate. The source will be the - // NavigationController that owns the pending entry, and the details - // will be a NavigationEntry. + // NavigationController that owns the pending entry, and there are no + // details. NOTIFICATION_NAV_ENTRY_PENDING, // A new non-pending navigation entry has been created. This will diff --git a/content/common/page_transition_types.h b/content/common/page_transition_types.h index 1bd6ec9..357b433 100644 --- a/content/common/page_transition_types.h +++ b/content/common/page_transition_types.h @@ -108,9 +108,6 @@ class PageTransition { // User used the address bar to trigger this navigation. FROM_ADDRESS_BAR = 0x02000000, - // User is navigating to the home page. - HOME_PAGE = 0x04000000, - // The beginning of a navigation chain. CHAIN_START = 0x10000000, |