summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/content_settings/tab_specific_content_settings.cc1
-rw-r--r--chrome/browser/extensions/extension_host.h1
-rw-r--r--chrome/browser/favicon/favicon_tab_helper.cc2
-rw-r--r--chrome/browser/favicon/favicon_tab_helper.h2
-rw-r--r--chrome/browser/history/history_tab_helper.h1
-rw-r--r--chrome/browser/infobars/infobar_delegate.cc1
-rw-r--r--chrome/browser/infobars/infobar_tab_helper.h1
-rw-r--r--chrome/browser/instant/instant_loader.cc2
-rw-r--r--chrome/browser/notifications/balloon_host.cc1
-rw-r--r--chrome/browser/password_manager_delegate_impl.cc2
-rw-r--r--chrome/browser/prerender/prerender_contents.cc2
-rw-r--r--chrome/browser/prerender/prerender_contents.h1
-rw-r--r--chrome/browser/prerender/prerender_manager.cc1
-rw-r--r--chrome/browser/prerender/prerender_tab_helper.h6
-rw-r--r--chrome/browser/printing/print_preview_message_handler.cc2
-rw-r--r--chrome/browser/printing/print_preview_message_handler.h2
-rw-r--r--chrome/browser/safe_browsing/browser_feature_extractor.cc1
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_host.cc1
-rw-r--r--chrome/browser/safe_browsing/malware_details.cc1
-rw-r--r--chrome/browser/safe_browsing/malware_details_cache.cc1
-rw-r--r--chrome/browser/tab_contents/background_contents.h1
-rw-r--r--chrome/browser/translate/options_menu_model.cc1
-rw-r--r--chrome/browser/ui/alternate_error_tab_observer.h1
-rw-r--r--chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc1
-rw-r--r--chrome/browser/ui/gtk/download/download_started_animation_gtk.cc1
-rw-r--r--chrome/browser/ui/prefs/prefs_tab_helper.h2
-rw-r--r--chrome/browser/ui/search_engines/search_engine_tab_helper.cc1
-rw-r--r--chrome/browser/ui/views/download/download_started_animation_views.cc1
-rw-r--r--chrome/browser/ui/views/sad_tab_view.cc1
-rw-r--r--chrome/test/automation/tab_proxy.h1
-rw-r--r--content/browser/intents/intent_injector.h1
-rw-r--r--content/browser/ssl/ssl_error_handler.cc2
-rw-r--r--content/browser/tab_contents/navigation_controller.cc115
-rw-r--r--content/browser/tab_contents/navigation_controller.h297
-rw-r--r--content/browser/tab_contents/navigation_controller_unittest.cc4
-rw-r--r--content/browser/tab_contents/tab_contents.cc12
-rw-r--r--content/browser/tab_contents/tab_contents.h4
-rw-r--r--content/content_browser.gypi1
-rw-r--r--content/public/browser/navigation_controller.h248
-rw-r--r--content/public/browser/web_contents.h4
-rw-r--r--content/public/browser/web_contents_observer.h3
41 files changed, 421 insertions, 313 deletions
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc
index a5e118c..6eedb5d 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings.cc
+++ b/chrome/browser/content_settings/tab_specific_content_settings.cc
@@ -25,6 +25,7 @@
#include "chrome/common/render_messages.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
+#include "content/browser/tab_contents/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h
index 6d4f8fa..2d8b7e3 100644
--- a/chrome/browser/extensions/extension_host.h
+++ b/chrome/browser/extensions/extension_host.h
@@ -31,6 +31,7 @@ class Browser;
class Extension;
class PrefsTabHelper;
class RenderWidgetHostView;
+class SiteInstance;
struct WebPreferences;
namespace content {
diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc
index bfd4a6d..4bbdb74 100644
--- a/chrome/browser/favicon/favicon_tab_helper.cc
+++ b/chrome/browser/favicon/favicon_tab_helper.cc
@@ -153,7 +153,7 @@ void FaviconTabHelper::NotifyFaviconUpdated() {
void FaviconTabHelper::NavigateToPendingEntry(
const GURL& url,
- NavigationController::ReloadType reload_type) {
+ content::NavigationController::ReloadType reload_type) {
if (reload_type != NavigationController::NO_RELOAD &&
!profile_->IsOffTheRecord()) {
FaviconService* favicon_service =
diff --git a/chrome/browser/favicon/favicon_tab_helper.h b/chrome/browser/favicon/favicon_tab_helper.h
index d62aaab..2d4417a 100644
--- a/chrome/browser/favicon/favicon_tab_helper.h
+++ b/chrome/browser/favicon/favicon_tab_helper.h
@@ -81,7 +81,7 @@ class FaviconTabHelper : public content::WebContentsObserver,
// content::WebContentsObserver overrides.
virtual void NavigateToPendingEntry(
const GURL& url,
- NavigationController::ReloadType reload_type) OVERRIDE;
+ content::NavigationController::ReloadType reload_type) OVERRIDE;
virtual void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) OVERRIDE;
diff --git a/chrome/browser/history/history_tab_helper.h b/chrome/browser/history/history_tab_helper.h
index 54eb7fd..80b34a2 100644
--- a/chrome/browser/history/history_tab_helper.h
+++ b/chrome/browser/history/history_tab_helper.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_HISTORY_HISTORY_TAB_HELPER_H_
#pragma once
+#include "base/memory/ref_counted.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
diff --git a/chrome/browser/infobars/infobar_delegate.cc b/chrome/browser/infobars/infobar_delegate.cc
index 4a0e35b..5c94b5c 100644
--- a/chrome/browser/infobars/infobar_delegate.cc
+++ b/chrome/browser/infobars/infobar_delegate.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "build/build_config.h"
#include "chrome/browser/infobars/infobar_tab_helper.h"
+#include "content/browser/tab_contents/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/infobars/infobar_tab_helper.h b/chrome/browser/infobars/infobar_tab_helper.h
index 877e6f8..52236d2 100644
--- a/chrome/browser/infobars/infobar_tab_helper.h
+++ b/chrome/browser/infobars/infobar_tab_helper.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/basictypes.h"
+#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index 942b3a2..b6013be 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -1029,7 +1029,7 @@ void InstantLoader::SetupPreviewContents(TabContentsWrapper* tab_contents) {
// will overlap.
int32 max_page_id = tab_contents->tab_contents()->GetMaxPageID();
if (max_page_id != -1) {
- preview_contents_->tab_contents()->GetController().set_max_restored_page_id(
+ preview_contents_->tab_contents()->GetController().SetMaxRestoredPageID(
max_page_id + 1);
}
diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc
index b60249c..3899600 100644
--- a/chrome/browser/notifications/balloon_host.cc
+++ b/chrome/browser/notifications/balloon_host.cc
@@ -16,6 +16,7 @@
#include "chrome/common/chrome_view_type.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/site_instance.h"
+#include "content/browser/tab_contents/navigation_controller.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_process_host.h"
diff --git a/chrome/browser/password_manager_delegate_impl.cc b/chrome/browser/password_manager_delegate_impl.cc
index d9a326e..76dfacb 100644
--- a/chrome/browser/password_manager_delegate_impl.cc
+++ b/chrome/browser/password_manager_delegate_impl.cc
@@ -129,6 +129,6 @@ Profile* PasswordManagerDelegateImpl::GetProfileForPasswordManager() {
}
bool PasswordManagerDelegateImpl::DidLastPageLoadEncounterSSLErrors() {
- return tab_contents_->tab_contents()->GetController().ssl_manager()->
+ return tab_contents_->tab_contents()->GetController().GetSSLManager()->
ProcessedSSLErrorFromRequest();
}
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index 6f3ef26..049b214 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -287,7 +287,7 @@ void PrerenderContents::StartPrerendering(
if (starting_page_id_ < 0)
starting_page_id_ = 0;
starting_page_id_ += kPrerenderPageIdOffset;
- prerender_contents_->tab_contents()->GetController().set_max_restored_page_id(
+ prerender_contents_->tab_contents()->GetController().SetMaxRestoredPageID(
starting_page_id_);
tab_contents_delegate_.reset(new TabContentsDelegateImpl(this));
diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h
index b6214ea..faa5ad7 100644
--- a/chrome/browser/prerender/prerender_contents.h
+++ b/chrome/browser/prerender/prerender_contents.h
@@ -14,6 +14,7 @@
#include "base/time.h"
#include "base/values.h"
#include "chrome/browser/prerender/prerender_final_status.h"
+#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/referrer.h"
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index 8ce70ed..613bfa3 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -39,6 +39,7 @@
#include "content/browser/in_process_webkit/session_storage_namespace.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
+#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/render_view_host_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/devtools_agent_host_registry.h"
diff --git a/chrome/browser/prerender/prerender_tab_helper.h b/chrome/browser/prerender/prerender_tab_helper.h
index 8f22d2a..b937506 100644
--- a/chrome/browser/prerender/prerender_tab_helper.h
+++ b/chrome/browser/prerender/prerender_tab_helper.h
@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_
#define CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_
-#include "content/public/browser/web_contents_observer.h"
-
#include "base/time.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "googleurl/src/gurl.h"
class TabContentsWrapper;
-class GURL;
namespace prerender {
diff --git a/chrome/browser/printing/print_preview_message_handler.cc b/chrome/browser/printing/print_preview_message_handler.cc
index 99fd50c..f0d1985 100644
--- a/chrome/browser/printing/print_preview_message_handler.cc
+++ b/chrome/browser/printing/print_preview_message_handler.cc
@@ -246,7 +246,7 @@ bool PrintPreviewMessageHandler::OnMessageReceived(
void PrintPreviewMessageHandler::NavigateToPendingEntry(
const GURL& url,
- NavigationController::ReloadType reload_type) {
+ content::NavigationController::ReloadType reload_type) {
TabContentsWrapper* tab = tab_contents_wrapper();
TabContentsWrapper* preview_tab = GetPrintPreviewTab();
if (tab == preview_tab) {
diff --git a/chrome/browser/printing/print_preview_message_handler.h b/chrome/browser/printing/print_preview_message_handler.h
index 8f6b649..9cd8a8d 100644
--- a/chrome/browser/printing/print_preview_message_handler.h
+++ b/chrome/browser/printing/print_preview_message_handler.h
@@ -30,7 +30,7 @@ class PrintPreviewMessageHandler : public content::WebContentsObserver {
// content::WebContentsObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void NavigateToPendingEntry(const GURL& url,
- NavigationController::ReloadType reload_type) OVERRIDE;
+ content::NavigationController::ReloadType reload_type) OVERRIDE;
private:
// Gets the print preview tab associated with the TabContents being observed.
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc
index 16cd5e2..7c6a0c0 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor.cc
+++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/safe_browsing/browser_features.h"
#include "chrome/browser/safe_browsing/client_side_detection_service.h"
#include "chrome/common/safe_browsing/csd.pb.h"
+#include "content/browser/tab_contents/navigation_controller.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc
index 86ee34a..0614cfc 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host.cc
@@ -25,6 +25,7 @@
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/browser/renderer_host/resource_request_details.h"
+#include "content/browser/tab_contents/navigation_controller.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
diff --git a/chrome/browser/safe_browsing/malware_details.cc b/chrome/browser/safe_browsing/malware_details.cc
index f15af44..5eada97 100644
--- a/chrome/browser/safe_browsing/malware_details.cc
+++ b/chrome/browser/safe_browsing/malware_details.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/common/safe_browsing/safebrowsing_messages.h"
#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/tab_contents/navigation_controller.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/safe_browsing/malware_details_cache.cc b/chrome/browser/safe_browsing/malware_details_cache.cc
index 13dadd7..25961ad 100644
--- a/chrome/browser/safe_browsing/malware_details_cache.cc
+++ b/chrome/browser/safe_browsing/malware_details_cache.cc
@@ -18,6 +18,7 @@
#include "content/public/common/url_fetcher.h"
#include "net/base/host_port_pair.h"
#include "net/base/load_flags.h"
+#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_status.h"
diff --git a/chrome/browser/tab_contents/background_contents.h b/chrome/browser/tab_contents/background_contents.h
index eb80f2f..5919fcb 100644
--- a/chrome/browser/tab_contents/background_contents.h
+++ b/chrome/browser/tab_contents/background_contents.h
@@ -16,6 +16,7 @@
#include "webkit/glue/window_open_disposition.h"
class Profile;
+class SiteInstance;
// This class consumes TabContents. It can host a renderer, but does not
// have any visible display.
diff --git a/chrome/browser/translate/options_menu_model.cc b/chrome/browser/translate/options_menu_model.cc
index 229195a..5248c49 100644
--- a/chrome/browser/translate/options_menu_model.cc
+++ b/chrome/browser/translate/options_menu_model.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/translate/translate_infobar_delegate.h"
+#include "content/browser/tab_contents/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/ui/alternate_error_tab_observer.h b/chrome/browser/ui/alternate_error_tab_observer.h
index ecce0e1..1fb1b6a 100644
--- a/chrome/browser/ui/alternate_error_tab_observer.h
+++ b/chrome/browser/ui/alternate_error_tab_observer.h
@@ -7,6 +7,7 @@
#pragma once
#include "chrome/browser/prefs/pref_change_registrar.h"
+#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
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 d6f66e9..4805e32 100644
--- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc
+++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/ui/blocked_content/blocked_content_container.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/tab_contents/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/ui/gtk/download/download_started_animation_gtk.cc b/chrome/browser/ui/gtk/download/download_started_animation_gtk.cc
index d362dfb..83f0346 100644
--- a/chrome/browser/ui/gtk/download/download_started_animation_gtk.cc
+++ b/chrome/browser/ui/gtk/download/download_started_animation_gtk.cc
@@ -9,6 +9,7 @@
#include <gtk/gtk.h>
#include "base/message_loop.h"
+#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.h b/chrome/browser/ui/prefs/prefs_tab_helper.h
index a06f12d..d970efb 100644
--- a/chrome/browser/ui/prefs/prefs_tab_helper.h
+++ b/chrome/browser/ui/prefs/prefs_tab_helper.h
@@ -6,7 +6,9 @@
#define CHROME_BROWSER_UI_PREFS_PREFS_TAB_HELPER_H_
#pragma once
+#include "base/memory/scoped_ptr.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
+#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
index fc598b3..a4dc987 100644
--- a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
+++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.h"
#include "chrome/common/render_messages.h"
+#include "content/browser/tab_contents/navigation_controller.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/ui/views/download/download_started_animation_views.cc b/chrome/browser/ui/views/download/download_started_animation_views.cc
index ec1a005..23a1efb 100644
--- a/chrome/browser/ui/views/download/download_started_animation_views.cc
+++ b/chrome/browser/ui/views/download/download_started_animation_views.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/download/download_started_animation.h"
#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc
index 7449f2d..47ab21d 100644
--- a/chrome/browser/ui/views/sad_tab_view.cc
+++ b/chrome/browser/ui/views/sad_tab_view.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/ui/webui/bug_report_ui.h"
#include "chrome/browser/userfeedback/proto/extension.pb.h"
#include "chrome/common/url_constants.h"
+#include "content/browser/tab_contents/navigation_controller.h"
#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index c38b57c3..d86f76d 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -25,6 +25,7 @@
#include "content/browser/download/save_package.h"
#include "content/public/common/page_type.h"
#include "content/public/common/security_style.h"
+#include "net/base/cert_status_flags.h"
#include "webkit/glue/window_open_disposition.h"
class BrowserProxy;
diff --git a/content/browser/intents/intent_injector.h b/content/browser/intents/intent_injector.h
index 07f829b..8fc5833 100644
--- a/content/browser/intents/intent_injector.h
+++ b/content/browser/intents/intent_injector.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/common/content_export.h"
diff --git a/content/browser/ssl/ssl_error_handler.cc b/content/browser/ssl/ssl_error_handler.cc
index a0b3e46..07c28d1 100644
--- a/content/browser/ssl/ssl_error_handler.cc
+++ b/content/browser/ssl/ssl_error_handler.cc
@@ -77,7 +77,7 @@ void SSLErrorHandler::Dispatch() {
}
// Hand ourselves off to the SSLManager.
- manager_ = tab_contents->GetController().ssl_manager();
+ manager_ = tab_contents->GetController().GetSSLManager();
OnDispatched();
}
diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc
index 8b4f48f4..280fe99 100644
--- a/content/browser/tab_contents/navigation_controller.cc
+++ b/content/browser/tab_contents/navigation_controller.cc
@@ -117,6 +117,39 @@ size_t NavigationController::max_entry_count_for_testing_ =
// static
bool NavigationController::check_for_repost_ = true;
+// static
+NavigationEntry* content::NavigationController::CreateNavigationEntry(
+ const GURL& url,
+ const content::Referrer& referrer,
+ content::PageTransition transition,
+ bool is_renderer_initiated,
+ const std::string& extra_headers,
+ content::BrowserContext* browser_context) {
+ // 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
+ // will actually be loaded. This real URL won't be shown to the user, just
+ // used internally.
+ GURL loaded_url(url);
+ bool reverse_on_redirect = false;
+ BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
+ &loaded_url, browser_context, &reverse_on_redirect);
+
+ NavigationEntryImpl* entry = new NavigationEntryImpl(
+ NULL, // The site instance for tabs is sent on navigation
+ // (TabContents::GetSiteInstance).
+ -1,
+ loaded_url,
+ referrer,
+ string16(),
+ transition,
+ is_renderer_initiated);
+ entry->SetVirtualURL(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;
+}
+
NavigationController::NavigationController(
TabContents* contents,
content::BrowserContext* browser_context,
@@ -235,50 +268,6 @@ bool NavigationController::IsInitialNavigation() {
return last_document_loaded_.is_null();
}
-// static
-NavigationEntry* NavigationController::CreateNavigationEntry(
- const GURL& url,
- const content::Referrer& referrer,
- content::PageTransition transition,
- bool is_renderer_initiated,
- const std::string& extra_headers,
- content::BrowserContext* browser_context) {
- return CreateNavigationEntryImpl(
- url, referrer, transition, is_renderer_initiated, extra_headers,
- browser_context);
-}
-
-// static
-NavigationEntryImpl* NavigationController::CreateNavigationEntryImpl(
- const GURL& url, const content::Referrer& referrer,
- content::PageTransition transition,
- bool is_renderer_initiated, 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
- // will actually be loaded. This real URL won't be shown to the user, just
- // used internally.
- GURL loaded_url(url);
- bool reverse_on_redirect = false;
- BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
- &loaded_url, browser_context, &reverse_on_redirect);
-
- NavigationEntryImpl* entry = new NavigationEntryImpl(
- NULL, // The site instance for tabs is sent on navigation
- // (TabContents::GetSiteInstance).
- -1,
- loaded_url,
- referrer,
- string16(),
- transition,
- is_renderer_initiated);
- entry->SetVirtualURL(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;
-}
-
NavigationEntryImpl* NavigationController::GetEntryWithPageID(
SiteInstance* instance, int32 page_id) const {
int index = GetEntryIndexWithPageID(instance, page_id);
@@ -510,9 +499,10 @@ void NavigationController::TransferURL(
// The user initiated a load, we don't need to reload anymore.
needs_reload_ = false;
- NavigationEntryImpl* entry = CreateNavigationEntryImpl(
- url, referrer, transition, is_renderer_initiated, extra_headers,
- browser_context_);
+ NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
+ CreateNavigationEntry(
+ url, referrer, transition, is_renderer_initiated, extra_headers,
+ browser_context_));
entry->set_transferred_global_request_id(transferred_global_request_id);
LoadEntry(entry);
@@ -526,8 +516,9 @@ void NavigationController::LoadURL(
// The user initiated a load, we don't need to reload anymore.
needs_reload_ = false;
- NavigationEntryImpl* entry = CreateNavigationEntryImpl(
- url, referrer, transition, false, extra_headers, browser_context_);
+ NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
+ CreateNavigationEntry(
+ url, referrer, transition, false, extra_headers, browser_context_));
LoadEntry(entry);
}
@@ -540,8 +531,9 @@ void NavigationController::LoadURLFromRenderer(
// The user initiated a load, we don't need to reload anymore.
needs_reload_ = false;
- NavigationEntryImpl* entry = CreateNavigationEntryImpl(
- url, referrer, transition, true, extra_headers, browser_context_);
+ NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
+ CreateNavigationEntry(
+ url, referrer, transition, true, extra_headers, browser_context_));
LoadEntry(entry);
}
@@ -975,7 +967,9 @@ void NavigationController::CopyStateFrom(const NavigationController& source) {
FinishRestore(source.last_committed_entry_index_, false);
}
-void NavigationController::CopyStateFromAndPrune(NavigationController* source) {
+void NavigationController::CopyStateFromAndPrune(
+ content::NavigationController* temp) {
+ NavigationController* source = static_cast<NavigationController*>(temp);
// 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.
@@ -1061,14 +1055,25 @@ void NavigationController::PruneAllButActive() {
}
}
-bool NavigationController::NeedsReload() const {
- return needs_reload_;
+SSLManager* NavigationController::GetSSLManager() {
+ return &ssl_manager_;
+}
+
+void NavigationController::SetMaxRestoredPageID(int32 max_id) {
+ max_restored_page_id_ = max_id;
+}
+
+int32 NavigationController::GetMaxRestoredPageID() const {
+ return max_restored_page_id_;
}
SessionStorageNamespace*
NavigationController::GetSessionStorageNamespace() const {
return session_storage_namespace_;
}
+bool NavigationController::NeedsReload() const {
+ return needs_reload_;
+}
void NavigationController::RemoveEntryAtIndexInternal(int index) {
DCHECK(index < GetEntryCount());
@@ -1267,7 +1272,7 @@ void NavigationController::FinishRestore(int selected_index,
DCHECK(selected_index >= 0 && selected_index < GetEntryCount());
ConfigureEntriesForRestore(&entries_, from_last_session);
- set_max_restored_page_id(static_cast<int32>(GetEntryCount()));
+ SetMaxRestoredPageID(static_cast<int32>(GetEntryCount()));
last_committed_entry_index_ = selected_index;
}
diff --git a/content/browser/tab_contents/navigation_controller.h b/content/browser/tab_contents/navigation_controller.h
index e581753..60be2d6 100644
--- a/content/browser/tab_contents/navigation_controller.h
+++ b/content/browser/tab_contents/navigation_controller.h
@@ -8,119 +8,92 @@
#include "build/build_config.h"
-#include <string>
-#include <vector>
-
#include "base/memory/linked_ptr.h"
#include "base/time.h"
-#include "googleurl/src/gurl.h"
#include "content/browser/ssl/ssl_manager.h"
-#include "content/common/content_export.h"
-#include "content/public/browser/global_request_id.h"
+#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_type.h"
-#include "content/public/common/page_transition_types.h"
-#include "content/public/common/referrer.h"
-class SessionStorageNamespace;
class SiteInstance;
-class TabContents;
struct ViewHostMsg_FrameNavigate_Params;
namespace content {
-class BrowserContext;
-class NavigationEntry;
class NavigationEntryImpl;
struct LoadCommittedDetails;
-struct Referrer;
}
-// A NavigationController maintains the back-forward list for a single tab and
-// manages all navigation within that list.
-//
-// The NavigationController also owns all TabContents for the tab. This is to
-// make sure that we have at most one TabContents instance per type.
-class CONTENT_EXPORT NavigationController {
+// TODO(jam): rename to NavigationControllerImpl once chrome only uses the i/f.
+class CONTENT_EXPORT NavigationController
+ : public content::NavigationController {
public:
-
- enum ReloadType {
- NO_RELOAD, // Normal load.
- RELOAD, // Normal (cache-validating) reload.
- RELOAD_IGNORING_CACHE // Reload bypassing the cache, aka shift-reload.
- };
-
- // ---------------------------------------------------------------------------
-
NavigationController(TabContents* tab_contents,
content::BrowserContext* browser_context,
SessionStorageNamespace* session_storage_namespace);
- ~NavigationController();
-
- // Returns the browser context for this controller. It can never be NULL.
- content::BrowserContext* GetBrowserContext() const;
+ virtual ~NavigationController();
+
+ // NavigationController implementation:
+ virtual content::BrowserContext* GetBrowserContext() const OVERRIDE;
+ virtual void Restore(
+ int selected_navigation,
+ bool from_last_session,
+ std::vector<content::NavigationEntry*>* entries) OVERRIDE;
+ virtual content::NavigationEntry* GetActiveEntry() const OVERRIDE;
+ virtual content::NavigationEntry* GetVisibleEntry() const OVERRIDE;
+ virtual int GetCurrentEntryIndex() const OVERRIDE;
+ virtual content::NavigationEntry* GetLastCommittedEntry() const OVERRIDE;
+ virtual int GetLastCommittedEntryIndex() const OVERRIDE;
+ virtual bool CanViewSource() const OVERRIDE;
+ virtual int GetEntryCount() const OVERRIDE;
+ virtual content::NavigationEntry* GetEntryAtIndex(int index) const OVERRIDE;
+ virtual content::NavigationEntry* GetEntryAtOffset(int offset) const OVERRIDE;
+ virtual void DiscardNonCommittedEntries() OVERRIDE;
+ virtual content::NavigationEntry* GetPendingEntry() const OVERRIDE;
+ virtual int GetPendingEntryIndex() const OVERRIDE;
+ virtual content::NavigationEntry* GetTransientEntry() const OVERRIDE;
+ virtual void LoadURL(const GURL& url,
+ const content::Referrer& referrer,
+ content::PageTransition type,
+ const std::string& extra_headers) OVERRIDE;
+ virtual void LoadURLFromRenderer(const GURL& url,
+ const content::Referrer& referrer,
+ content::PageTransition type,
+ const std::string& extra_headers) OVERRIDE;
+ virtual void TransferURL(
+ const GURL& url,
+ const content::Referrer& referrer,
+ content::PageTransition transition,
+ const std::string& extra_headers,
+ const content::GlobalRequestID& transferred_global_request_id,
+ bool is_renderer_initiated) OVERRIDE;
+ virtual void LoadIfNecessary() OVERRIDE;
+ virtual bool CanGoBack() const OVERRIDE;
+ virtual bool CanGoForward() const OVERRIDE;
+ virtual void GoBack() OVERRIDE;
+ virtual void GoForward() OVERRIDE;
+ virtual void GoToIndex(int index) OVERRIDE;
+ virtual void GoToOffset(int offset) OVERRIDE;
+ virtual void RemoveEntryAtIndex(int index) OVERRIDE;
+ virtual SSLManager* GetSSLManager() OVERRIDE;
+ virtual SessionStorageNamespace* GetSessionStorageNamespace() const OVERRIDE;
+ virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE;
+ virtual int32 GetMaxRestoredPageID() const OVERRIDE;
+ virtual bool NeedsReload() const OVERRIDE;
+ virtual void CancelPendingReload() OVERRIDE;
+ virtual void ContinuePendingReload() OVERRIDE;
+ virtual bool IsInitialNavigation() OVERRIDE;
+ virtual void Reload(bool check_for_repost) OVERRIDE;
+ virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE;
+ virtual void NotifyEntryChanged(const content::NavigationEntry* entry,
+ int index) OVERRIDE;
+ virtual void CopyStateFromAndPrune(
+ content::NavigationController* source) OVERRIDE;
+ virtual void PruneAllButActive() OVERRIDE;
// Sets the browser context for this controller.
void set_browser_context(content::BrowserContext* browser_context) {
browser_context_ = browser_context;
}
- // Initializes this NavigationController with the given saved navigations,
- // using selected_navigation as the currently loaded entry. Before this call
- // the controller should be unused (there should be no current entry). If
- // from_last_session is true, navigations are from the previous session,
- // otherwise they are from the current session (undo tab close). This takes
- // ownership of the NavigationEntrys in |entries| and clears it out.
- // This is used for session restore.
- void Restore(int selected_navigation,
- bool from_last_session,
- std::vector<content::NavigationEntry*>* entries);
-
- // Active entry --------------------------------------------------------------
-
- // Returns the active entry, which is the transient entry if any, the pending
- // entry if a navigation is in progress or the last committed entry otherwise.
- // NOTE: This can be NULL!!
- //
- // If you are trying to get the current state of the NavigationController,
- // this is the method you will typically want to call. If you want to display
- // the active entry to the user (e.g., in the location bar), use
- // GetVisibleEntry instead.
- content::NavigationEntry* GetActiveEntry() const;
-
- // Returns the same entry as GetActiveEntry, except that it ignores pending
- // history navigation entries. This should be used when displaying info to
- // the user, so that the location bar and other indicators do not update for
- // a back/forward navigation until the pending entry commits. This approach
- // guards against URL spoofs on slow history navigations.
- content::NavigationEntry* GetVisibleEntry() const;
-
- // Returns the index from which we would go back/forward or reload. This is
- // the last_committed_entry_index_ if pending_entry_index_ is -1. Otherwise,
- // it is the pending_entry_index_.
- int GetCurrentEntryIndex() const;
-
- // Returns the last committed entry, which may be null if there are no
- // committed entries.
- content::NavigationEntry* GetLastCommittedEntry() const;
-
- // Returns true if the source for the current entry can be viewed.
- bool CanViewSource() const;
-
- // Returns the index of the last committed entry.
- int GetLastCommittedEntryIndex() const;
-
- // Navigation list -----------------------------------------------------------
-
- // Returns the number of entries in the NavigationController, excluding
- // the pending entry if there is one, but including the transient entry if
- // any.
- int GetEntryCount() const;
-
- content::NavigationEntry* GetEntryAtIndex(int index) const;
-
- // Returns the entry at the specified offset from current. Returns NULL
- // if out of bounds.
- content::NavigationEntry* GetEntryAtOffset(int offset) const;
-
// Returns the index of the specified entry, or -1 if entry is not contained
// in this NavigationController.
int GetIndexOfEntry(const content::NavigationEntryImpl* entry) const;
@@ -135,19 +108,6 @@ class CONTENT_EXPORT NavigationController {
content::NavigationEntryImpl* GetEntryWithPageID(SiteInstance* instance,
int32 page_id) const;
- // Pending entry -------------------------------------------------------------
-
- // Discards the pending and transient entries if any.
- void DiscardNonCommittedEntries();
-
- // Returns the pending entry corresponding to the navigation that is
- // currently in progress, or null if there is none.
- content::NavigationEntry* GetPendingEntry() const;
-
- // Returns the index of the pending entry or -1 if the pending entry
- // corresponds to a new navigation (created via LoadURL).
- int GetPendingEntryIndex() const;
-
// Transient entry -----------------------------------------------------------
// Adds an entry that is returned by GetActiveEntry(). The entry is
@@ -159,73 +119,6 @@ class CONTENT_EXPORT NavigationController {
// Note that adding a transient entry does not change the active contents.
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.
- content::NavigationEntry* GetTransientEntry() const;
-
- // New navigations -----------------------------------------------------------
-
- // Loads the specified URL, specifying extra http headers to add to the
- // request. Extra headers are separated by \n.
- void LoadURL(const GURL& url,
- const content::Referrer& referrer,
- content::PageTransition type,
- const std::string& extra_headers);
-
- // Same as LoadURL, but for renderer-initiated navigations. This state is
- // important for tracking whether to display pending URLs.
- void LoadURLFromRenderer(const GURL& url,
- const content::Referrer& referrer,
- content::PageTransition type,
- const std::string& extra_headers);
-
- // Behaves like LoadURL() and LoadURLFromRenderer() but marks the new
- // navigation as being transferred from one RVH to another. In this case the
- // browser can recycle the old request once the new renderer wants to
- // navigate.
- // |transferred_global_request_id| identifies the request ID of the old
- // request.
- void TransferURL(
- const GURL& url,
- const content::Referrer& referrer,
- content::PageTransition transition,
- const std::string& extra_headers,
- const content::GlobalRequestID& transferred_global_request_id,
- bool is_renderer_initiated);
-
- // Loads the current page if this NavigationController was restored from
- // history and the current page has not loaded yet.
- void LoadIfNecessary();
-
- // Renavigation --------------------------------------------------------------
-
- // Navigation relative to the "current entry"
- bool CanGoBack() const;
- bool CanGoForward() const;
- void GoBack();
- void GoForward();
-
- // Navigates to the specified absolute index.
- void GoToIndex(int index);
-
- // Navigates to the specified offset from the "current entry". Does nothing if
- // the offset is out of bounds.
- void GoToOffset(int offset);
-
- // Reloads the current entry. If |check_for_repost| is true and the current
- // entry has POST data the user is prompted to see if they really want to
- // reload the page. In nearly all cases pass in true.
- void Reload(bool check_for_repost);
- // Like Reload(), but don't use caches (aka "shift-reload").
- void ReloadIgnoringCache(bool check_for_repost);
-
- // Removing of entries -------------------------------------------------------
-
- // Removes the entry at the specified |index|. This call dicards any pending
- // and transient entries. If the index is the last committed index, this does
- // nothing and returns false.
- void RemoveEntryAtIndex(int index);
-
// TabContents ---------------------------------------------------------------
// Returns the tab contents associated with this controller. Non-NULL except
@@ -258,11 +151,6 @@ class CONTENT_EXPORT NavigationController {
// so that we know to load URLs that were pending as "lazy" loads.
void SetActive(bool is_active);
- // Broadcasts the NOTIFY_NAV_ENTRY_CHANGED notification for the given entry
- // (which must be at the given index). This will keep things in sync like
- // the saved session.
- void NotifyEntryChanged(const content::NavigationEntry* entry, int index);
-
// Returns true if the given URL would be an in-page navigation (i.e. only
// the reference fragment is different) from the "last committed entry". We do
// not compare it against the "active entry" since the active entry can be
@@ -281,41 +169,8 @@ class CONTENT_EXPORT NavigationController {
// one should be empty (just created).
void CopyStateFrom(const NavigationController& source);
- // A variant of CopyStateFrom. Removes all entries from this except the last
- // entry, inserts all entries from |source| before and including the active
- // entry. This method is intended for use when the last entry of |this| is the
- // active entry. For example:
- // source: A B *C* D
- // this: E F *G* (last must be active or pending)
- // result: A B *G*
- // This ignores the transient index of the source and honors that of 'this'.
- void CopyStateFromAndPrune(NavigationController* source);
-
- // Removes all the entries except the active entry. If there is a new pending
- // navigation it is preserved.
- void PruneAllButActive();
-
// Random data ---------------------------------------------------------------
- SSLManager* ssl_manager() { return &ssl_manager_; }
-
- // Returns true if a reload happens when activated (SetActive(true) is
- // invoked). This is true for session/tab restore and cloned tabs.
- bool NeedsReload() const;
-
- // Sets the max restored page ID this NavigationController has seen, if it
- // was restored from a previous session.
- void set_max_restored_page_id(int32 max_id) {
- max_restored_page_id_ = max_id;
- }
-
- // Returns the largest restored page ID seen in this navigation controller,
- // if it was restored from a previous session. (-1 otherwise)
- int32 max_restored_page_id() const { return max_restored_page_id_; }
-
- // The session storage namespace that all child render views should use.
- SessionStorageNamespace* GetSessionStorageNamespace() const;
-
// Disables checking for a repost and prompting the user. This is used during
// testing.
static void DisablePromptOnRepost();
@@ -326,32 +181,6 @@ class CONTENT_EXPORT NavigationController {
}
static size_t max_entry_count();
- // Cancels a repost that brought up a warning.
- void CancelPendingReload();
- // Continues a repost that brought up a warning.
- void ContinuePendingReload();
-
- // Returns true if we are navigating to the URL the tab is opened with.
- 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.
- static content::NavigationEntry* CreateNavigationEntry(
- const GURL& url,
- const content::Referrer& referrer,
- content::PageTransition transition,
- bool is_renderer_initiated,
- const std::string& extra_headers,
- content::BrowserContext* browser_context);
- static content::NavigationEntryImpl* CreateNavigationEntryImpl(
- const GURL& url,
- const content::Referrer& referrer,
- content::PageTransition transition,
- bool is_renderer_initiated,
- const std::string& extra_headers,
- content::BrowserContext* browser_context);
-
private:
class RestoreHelper;
friend class RestoreHelper;
diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc
index 8bd3805..64e5458 100644
--- a/content/browser/tab_contents/navigation_controller_unittest.cc
+++ b/content/browser/tab_contents/navigation_controller_unittest.cc
@@ -1479,7 +1479,7 @@ TEST_F(NavigationControllerTest, RestoreNavigate) {
// Create a NavigationController with a restored set of tabs.
GURL url("http://foo");
std::vector<NavigationEntry*> entries;
- NavigationEntry* entry = NavigationController::CreateNavigationEntryImpl(
+ NavigationEntry* entry = NavigationController::CreateNavigationEntry(
url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false,
std::string(), browser_context());
entry->SetPageID(0);
@@ -1546,7 +1546,7 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) {
// Create a NavigationController with a restored set of tabs.
GURL url("http://foo");
std::vector<NavigationEntry*> entries;
- NavigationEntry* entry = NavigationController::CreateNavigationEntryImpl(
+ NavigationEntry* entry = NavigationController::CreateNavigationEntry(
url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false,
std::string(), browser_context());
entry->SetPageID(0);
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 9fec8e9..808366a 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -142,7 +142,7 @@ BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) {
ViewMsg_Navigate_Type::Value GetNavigationType(
content::BrowserContext* browser_context, const NavigationEntryImpl& entry,
- NavigationController::ReloadType reload_type) {
+ content::NavigationController::ReloadType reload_type) {
switch (reload_type) {
case NavigationController::RELOAD:
return ViewMsg_Navigate_Type::RELOAD;
@@ -162,7 +162,7 @@ ViewMsg_Navigate_Type::Value GetNavigationType(
void MakeNavigateParams(const NavigationEntryImpl& entry,
const NavigationController& controller,
content::WebContentsDelegate* delegate,
- NavigationController::ReloadType reload_type,
+ content::NavigationController::ReloadType reload_type,
ViewMsg_Navigate_Params* params) {
params->page_id = entry.GetPageID();
params->pending_history_list_offset = controller.GetIndexOfEntry(&entry);
@@ -779,7 +779,7 @@ WebContents* TabContents::OpenURL(const OpenURLParams& params) {
}
bool TabContents::NavigateToPendingEntry(
- NavigationController::ReloadType reload_type) {
+ content::NavigationController::ReloadType reload_type) {
return NavigateToEntry(
*NavigationEntryImpl::FromNavigationEntry(controller_.GetPendingEntry()),
reload_type);
@@ -787,7 +787,7 @@ bool TabContents::NavigateToPendingEntry(
bool TabContents::NavigateToEntry(
const NavigationEntryImpl& entry,
- NavigationController::ReloadType reload_type) {
+ content::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.
if (entry.GetURL().spec().size() > content::kMaxURLChars)
@@ -1295,7 +1295,7 @@ void TabContents::OnDidRunInsecureContent(
content::RecordAction(
UserMetricsAction("SSL.RanInsecureContentGoogle"));
}
- controller_.ssl_manager()->DidRunInsecureContent(security_origin);
+ controller_.GetSSLManager()->DidRunInsecureContent(security_origin);
displayed_insecure_content_ = true;
SSLManager::NotifySSLInternalStateChanged(&GetController());
}
@@ -1506,7 +1506,7 @@ void TabContents::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) {
// navigating (to avoid a race between the browser updating max_page_id and
// the renderer updating next_page_id_). Because of this, we only call this
// from CreateRenderView and allow that to notify the RenderView for us.
- int max_restored_page_id = controller_.max_restored_page_id();
+ int max_restored_page_id = controller_.GetMaxRestoredPageID();
if (max_restored_page_id > GetMaxPageIDForSiteInstance(rvh->site_instance()))
UpdateMaxPageIDForSiteInstance(rvh->site_instance(), max_restored_page_id);
}
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index f8b2a15..8438e52 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -95,7 +95,7 @@ class CONTENT_EXPORT TabContents
// If this method returns false, then the navigation is discarded (equivalent
// to calling DiscardPendingEntry on the NavigationController).
bool NavigateToPendingEntry(
- NavigationController::ReloadType reload_type);
+ content::NavigationController::ReloadType reload_type);
// Sets the passed passed interstitial as the currently showing interstitial.
// |interstitial_page| should be non NULL (use the remove_interstitial_page
@@ -473,7 +473,7 @@ class CONTENT_EXPORT TabContents
// must be already part of the entries in the navigation controller.
// This does not change the NavigationController state.
bool NavigateToEntry(const content::NavigationEntryImpl& entry,
- NavigationController::ReloadType reload_type);
+ content::NavigationController::ReloadType reload_type);
// Sets the history for this tab_contents to |history_length| entries, and
// moves the current page_id to the last entry in the list if it's valid.
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 0d13edc..08a7419 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -51,6 +51,7 @@
'public/browser/favicon_status.h',
'public/browser/global_request_id.h',
'public/browser/native_web_keyboard_event.h',
+ 'public/browser/navigation_controller.h',
'public/browser/navigation_details.cc',
'public/browser/navigation_details.h',
'public/browser/navigation_entry.h',
diff --git a/content/public/browser/navigation_controller.h b/content/public/browser/navigation_controller.h
new file mode 100644
index 0000000..a3da328
--- /dev/null
+++ b/content/public/browser/navigation_controller.h
@@ -0,0 +1,248 @@
+// 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_CONTROLLER_H_
+#define CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "base/string16.h"
+#include "content/common/content_export.h"
+#include "content/public/browser/global_request_id.h"
+#include "content/public/common/page_transition_types.h"
+
+class GURL;
+class SessionStorageNamespace;
+class SSLManager;
+class TabContents;
+
+namespace content {
+
+class BrowserContext;
+class NavigationEntry;
+struct Referrer;
+
+// A NavigationController maintains the back-forward list for a single tab and
+// manages all navigation within that list.
+//
+// The NavigationController also owns all TabContents for the tab. This is to
+// make sure that we have at most one TabContents instance per type.
+class NavigationController {
+ public:
+ enum ReloadType {
+ NO_RELOAD, // Normal load.
+ RELOAD, // Normal (cache-validating) reload.
+ RELOAD_IGNORING_CACHE // Reload bypassing the cache, aka shift-reload.
+ };
+
+ // Creates navigation entry and translates the virtual url to a real one.
+ // Used when navigating to a new URL using LoadURL. Extra headers are
+ // separated by \n.
+ static NavigationEntry* CreateNavigationEntry(
+ const GURL& url,
+ const Referrer& referrer,
+ PageTransition transition,
+ bool is_renderer_initiated,
+ const std::string& extra_headers,
+ BrowserContext* browser_context);
+
+ virtual ~NavigationController() {}
+
+ // Returns the browser context for this controller. It can never be NULL.
+ virtual BrowserContext* GetBrowserContext() const = 0;
+
+ // Initializes this NavigationController with the given saved navigations,
+ // using selected_navigation as the currently loaded entry. Before this call
+ // the controller should be unused (there should be no current entry). If
+ // from_last_session is true, navigations are from the previous session,
+ // otherwise they are from the current session (undo tab close). This takes
+ // ownership of the NavigationEntrys in |entries| and clears it out.
+ // This is used for session restore.
+ virtual void Restore(int selected_navigation,
+ bool from_last_session,
+ std::vector<NavigationEntry*>* entries) = 0;
+
+ // Active entry --------------------------------------------------------------
+
+ // Returns the active entry, which is the transient entry if any, the pending
+ // entry if a navigation is in progress or the last committed entry otherwise.
+ // NOTE: This can be NULL!!
+ //
+ // If you are trying to get the current state of the NavigationController,
+ // this is the method you will typically want to call. If you want to display
+ // the active entry to the user (e.g., in the location bar), use
+ // GetVisibleEntry instead.
+ virtual NavigationEntry* GetActiveEntry() const = 0;
+
+ // Returns the same entry as GetActiveEntry, except that it ignores pending
+ // history navigation entries. This should be used when displaying info to
+ // the user, so that the location bar and other indicators do not update for
+ // a back/forward navigation until the pending entry commits. This approach
+ // guards against URL spoofs on slow history navigations.
+ virtual NavigationEntry* GetVisibleEntry() const = 0;
+
+ // Returns the index from which we would go back/forward or reload. This is
+ // the last_committed_entry_index_ if pending_entry_index_ is -1. Otherwise,
+ // it is the pending_entry_index_.
+ virtual int GetCurrentEntryIndex() const = 0;
+
+ // Returns the last committed entry, which may be null if there are no
+ // committed entries.
+ virtual NavigationEntry* GetLastCommittedEntry() const = 0;
+
+ // Returns the index of the last committed entry.
+ virtual int GetLastCommittedEntryIndex() const = 0;
+
+ // Returns true if the source for the current entry can be viewed.
+ virtual bool CanViewSource() const = 0;
+
+ // Navigation list -----------------------------------------------------------
+
+ // Returns the number of entries in the NavigationController, excluding
+ // the pending entry if there is one, but including the transient entry if
+ // any.
+ virtual int GetEntryCount() const = 0;
+
+ virtual NavigationEntry* GetEntryAtIndex(int index) const = 0;
+
+ // Returns the entry at the specified offset from current. Returns NULL
+ // if out of bounds.
+ virtual NavigationEntry* GetEntryAtOffset(int offset) const = 0;
+
+ // Pending entry -------------------------------------------------------------
+
+ // Discards the pending and transient entries if any.
+ virtual void DiscardNonCommittedEntries() = 0;
+
+ // Returns the pending entry corresponding to the navigation that is
+ // currently in progress, or null if there is none.
+ virtual NavigationEntry* GetPendingEntry() const = 0;
+
+ // Returns the index of the pending entry or -1 if the pending entry
+ // corresponds to a new navigation (created via LoadURL).
+ virtual int GetPendingEntryIndex() const = 0;
+
+ // Transient entry -----------------------------------------------------------
+
+ // Returns the transient entry if any. This is an entry which is removed and
+ // discarded if any navigation occurs. Note that the returned entry is owned
+ // by the navigation controller and may be deleted at any time.
+ virtual NavigationEntry* GetTransientEntry() const = 0;
+
+ // New navigations -----------------------------------------------------------
+
+ // Loads the specified URL, specifying extra http headers to add to the
+ // request. Extra headers are separated by \n.
+ virtual void LoadURL(const GURL& url,
+ const Referrer& referrer,
+ PageTransition type,
+ const std::string& extra_headers) = 0;
+
+ // Same as LoadURL, but for renderer-initiated navigations. This state is
+ // important for tracking whether to display pending URLs.
+ virtual void LoadURLFromRenderer(const GURL& url,
+ const Referrer& referrer,
+ PageTransition type,
+ const std::string& extra_headers) = 0;
+
+ // Behaves like LoadURL() and LoadURLFromRenderer() but marks the new
+ // navigation as being transferred from one RVH to another. In this case the
+ // browser can recycle the old request once the new renderer wants to
+ // navigate.
+ // |transferred_global_request_id| identifies the request ID of the old
+ // request.
+ virtual void TransferURL(
+ const GURL& url,
+ const Referrer& referrer,
+ PageTransition transition,
+ const std::string& extra_headers,
+ const GlobalRequestID& transferred_global_request_id,
+ bool is_renderer_initiated) = 0;
+
+ // Loads the current page if this NavigationController was restored from
+ // history and the current page has not loaded yet.
+ virtual void LoadIfNecessary() = 0;
+
+ // Renavigation --------------------------------------------------------------
+
+ // Navigation relative to the "current entry"
+ virtual bool CanGoBack() const = 0;
+ virtual bool CanGoForward() const = 0;
+ virtual void GoBack() = 0;
+ virtual void GoForward() = 0;
+
+ // Navigates to the specified absolute index.
+ virtual void GoToIndex(int index) = 0;
+
+ // Navigates to the specified offset from the "current entry". Does nothing if
+ // the offset is out of bounds.
+ virtual void GoToOffset(int offset) = 0;
+
+ // Reloads the current entry. If |check_for_repost| is true and the current
+ // entry has POST data the user is prompted to see if they really want to
+ // reload the page. In nearly all cases pass in true.
+ virtual void Reload(bool check_for_repost) = 0;
+
+ // Like Reload(), but don't use caches (aka "shift-reload").
+ virtual void ReloadIgnoringCache(bool check_for_repost) = 0;
+
+ // Removing of entries -------------------------------------------------------
+
+ // Removes the entry at the specified |index|. This call dicards any pending
+ // and transient entries. If the index is the last committed index, this does
+ // nothing and returns false.
+ virtual void RemoveEntryAtIndex(int index) = 0;
+
+ // Random --------------------------------------------------------------------
+
+ virtual SSLManager* GetSSLManager() = 0;
+
+ // The session storage namespace that all child render views should use.
+ virtual SessionStorageNamespace* GetSessionStorageNamespace() const = 0;
+
+ // Sets the max restored page ID this NavigationController has seen, if it
+ // was restored from a previous session.
+ virtual void SetMaxRestoredPageID(int32 max_id) = 0;
+
+ // Returns the largest restored page ID seen in this navigation controller,
+ // if it was restored from a previous session. (-1 otherwise)
+ virtual int32 GetMaxRestoredPageID() const = 0;
+
+ // Returns true if a reload happens when activated (SetActive(true) is
+ // invoked). This is true for session/tab restore and cloned tabs.
+ virtual bool NeedsReload() const = 0;
+
+ // Cancels a repost that brought up a warning.
+ virtual void CancelPendingReload() = 0;
+ // Continues a repost that brought up a warning.
+ virtual void ContinuePendingReload() = 0;
+
+ // Returns true if we are navigating to the URL the tab is opened with.
+ virtual bool IsInitialNavigation() = 0;
+
+ // Broadcasts the NOTIFY_NAV_ENTRY_CHANGED notification for the given entry
+ // (which must be at the given index). This will keep things in sync like
+ // the saved session.
+ virtual void NotifyEntryChanged(const NavigationEntry* entry, int index) = 0;
+
+ // A variant of CopyStateFrom. Removes all entries from this except the last
+ // entry, inserts all entries from |source| before and including the active
+ // entry. This method is intended for use when the last entry of |this| is the
+ // active entry. For example:
+ // source: A B *C* D
+ // this: E F *G* (last must be active or pending)
+ // result: A B *G*
+ // This ignores the transient index of the source and honors that of 'this'.
+ virtual void CopyStateFromAndPrune(NavigationController* source) = 0;
+
+ // Removes all the entries except the active entry. If there is a new pending
+ // navigation it is preserved.
+ virtual void PruneAllButActive() = 0;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index 1e80d76..54f02df 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -81,8 +81,8 @@ class WebContents : public PageNavigator {
virtual void SetDelegate(WebContentsDelegate* delegate) = 0;
// Gets the controller for this tab contents.
- virtual NavigationController& GetController() = 0;
- virtual const NavigationController& GetController() const = 0;
+ virtual ::NavigationController& GetController() = 0;
+ virtual const ::NavigationController& GetController() const = 0;
// Returns the user browser context associated with this WebContents (via the
// NavigationController).
diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h
index 121ca8d..8303525 100644
--- a/content/public/browser/web_contents_observer.h
+++ b/content/public/browser/web_contents_observer.h
@@ -6,8 +6,8 @@
#define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_OBSERVER_H_
#include "base/process_util.h"
-#include "content/browser/tab_contents/navigation_controller.h"
#include "content/common/content_export.h"
+#include "content/public/browser/navigation_controller.h"
#include "content/public/common/page_transition_types.h"
#include "ipc/ipc_channel.h"
#include "webkit/glue/window_open_disposition.h"
@@ -19,6 +19,7 @@ namespace content {
class WebContents;
struct FrameNavigateParams;
+struct LoadCommittedDetails;
struct Referrer;
// An observer API implemented by classes which are interested in various page