summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-28 21:04:23 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-28 21:04:23 +0000
commit10f417c53722348c4452dc22e1a0dd18c0e4b140 (patch)
tree470c5574d9d2ef9c7ba62951868149e70169b1a5 /content
parenta47fccd356705a7d92cc83b03150c9782167f8c4 (diff)
downloadchromium_src-10f417c53722348c4452dc22e1a0dd18c0e4b140.zip
chromium_src-10f417c53722348c4452dc22e1a0dd18c0e4b140.tar.gz
chromium_src-10f417c53722348c4452dc22e1a0dd18c0e4b140.tar.bz2
Rename NavigationController to NavigationControllerImpl and put it into the content namespace. Also make all users of content::NavigationController interface use the "using" keyword so they don't have to put content:: everywhere (similar to other Content API and WebKit API classes).
BUG=98716 TBR=joi Review URL: http://codereview.chromium.org/8956059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115916 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/download/save_package.cc3
-rw-r--r--content/browser/renderer_host/test_render_view_host.cc5
-rw-r--r--content/browser/site_instance_unittest.cc28
-rw-r--r--content/browser/ssl/ssl_manager.cc16
-rw-r--r--content/browser/ssl/ssl_manager.h7
-rw-r--r--content/browser/ssl/ssl_policy.cc10
-rw-r--r--content/browser/ssl/ssl_policy.h12
-rw-r--r--content/browser/tab_contents/interstitial_page.cc10
-rw-r--r--content/browser/tab_contents/navigation_controller.cc133
-rw-r--r--content/browser/tab_contents/navigation_controller.h24
-rw-r--r--content/browser/tab_contents/navigation_controller_unittest.cc72
-rw-r--r--content/browser/tab_contents/navigation_entry_impl.cc (renamed from content/browser/tab_contents/navigation_entry.cc)99
-rw-r--r--content/browser/tab_contents/navigation_entry_impl.h (renamed from content/browser/tab_contents/navigation_entry.h)78
-rw-r--r--content/browser/tab_contents/navigation_entry_impl_unittest.cc (renamed from content/browser/tab_contents/navigation_entry_unittest.cc)51
-rw-r--r--content/browser/tab_contents/render_view_host_manager.cc28
-rw-r--r--content/browser/tab_contents/render_view_host_manager.h18
-rw-r--r--content/browser/tab_contents/render_view_host_manager_unittest.cc71
-rw-r--r--content/browser/tab_contents/tab_contents.cc50
-rw-r--r--content/browser/tab_contents/tab_contents.h5
-rw-r--r--content/browser/tab_contents/tab_contents_unittest.cc57
-rw-r--r--content/browser/tab_contents/test_tab_contents.cc6
-rw-r--r--content/content_browser.gypi4
-rw-r--r--content/content_tests.gypi2
23 files changed, 404 insertions, 385 deletions
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc
index 5292d05..da2c8a9 100644
--- a/content/browser/download/save_package.cc
+++ b/content/browser/download/save_package.cc
@@ -46,6 +46,7 @@
using base::Time;
using content::BrowserThread;
using content::DownloadItem;
+using content::NavigationEntry;
using WebKit::WebPageSerializerClient;
namespace {
@@ -224,7 +225,7 @@ GURL SavePackage::GetUrlToBeSaved() {
// from the NavigationEntry because it reflects its' origin
// rather than the displayed one (returned by GetURL) which may be
// different (like having "view-source:" on the front).
- content::NavigationEntry* active_entry =
+ NavigationEntry* active_entry =
web_contents()->GetController().GetActiveEntry();
return active_entry->GetURL();
}
diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc
index a8380e3..f0e6030 100644
--- a/content/browser/renderer_host/test_render_view_host.cc
+++ b/content/browser/renderer_host/test_render_view_host.cc
@@ -8,7 +8,7 @@
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/navigation_controller.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/common/dom_storage_common.h"
#include "content/common/view_messages.h"
@@ -19,6 +19,7 @@
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webpreferences.h"
+using content::NavigationEntry;
using webkit::forms::PasswordForm;
void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params,
@@ -365,7 +366,7 @@ void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) {
}
void RenderViewHostTestHarness::Reload() {
- content::NavigationEntry* entry = controller().GetLastCommittedEntry();
+ NavigationEntry* entry = controller().GetLastCommittedEntry();
DCHECK(entry);
controller().Reload(false);
rvh()->SendNavigate(entry->GetPageID(), entry->GetURL());
diff --git a/content/browser/site_instance_unittest.cc b/content/browser/site_instance_unittest.cc
index 7857327..dcfcd3e 100644
--- a/content/browser/site_instance_unittest.cc
+++ b/content/browser/site_instance_unittest.cc
@@ -13,7 +13,7 @@
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/webui/empty_web_ui_factory.h"
#include "content/public/common/content_client.h"
@@ -25,6 +25,8 @@
using content::BrowserThread;
using content::BrowserThreadImpl;
+using content::NavigationEntry;
+using content::NavigationEntryImpl;
namespace {
@@ -177,21 +179,18 @@ TEST_F(SiteInstanceTest, SiteInstanceDestructor) {
&browsingDeleteCounter);
EXPECT_EQ(0, siteDeleteCounter);
- NavigationEntry* e1 = new NavigationEntry(instance, 0, url,
- content::Referrer(),
- string16(),
- content::PAGE_TRANSITION_LINK,
- false);
+ NavigationEntryImpl* e1 = new NavigationEntryImpl(
+ instance, 0, url, content::Referrer(), string16(),
+ content::PAGE_TRANSITION_LINK, false);
// Redundantly setting e1's SiteInstance shouldn't affect the ref count.
e1->set_site_instance(instance);
EXPECT_EQ(0, siteDeleteCounter);
// Add a second reference
- NavigationEntry* e2 = new NavigationEntry(instance, 0, url,
- content::Referrer(), string16(),
- content::PAGE_TRANSITION_LINK,
- false);
+ NavigationEntryImpl* e2 = new NavigationEntryImpl(
+ instance, 0, url, content::Referrer(), string16(),
+ content::PAGE_TRANSITION_LINK, false);
// Now delete both entries and be sure the SiteInstance goes away.
delete e1;
@@ -244,12 +243,11 @@ TEST_F(SiteInstanceTest, CloneNavigationEntry) {
TestSiteInstance::CreateTestSiteInstance(NULL, &siteDeleteCounter2,
&browsingDeleteCounter);
- NavigationEntry* e1 = new NavigationEntry(instance1, 0, url,
- content::Referrer(), string16(),
- content::PAGE_TRANSITION_LINK,
- false);
+ NavigationEntryImpl* e1 = new NavigationEntryImpl(
+ instance1, 0, url, content::Referrer(), string16(),
+ content::PAGE_TRANSITION_LINK, false);
// Clone the entry
- NavigationEntry* e2 = new NavigationEntry(*e1);
+ NavigationEntryImpl* e2 = new NavigationEntryImpl(*e1);
// Should be able to change the SiteInstance of the cloned entry.
e2->set_site_instance(instance2);
diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc
index 55a7ba2..577b2d1 100644
--- a/content/browser/ssl/ssl_manager.cc
+++ b/content/browser/ssl/ssl_manager.cc
@@ -13,7 +13,7 @@
#include "content/browser/ssl/ssl_cert_error_handler.h"
#include "content/browser/ssl/ssl_policy.h"
#include "content/browser/ssl/ssl_request_info.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/provisional_load_details.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/browser_thread.h"
@@ -24,6 +24,8 @@
#include "net/base/cert_status_flags.h"
using content::BrowserThread;
+using content::NavigationEntry;
+using content::NavigationEntryImpl;
using content::SSLStatus;
using content::WebContents;
@@ -130,8 +132,8 @@ void SSLManager::DidCommitProvisionalLoad(
content::LoadCommittedDetails* details =
content::Details<content::LoadCommittedDetails>(in_details).ptr();
- NavigationEntry* entry =
- NavigationEntry::FromNavigationEntry(controller_->GetActiveEntry());
+ NavigationEntryImpl* entry =
+ NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry());
if (details->is_main_frame) {
if (entry) {
@@ -161,12 +163,12 @@ void SSLManager::DidCommitProvisionalLoad(
void SSLManager::DidRunInsecureContent(const std::string& security_origin) {
policy()->DidRunInsecureContent(
- NavigationEntry::FromNavigationEntry(controller_->GetActiveEntry()),
+ NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()),
security_origin);
}
bool SSLManager::ProcessedSSLErrorFromRequest() const {
- content::NavigationEntry* entry = controller_->GetActiveEntry();
+ NavigationEntry* entry = controller_->GetActiveEntry();
if (!entry) {
NOTREACHED();
return false;
@@ -244,10 +246,10 @@ void SSLManager::DidReceiveResourceRedirect(ResourceRedirectDetails* details) {
void SSLManager::DidChangeSSLInternalState() {
UpdateEntry(
- NavigationEntry::FromNavigationEntry(controller_->GetActiveEntry()));
+ NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry()));
}
-void SSLManager::UpdateEntry(NavigationEntry* entry) {
+void SSLManager::UpdateEntry(NavigationEntryImpl* entry) {
// We don't always have a navigation entry to update, for example in the
// case of the Web Inspector.
if (!entry)
diff --git a/content/browser/ssl/ssl_manager.h b/content/browser/ssl/ssl_manager.h
index a5c65c2..6aa98cc 100644
--- a/content/browser/ssl/ssl_manager.h
+++ b/content/browser/ssl/ssl_manager.h
@@ -20,12 +20,15 @@
class LoadFromMemoryCacheDetails;
class NavigationController;
-class NavigationEntry;
class ResourceDispatcherHost;
class ResourceRedirectDetails;
class ResourceRequestDetails;
class SSLPolicy;
+namespace content {
+class NavigationEntryImpl;
+}
+
namespace net {
class SSLInfo;
class URLRequest;
@@ -110,7 +113,7 @@ class SSLManager : public content::NotificationObserver {
void DidChangeSSLInternalState();
// Update the NavigationEntry with our current state.
- void UpdateEntry(NavigationEntry* entry);
+ void UpdateEntry(content::NavigationEntryImpl* entry);
// The backend for the SSLPolicy to actuate its decisions.
SSLPolicyBackend backend_;
diff --git a/content/browser/ssl/ssl_policy.cc b/content/browser/ssl/ssl_policy.cc
index 57acc78..5202655 100644
--- a/content/browser/ssl/ssl_policy.cc
+++ b/content/browser/ssl/ssl_policy.cc
@@ -15,7 +15,7 @@
#include "content/browser/site_instance.h"
#include "content/browser/ssl/ssl_cert_error_handler.h"
#include "content/browser/ssl/ssl_request_info.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/ssl_status.h"
@@ -24,6 +24,7 @@
#include "net/base/ssl_info.h"
#include "webkit/glue/resource_type.h"
+using content::NavigationEntryImpl;
using content::SSLStatus;
namespace {
@@ -86,7 +87,7 @@ void SSLPolicy::OnCertError(SSLCertErrorHandler* handler) {
}
}
-void SSLPolicy::DidRunInsecureContent(NavigationEntry* entry,
+void SSLPolicy::DidRunInsecureContent(NavigationEntryImpl* entry,
const std::string& security_origin) {
if (!entry)
return;
@@ -108,7 +109,8 @@ void SSLPolicy::OnRequestStarted(SSLRequestInfo* info) {
backend_->HostRanInsecureContent(info->url().host(), info->child_id());
}
-void SSLPolicy::UpdateEntry(NavigationEntry* entry, TabContents* tab_contents) {
+void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry,
+ TabContents* tab_contents) {
DCHECK(entry);
InitializeEntryIfNeeded(entry);
@@ -206,7 +208,7 @@ void SSLPolicy::OnCertErrorInternal(SSLCertErrorHandler* handler,
base::Bind(&SSLPolicy::OnAllowCertificate, base::Unretained(this)));
}
-void SSLPolicy::InitializeEntryIfNeeded(NavigationEntry* entry) {
+void SSLPolicy::InitializeEntryIfNeeded(NavigationEntryImpl* entry) {
if (entry->GetSSL().security_style != content::SECURITY_STYLE_UNKNOWN)
return;
diff --git a/content/browser/ssl/ssl_policy.h b/content/browser/ssl/ssl_policy.h
index 302207d..1cf0de1 100644
--- a/content/browser/ssl/ssl_policy.h
+++ b/content/browser/ssl/ssl_policy.h
@@ -10,12 +10,15 @@
#include "webkit/glue/resource_type.h"
-class NavigationEntry;
class SSLCertErrorHandler;
class SSLPolicyBackend;
class SSLRequestInfo;
class TabContents;
+namespace content {
+class NavigationEntryImpl;
+}
+
// SSLPolicy
//
// This class is responsible for making the security decisions that concern the
@@ -29,7 +32,7 @@ class SSLPolicy {
// An error occurred with the certificate in an SSL connection.
void OnCertError(SSLCertErrorHandler* handler);
- void DidRunInsecureContent(NavigationEntry* entry,
+ void DidRunInsecureContent(content::NavigationEntryImpl* entry,
const std::string& security_origin);
// We have started a resource request with the given info.
@@ -37,7 +40,8 @@ class SSLPolicy {
// Update the SSL information in |entry| to match the current state.
// |tab_contents| is the TabContents associated with this entry.
- void UpdateEntry(NavigationEntry* entry, TabContents* tab_contents);
+ void UpdateEntry(content::NavigationEntryImpl* entry,
+ TabContents* tab_contents);
SSLPolicyBackend* backend() const { return backend_; }
@@ -54,7 +58,7 @@ class SSLPolicy {
// If the security style of |entry| has not been initialized, then initialize
// it with the default style for its URL.
- void InitializeEntryIfNeeded(NavigationEntry* entry);
+ void InitializeEntryIfNeeded(content::NavigationEntryImpl* entry);
// Mark |origin| as having run insecure content in the process with ID |pid|.
void OriginRanInsecureContent(const std::string& origin, int pid);
diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc
index d9590e1..75369a9 100644
--- a/content/browser/tab_contents/interstitial_page.cc
+++ b/content/browser/tab_contents/interstitial_page.cc
@@ -18,7 +18,7 @@
#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/navigation_controller.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/common/dom_storage_common.h"
@@ -34,6 +34,8 @@
#include "net/url_request/url_request_context_getter.h"
using content::BrowserThread;
+using content::NavigationEntry;
+using content::NavigationEntryImpl;
using content::WebContents;
using WebKit::WebDragOperation;
using WebKit::WebDragOperationsMask;
@@ -186,7 +188,7 @@ void InterstitialPage::Show() {
(*tab_to_interstitial_page_)[tab_] = this;
if (new_navigation_) {
- NavigationEntry* entry = new NavigationEntry;
+ NavigationEntryImpl* entry = new NavigationEntryImpl;
entry->SetURL(url_);
entry->SetVirtualURL(url_);
entry->set_page_type(content::PAGE_TYPE_INTERSTITIAL);
@@ -238,7 +240,7 @@ void InterstitialPage::Hide() {
if (tab_->GetInterstitialPage())
tab_->remove_interstitial_page();
// Let's revert to the original title if necessary.
- content::NavigationEntry* entry = tab_->GetController().GetActiveEntry();
+ NavigationEntry* entry = tab_->GetController().GetActiveEntry();
if (!new_navigation_ && should_revert_tab_title_) {
entry->SetTitle(original_tab_title_);
tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE);
@@ -370,7 +372,7 @@ void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host,
const string16& title,
base::i18n::TextDirection title_direction) {
DCHECK(render_view_host == render_view_host_);
- content::NavigationEntry* entry = tab_->GetController().GetActiveEntry();
+ NavigationEntry* entry = tab_->GetController().GetActiveEntry();
if (!entry) {
// Crash reports from the field indicate this can be NULL.
// This is unexpected as InterstitialPages constructed with the
diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc
index 2e1b31d..c22532b 100644
--- a/content/browser/tab_contents/navigation_controller.cc
+++ b/content/browser/tab_contents/navigation_controller.cc
@@ -16,7 +16,7 @@
#include "content/browser/renderer_host/render_view_host.h" // Temporary
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/interstitial_page.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/view_messages.h"
#include "content/public/browser/browser_context.h"
@@ -32,6 +32,8 @@
#include "webkit/glue/webkit_glue.h"
using content::GlobalRequestID;
+using content::NavigationEntry;
+using content::NavigationEntryImpl;
using content::UserMetricsAction;
namespace {
@@ -60,7 +62,7 @@ void NotifyPrunedEntries(NavigationController* nav_controller,
// losing the navigation entries and generating a new navigation entry after
// this one. We don't want that. To avoid this we create a valid state which
// WebKit will not treat as a new navigation.
-void SetContentStateIfEmpty(NavigationEntry* entry) {
+void SetContentStateIfEmpty(NavigationEntryImpl* entry) {
if (entry->GetContentState().empty()) {
entry->SetContentState(
webkit_glue::CreateHistoryStateForURL(entry->GetURL()));
@@ -70,15 +72,15 @@ void SetContentStateIfEmpty(NavigationEntry* entry) {
// Configure all the NavigationEntries in entries for restore. This resets
// the transition type to reload and makes sure the content state isn't empty.
void ConfigureEntriesForRestore(
- std::vector<linked_ptr<NavigationEntry> >* entries,
+ std::vector<linked_ptr<NavigationEntryImpl> >* entries,
bool from_last_session) {
for (size_t i = 0; i < entries->size(); ++i) {
// Use a transition type of reload so that we don't incorrectly increase
// the typed count.
(*entries)[i]->SetTransitionType(content::PAGE_TRANSITION_RELOAD);
(*entries)[i]->set_restore_type(from_last_session ?
- NavigationEntry::RESTORE_LAST_SESSION :
- NavigationEntry::RESTORE_CURRENT_SESSION);
+ NavigationEntryImpl::RESTORE_LAST_SESSION :
+ NavigationEntryImpl::RESTORE_CURRENT_SESSION);
// NOTE(darin): This code is only needed for backwards compat.
SetContentStateIfEmpty((*entries)[i].get());
}
@@ -149,7 +151,7 @@ NavigationController::~NavigationController() {
void NavigationController::Restore(
int selected_navigation,
bool from_last_session,
- std::vector<content::NavigationEntry*>* entries) {
+ std::vector<NavigationEntry*>* entries) {
// Verify that this controller is unused and that the input is valid.
DCHECK(entry_count() == 0 && !GetPendingEntry());
DCHECK(selected_navigation >= 0 &&
@@ -157,9 +159,9 @@ void NavigationController::Restore(
needs_reload_ = true;
for (size_t i = 0; i < entries->size(); ++i) {
- NavigationEntry* entry =
- NavigationEntry::FromNavigationEntry((*entries)[i]);
- entries_.push_back(linked_ptr<NavigationEntry>(entry));
+ NavigationEntryImpl* entry =
+ NavigationEntryImpl::FromNavigationEntry((*entries)[i]);
+ entries_.push_back(linked_ptr<NavigationEntryImpl>(entry));
}
entries->clear();
@@ -230,7 +232,7 @@ bool NavigationController::IsInitialNavigation() {
}
// static
-content::NavigationEntry* NavigationController::CreateNavigationEntry(
+NavigationEntry* NavigationController::CreateNavigationEntry(
const GURL& url,
const content::Referrer& referrer,
content::PageTransition transition,
@@ -243,7 +245,7 @@ content::NavigationEntry* NavigationController::CreateNavigationEntry(
}
// static
-NavigationEntry* NavigationController::CreateNavigationEntryImpl(
+NavigationEntryImpl* NavigationController::CreateNavigationEntryImpl(
const GURL& url, const content::Referrer& referrer,
content::PageTransition transition,
bool is_renderer_initiated, const std::string& extra_headers,
@@ -257,7 +259,7 @@ NavigationEntry* NavigationController::CreateNavigationEntryImpl(
BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
&loaded_url, browser_context, &reverse_on_redirect);
- NavigationEntry* entry = new NavigationEntry(
+ NavigationEntryImpl* entry = new NavigationEntryImpl(
NULL, // The site instance for tabs is sent on navigation
// (TabContents::GetSiteInstance).
-1,
@@ -273,13 +275,13 @@ NavigationEntry* NavigationController::CreateNavigationEntryImpl(
return entry;
}
-NavigationEntry* NavigationController::GetEntryWithPageID(
+NavigationEntryImpl* NavigationController::GetEntryWithPageID(
SiteInstance* instance, int32 page_id) const {
int index = GetEntryIndexWithPageID(instance, page_id);
return (index != -1) ? entries_[index].get() : NULL;
}
-void NavigationController::LoadEntry(NavigationEntry* entry) {
+void NavigationController::LoadEntry(NavigationEntryImpl* entry) {
// Don't navigate to URLs disabled by policy. This prevents showing the URL
// on the Omnibar when it is also going to be blocked by
// ChildProcessSecurityPolicy::CanRequestURL.
@@ -301,11 +303,11 @@ void NavigationController::LoadEntry(NavigationEntry* entry) {
content::NotificationService::current()->Notify(
content::NOTIFICATION_NAV_ENTRY_PENDING,
content::Source<NavigationController>(this),
- content::Details<content::NavigationEntry>(entry));
+ content::Details<NavigationEntry>(entry));
NavigateToPendingEntry(NO_RELOAD);
}
-content::NavigationEntry* NavigationController::GetActiveEntry() const {
+NavigationEntry* NavigationController::GetActiveEntry() const {
if (transient_entry_index_ != -1)
return entries_[transient_entry_index_].get();
if (pending_entry_)
@@ -313,7 +315,7 @@ content::NavigationEntry* NavigationController::GetActiveEntry() const {
return GetLastCommittedEntry();
}
-content::NavigationEntry* NavigationController::GetVisibleEntry() const {
+NavigationEntry* NavigationController::GetVisibleEntry() const {
if (transient_entry_index_ != -1)
return entries_[transient_entry_index_].get();
// Only return the pending_entry for new (non-history), browser-initiated
@@ -337,7 +339,7 @@ int NavigationController::GetCurrentEntryIndex() const {
return last_committed_entry_index_;
}
-content::NavigationEntry* NavigationController::GetLastCommittedEntry() const {
+NavigationEntry* NavigationController::GetLastCommittedEntry() const {
if (last_committed_entry_index_ == -1)
return NULL;
return entries_[last_committed_entry_index_].get();
@@ -346,17 +348,17 @@ content::NavigationEntry* NavigationController::GetLastCommittedEntry() const {
bool NavigationController::CanViewSource() const {
bool is_supported_mime_type = net::IsSupportedNonImageMimeType(
tab_contents_->GetContentsMimeType().c_str());
- content::NavigationEntry* active_entry = GetActiveEntry();
+ NavigationEntry* active_entry = GetActiveEntry();
return active_entry && !active_entry->IsViewSourceMode() &&
is_supported_mime_type && !tab_contents_->GetInterstitialPage();
}
-content::NavigationEntry* NavigationController::GetEntryAtIndex(
+NavigationEntry* NavigationController::GetEntryAtIndex(
int index) const {
return entries_.at(index).get();
}
-content::NavigationEntry* NavigationController::GetEntryAtOffset(
+NavigationEntry* NavigationController::GetEntryAtOffset(
int offset) const {
int index = (transient_entry_index_ != -1) ?
transient_entry_index_ + offset :
@@ -466,7 +468,7 @@ void NavigationController::RemoveEntryAtIndex(int index) {
}
void NavigationController::UpdateVirtualURLToURL(
- NavigationEntry* entry, const GURL& new_url) {
+ NavigationEntryImpl* entry, const GURL& new_url) {
GURL new_virtual_url(new_url);
if (BrowserURLHandler::GetInstance()->ReverseURLRewrite(
&new_virtual_url, entry->GetVirtualURL(), browser_context_)) {
@@ -474,13 +476,14 @@ void NavigationController::UpdateVirtualURLToURL(
}
}
-void NavigationController::AddTransientEntry(NavigationEntry* entry) {
+void NavigationController::AddTransientEntry(NavigationEntryImpl* entry) {
// Discard any current transient entry, we can only have one at a time.
int index = 0;
if (last_committed_entry_index_ != -1)
index = last_committed_entry_index_ + 1;
DiscardTransientEntry();
- entries_.insert(entries_.begin() + index, linked_ptr<NavigationEntry>(entry));
+ entries_.insert(
+ entries_.begin() + index, linked_ptr<NavigationEntryImpl>(entry));
transient_entry_index_ = index;
tab_contents_->NotifyNavigationStateChanged(kInvalidateAll);
}
@@ -495,10 +498,9 @@ void NavigationController::TransferURL(
// The user initiated a load, we don't need to reload anymore.
needs_reload_ = false;
- NavigationEntry* entry = CreateNavigationEntryImpl(url, referrer, transition,
- is_renderer_initiated,
- extra_headers,
- browser_context_);
+ NavigationEntryImpl* entry = CreateNavigationEntryImpl(
+ url, referrer, transition, is_renderer_initiated, extra_headers,
+ browser_context_);
entry->set_transferred_global_request_id(transferred_global_request_id);
LoadEntry(entry);
@@ -512,10 +514,8 @@ void NavigationController::LoadURL(
// The user initiated a load, we don't need to reload anymore.
needs_reload_ = false;
- NavigationEntry* entry = CreateNavigationEntryImpl(url, referrer, transition,
- false,
- extra_headers,
- browser_context_);
+ NavigationEntryImpl* entry = CreateNavigationEntryImpl(
+ url, referrer, transition, false, extra_headers, browser_context_);
LoadEntry(entry);
}
@@ -528,10 +528,8 @@ void NavigationController::LoadURLFromRenderer(
// The user initiated a load, we don't need to reload anymore.
needs_reload_ = false;
- NavigationEntry* entry = CreateNavigationEntryImpl(url, referrer, transition,
- true,
- extra_headers,
- browser_context_);
+ NavigationEntryImpl* entry = CreateNavigationEntryImpl(
+ url, referrer, transition, true, extra_headers, browser_context_);
LoadEntry(entry);
}
@@ -602,8 +600,8 @@ bool NavigationController::RendererDidNavigate(
// All committed entries should have nonempty content state so WebKit doesn't
// get confused when we go back to them (see the function for details).
DCHECK(!params.content_state.empty());
- NavigationEntry* active_entry =
- NavigationEntry::FromNavigationEntry(GetActiveEntry());
+ NavigationEntryImpl* active_entry =
+ NavigationEntryImpl::FromNavigationEntry(GetActiveEntry());
active_entry->SetContentState(params.content_state);
// Once committed, we do not need to track if the entry was initiated by
@@ -711,7 +709,7 @@ content::NavigationType NavigationController::ClassifyNavigation(
tab_contents_->GetRenderViewHost()->Send(new ViewMsg_TempCrashWithData(url));
return content::NAVIGATION_TYPE_NAV_IGNORE;
}
- NavigationEntry* existing_entry = entries_[existing_entry_index].get();
+ NavigationEntryImpl* existing_entry = entries_[existing_entry_index].get();
if (!content::PageTransitionIsMainFrame(params.transition)) {
// All manual subframes would get new IDs and were handled above, so we
@@ -761,13 +759,13 @@ bool NavigationController::IsRedirect(
void NavigationController::RendererDidNavigateToNewPage(
const ViewHostMsg_FrameNavigate_Params& params, bool* did_replace_entry) {
- NavigationEntry* new_entry;
+ NavigationEntryImpl* new_entry;
bool update_virtual_url;
if (pending_entry_) {
// TODO(brettw) this assumes that the pending entry is appropriate for the
// new page that was just loaded. I don't think this is necessarily the
// case! We should have some more tracking to know for sure.
- new_entry = new NavigationEntry(*pending_entry_);
+ new_entry = new NavigationEntryImpl(*pending_entry_);
// Don't use the page type from the pending entry. Some interstitial page
// may have set the type to interstitial. Once we commit, however, the page
@@ -775,7 +773,7 @@ void NavigationController::RendererDidNavigateToNewPage(
new_entry->set_page_type(content::PAGE_TYPE_NORMAL);
update_virtual_url = new_entry->update_virtual_url_with_url();
} else {
- new_entry = new NavigationEntry;
+ new_entry = new NavigationEntryImpl;
// When navigating to a new page, give the browser URL handler a chance to
// update the virtual URL based on the new URL. For example, this is needed
// to show chrome://bookmarks/#1 when the bookmarks webui extension changes
@@ -807,7 +805,7 @@ void NavigationController::RendererDidNavigateToExistingPage(
params.page_id);
DCHECK(entry_index >= 0 &&
entry_index < static_cast<int>(entries_.size()));
- NavigationEntry* entry = entries_[entry_index].get();
+ NavigationEntryImpl* entry = entries_[entry_index].get();
// The URL may have changed due to redirects. The site instance will normally
// be the same except during session restore, when no site instance will be
@@ -844,9 +842,8 @@ void NavigationController::RendererDidNavigateToSamePage(
// This mode implies we have a pending entry that's the same as an existing
// entry for this page ID. This entry is guaranteed to exist by
// ClassifyNavigation. All we need to do is update the existing entry.
- NavigationEntry* existing_entry = GetEntryWithPageID(
- tab_contents_->GetSiteInstance(),
- params.page_id);
+ NavigationEntryImpl* existing_entry = GetEntryWithPageID(
+ tab_contents_->GetSiteInstance(), params.page_id);
// We assign the entry's unique ID to be that of the new one. Since this is
// always the result of a user action, we want to dismiss infobars, etc. like
@@ -866,9 +863,8 @@ void NavigationController::RendererDidNavigateInPage(
DCHECK(content::PageTransitionIsMainFrame(params.transition)) <<
"WebKit should only tell us about in-page navs for the main frame.";
// We're guaranteed to have an entry for this one.
- NavigationEntry* existing_entry = GetEntryWithPageID(
- tab_contents_->GetSiteInstance(),
- params.page_id);
+ NavigationEntryImpl* existing_entry = GetEntryWithPageID(
+ tab_contents_->GetSiteInstance(), params.page_id);
// Reference fragment navigation. We're guaranteed to have the last_committed
// entry and it will be the same page as the new navigation (minus the
@@ -904,8 +900,8 @@ void NavigationController::RendererDidNavigateNewSubframe(
// band with the actual navigations.
DCHECK(GetLastCommittedEntry()) << "ClassifyNavigation should guarantee "
<< "that a last committed entry exists.";
- NavigationEntry* new_entry = new NavigationEntry(
- *NavigationEntry::FromNavigationEntry(GetLastCommittedEntry()));
+ NavigationEntryImpl* new_entry = new NavigationEntryImpl(
+ *NavigationEntryImpl::FromNavigationEntry(GetLastCommittedEntry()));
new_entry->SetPageID(params.page_id);
InsertOrReplaceEntry(new_entry, false);
}
@@ -937,7 +933,7 @@ bool NavigationController::RendererDidNavigateAutoSubframe(
}
int NavigationController::GetIndexOfEntry(
- const NavigationEntry* entry) const {
+ const NavigationEntryImpl* entry) const {
const NavigationEntries::const_iterator i(std::find(
entries_.begin(),
entries_.end(),
@@ -946,7 +942,7 @@ int NavigationController::GetIndexOfEntry(
}
bool NavigationController::IsURLInPageNavigation(const GURL& url) const {
- content::NavigationEntry* last_committed = GetLastCommittedEntry();
+ NavigationEntry* last_committed = GetLastCommittedEntry();
if (!last_committed)
return false;
return AreURLsInPageNavigation(last_committed->GetURL(), url);
@@ -971,8 +967,8 @@ void NavigationController::CopyStateFromAndPrune(NavigationController* source) {
// The SiteInstance and page_id of the last committed entry needs to be
// remembered at this point, in case there is only one committed entry
// and it is pruned.
- NavigationEntry* last_committed =
- NavigationEntry::FromNavigationEntry(GetLastCommittedEntry());
+ NavigationEntryImpl* last_committed =
+ NavigationEntryImpl::FromNavigationEntry(GetLastCommittedEntry());
SiteInstance* site_instance =
last_committed ? last_committed->site_instance() : NULL;
int32 minimum_page_id = last_committed ? last_committed->GetPageID() : -1;
@@ -1074,18 +1070,19 @@ void NavigationController::DiscardNonCommittedEntries() {
}
}
-content::NavigationEntry* NavigationController::GetPendingEntry() const {
+NavigationEntry* NavigationController::GetPendingEntry() const {
return pending_entry_;
}
-void NavigationController::InsertOrReplaceEntry(NavigationEntry* entry,
+void NavigationController::InsertOrReplaceEntry(NavigationEntryImpl* entry,
bool replace) {
DCHECK(entry->GetTransitionType() != content::PAGE_TRANSITION_AUTO_SUBFRAME);
// Copy the pending entry's unique ID to the committed entry.
// I don't know if pending_entry_index_ can be other than -1 here.
- const NavigationEntry* const pending_entry = (pending_entry_index_ == -1) ?
- pending_entry_ : entries_[pending_entry_index_].get();
+ const NavigationEntryImpl* const pending_entry =
+ (pending_entry_index_ == -1) ?
+ pending_entry_ : entries_[pending_entry_index_].get();
if (pending_entry)
entry->set_unique_id(pending_entry->GetUniqueID());
@@ -1118,7 +1115,7 @@ void NavigationController::InsertOrReplaceEntry(NavigationEntry* entry,
NotifyPrunedEntries(this, true, 1);
}
- entries_.push_back(linked_ptr<NavigationEntry>(entry));
+ entries_.push_back(linked_ptr<NavigationEntryImpl>(entry));
last_committed_entry_index_ = static_cast<int>(entries_.size()) - 1;
// This is a new page ID, so we need everybody to know about it.
@@ -1137,7 +1134,7 @@ void NavigationController::NavigateToPendingEntry(ReloadType reload_type) {
if (pending_entry_index_ != -1 &&
pending_entry_index_ == last_committed_entry_index_ &&
(entries_[pending_entry_index_]->restore_type() ==
- NavigationEntry::RESTORE_NONE) &&
+ NavigationEntryImpl::RESTORE_NONE) &&
(entries_[pending_entry_index_]->GetTransitionType() &
content::PAGE_TRANSITION_FORWARD_BACK)) {
tab_contents_->Stop();
@@ -1172,9 +1169,9 @@ void NavigationController::NavigateToPendingEntry(ReloadType reload_type) {
// This works for browser-initiated navigations. We handle renderer-initiated
// navigations to restored entries in TabContents::OnGoToEntryAtOffset.
if (pending_entry_ && !pending_entry_->site_instance() &&
- pending_entry_->restore_type() != NavigationEntry::RESTORE_NONE) {
+ pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE) {
pending_entry_->set_site_instance(tab_contents_->GetPendingSiteInstance());
- pending_entry_->set_restore_type(NavigationEntry::RESTORE_NONE);
+ pending_entry_->set_restore_type(NavigationEntryImpl::RESTORE_NONE);
}
}
@@ -1228,8 +1225,8 @@ void NavigationController::LoadIfNecessary() {
NavigateToPendingEntry(NO_RELOAD);
}
-void NavigationController::NotifyEntryChanged(
- const content::NavigationEntry* entry, int index) {
+void NavigationController::NotifyEntryChanged(const NavigationEntry* entry,
+ int index) {
content::EntryChangedDetails det;
det.changed_entry = entry;
det.index = index;
@@ -1277,7 +1274,7 @@ int NavigationController::GetEntryIndexWithPageID(
return -1;
}
-content::NavigationEntry* NavigationController::GetTransientEntry() const {
+NavigationEntry* NavigationController::GetTransientEntry() const {
if (transient_entry_index_ == -1)
return NULL;
return entries_[transient_entry_index_].get();
@@ -1293,8 +1290,8 @@ void NavigationController::InsertEntriesFrom(
if (source.entries_[i].get()->GetPageType() !=
content::PAGE_TYPE_INTERSTITIAL) {
entries_.insert(entries_.begin() + insert_index++,
- linked_ptr<NavigationEntry>(
- new NavigationEntry(*source.entries_[i])));
+ linked_ptr<NavigationEntryImpl>(
+ new NavigationEntryImpl(*source.entries_[i])));
}
}
}
diff --git a/content/browser/tab_contents/navigation_controller.h b/content/browser/tab_contents/navigation_controller.h
index 79372a26..36a5ef9 100644
--- a/content/browser/tab_contents/navigation_controller.h
+++ b/content/browser/tab_contents/navigation_controller.h
@@ -21,7 +21,6 @@
#include "content/public/common/page_transition_types.h"
#include "content/public/common/referrer.h"
-class NavigationEntry;
class SessionStorageNamespace;
class SiteInstance;
class TabContents;
@@ -30,6 +29,7 @@ struct ViewHostMsg_FrameNavigate_Params;
namespace content {
class BrowserContext;
class NavigationEntry;
+class NavigationEntryImpl;
struct LoadCommittedDetails;
struct Referrer;
}
@@ -129,7 +129,7 @@ class CONTENT_EXPORT NavigationController {
// Returns the index of the specified entry, or -1 if entry is not contained
// in this NavigationController.
- int GetIndexOfEntry(const NavigationEntry* entry) const;
+ int GetIndexOfEntry(const content::NavigationEntryImpl* entry) const;
// Return the index of the entry with the corresponding instance and page_id,
// or -1 if not found.
@@ -138,8 +138,8 @@ class CONTENT_EXPORT NavigationController {
// Return the entry with the corresponding instance and page_id, or NULL if
// not found.
- NavigationEntry* GetEntryWithPageID(SiteInstance* instance,
- int32 page_id) const;
+ content::NavigationEntryImpl* GetEntryWithPageID(SiteInstance* instance,
+ int32 page_id) const;
// Pending entry -------------------------------------------------------------
@@ -165,7 +165,7 @@ class CONTENT_EXPORT NavigationController {
// represented as an entry, but should go away when the user navigates away
// from them.
// Note that adding a transient entry does not change the active contents.
- void AddTransientEntry(NavigationEntry* entry);
+ void AddTransientEntry(content::NavigationEntryImpl* entry);
// Returns the transient entry if any. Note that the returned entry is owned
// by the navigation controller and may be deleted at any time.
@@ -354,7 +354,7 @@ class CONTENT_EXPORT NavigationController {
bool is_renderer_initiated,
const std::string& extra_headers,
content::BrowserContext* browser_context);
- static NavigationEntry* CreateNavigationEntryImpl(
+ static content::NavigationEntryImpl* CreateNavigationEntryImpl(
const GURL& url,
const content::Referrer& referrer,
content::PageTransition transition,
@@ -374,7 +374,7 @@ class CONTENT_EXPORT NavigationController {
// Causes the controller to load the specified entry. The function assumes
// ownership of the pointer since it is put in the navigation list.
// NOTE: Do not pass an entry that the controller already owns!
- void LoadEntry(NavigationEntry* entry);
+ void LoadEntry(content::NavigationEntryImpl* entry);
// Handlers for the different types of navigation types. They will actually
// handle the navigations corresponding to the different NavClasses above.
@@ -413,7 +413,8 @@ class CONTENT_EXPORT NavigationController {
// Updates the virtual URL of an entry to match a new URL, for cases where
// the real renderer URL is derived from the virtual URL, like view-source:
- void UpdateVirtualURLToURL(NavigationEntry* entry, const GURL& new_url);
+ void UpdateVirtualURLToURL(content::NavigationEntryImpl* entry,
+ const GURL& new_url);
// Invoked after session/tab restore or cloning a tab. Resets the transition
// type of the entries, updates the max page id and creates the active
@@ -422,7 +423,7 @@ class CONTENT_EXPORT NavigationController {
// Inserts a new entry or replaces the current entry with a new one, removing
// all entries after it. The new entry will become the active one.
- void InsertOrReplaceEntry(NavigationEntry* entry, bool replace);
+ void InsertOrReplaceEntry(content::NavigationEntryImpl* entry, bool replace);
// Removes the entry at |index|, as long as it is not the current entry.
void RemoveEntryAtIndexInternal(int index);
@@ -452,7 +453,8 @@ class CONTENT_EXPORT NavigationController {
content::BrowserContext* browser_context_;
// List of NavigationEntry for this tab
- typedef std::vector<linked_ptr<NavigationEntry> > NavigationEntries;
+ typedef std::vector<linked_ptr<content::NavigationEntryImpl> >
+ NavigationEntries;
NavigationEntries entries_;
// An entry we haven't gotten a response for yet. This will be discarded
@@ -462,7 +464,7 @@ class CONTENT_EXPORT NavigationController {
// This may refer to an item in the entries_ list if the pending_entry_index_
// == -1, or it may be its own entry that should be deleted. Be careful with
// the memory management.
- NavigationEntry* pending_entry_;
+ content::NavigationEntryImpl* pending_entry_;
// currently visible entry
int last_committed_entry_index_;
diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc
index e533f5f..eb40586 100644
--- a/content/browser/tab_contents/navigation_controller_unittest.cc
+++ b/content/browser/tab_contents/navigation_controller_unittest.cc
@@ -19,7 +19,7 @@
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/navigation_controller.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/common/view_messages.h"
@@ -34,6 +34,8 @@
#include "webkit/glue/webkit_glue.h"
using base::Time;
+using content::NavigationEntry;
+using content::NavigationEntryImpl;
// NavigationControllerTest ----------------------------------------------------
@@ -727,7 +729,7 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) {
// We know all the entries have the same site instance, so we can just grab
// a random one for looking up other entries.
- SiteInstance* site_instance = NavigationEntry::FromNavigationEntry(
+ SiteInstance* site_instance = NavigationEntryImpl::FromNavigationEntry(
controller().GetLastCommittedEntry())->site_instance();
// That second URL should be the last committed and it should have gotten the
@@ -1475,7 +1477,7 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) {
TEST_F(NavigationControllerTest, RestoreNavigate) {
// Create a NavigationController with a restored set of tabs.
GURL url("http://foo");
- std::vector<content::NavigationEntry*> entries;
+ std::vector<NavigationEntry*> entries;
NavigationEntry* entry = NavigationController::CreateNavigationEntryImpl(
url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false,
std::string(), browser_context());
@@ -1491,10 +1493,10 @@ TEST_F(NavigationControllerTest, RestoreNavigate) {
// Before navigating to the restored entry, it should have a restore_type
// and no SiteInstance.
- EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION,
- NavigationEntry::FromNavigationEntry(
+ EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION,
+ NavigationEntryImpl::FromNavigationEntry(
our_controller.GetEntryAtIndex(0))->restore_type());
- EXPECT_FALSE(NavigationEntry::FromNavigationEntry(
+ EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry(
our_controller.GetEntryAtIndex(0))->site_instance());
// After navigating, we should have one entry, and it should be "pending".
@@ -1504,10 +1506,10 @@ TEST_F(NavigationControllerTest, RestoreNavigate) {
EXPECT_EQ(our_controller.GetEntryAtIndex(0),
our_controller.GetPendingEntry());
EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID());
- EXPECT_EQ(NavigationEntry::RESTORE_NONE,
- NavigationEntry::FromNavigationEntry
+ EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE,
+ NavigationEntryImpl::FromNavigationEntry
(our_controller.GetEntryAtIndex(0))->restore_type());
- EXPECT_TRUE(NavigationEntry::FromNavigationEntry(
+ EXPECT_TRUE(NavigationEntryImpl::FromNavigationEntry(
our_controller.GetEntryAtIndex(0))->site_instance());
// Say we navigated to that entry.
@@ -1529,11 +1531,11 @@ TEST_F(NavigationControllerTest, RestoreNavigate) {
EXPECT_EQ(0, our_controller.last_committed_entry_index());
EXPECT_FALSE(our_controller.GetPendingEntry());
EXPECT_EQ(url,
- NavigationEntry::FromNavigationEntry(
+ NavigationEntryImpl::FromNavigationEntry(
our_controller.GetLastCommittedEntry())->site_instance()->
site());
- EXPECT_EQ(NavigationEntry::RESTORE_NONE,
- NavigationEntry::FromNavigationEntry(
+ EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE,
+ NavigationEntryImpl::FromNavigationEntry(
our_controller.GetEntryAtIndex(0))->restore_type());
}
@@ -1542,7 +1544,7 @@ TEST_F(NavigationControllerTest, RestoreNavigate) {
TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) {
// Create a NavigationController with a restored set of tabs.
GURL url("http://foo");
- std::vector<content::NavigationEntry*> entries;
+ std::vector<NavigationEntry*> entries;
NavigationEntry* entry = NavigationController::CreateNavigationEntryImpl(
url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false,
std::string(), browser_context());
@@ -1558,10 +1560,10 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) {
// Before navigating to the restored entry, it should have a restore_type
// and no SiteInstance.
- EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION,
- NavigationEntry::FromNavigationEntry(
+ EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION,
+ NavigationEntryImpl::FromNavigationEntry(
our_controller.GetEntryAtIndex(0))->restore_type());
- EXPECT_FALSE(NavigationEntry::FromNavigationEntry(
+ EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry(
our_controller.GetEntryAtIndex(0))->site_instance());
// After navigating, we should have one entry, and it should be "pending".
@@ -1571,10 +1573,10 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) {
EXPECT_EQ(our_controller.GetEntryAtIndex(0),
our_controller.GetPendingEntry());
EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID());
- EXPECT_EQ(NavigationEntry::RESTORE_NONE,
- NavigationEntry::FromNavigationEntry(
+ EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE,
+ NavigationEntryImpl::FromNavigationEntry(
our_controller.GetEntryAtIndex(0))->restore_type());
- EXPECT_TRUE(NavigationEntry::FromNavigationEntry(
+ EXPECT_TRUE(NavigationEntryImpl::FromNavigationEntry(
our_controller.GetEntryAtIndex(0))->site_instance());
// This pending navigation may have caused a different navigation to fail,
@@ -1609,11 +1611,11 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) {
EXPECT_EQ(0, our_controller.last_committed_entry_index());
EXPECT_FALSE(our_controller.GetPendingEntry());
EXPECT_EQ(url,
- NavigationEntry::FromNavigationEntry(
+ NavigationEntryImpl::FromNavigationEntry(
our_controller.GetLastCommittedEntry())->site_instance()->
site());
- EXPECT_EQ(NavigationEntry::RESTORE_NONE,
- NavigationEntry::FromNavigationEntry(
+ EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE,
+ NavigationEntryImpl::FromNavigationEntry(
our_controller.GetEntryAtIndex(0))->restore_type());
}
@@ -1629,7 +1631,7 @@ TEST_F(NavigationControllerTest, Interstitial) {
const GURL url2("http://bar");
controller().LoadURL(
url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string());
- NavigationEntry::FromNavigationEntry(controller().GetPendingEntry())->
+ NavigationEntryImpl::FromNavigationEntry(controller().GetPendingEntry())->
set_page_type(content::PAGE_TYPE_INTERSTITIAL);
// At this point the interstitial will be displayed and the load will still
@@ -1717,7 +1719,7 @@ TEST_F(NavigationControllerTest, TransientEntry) {
notifications.Reset();
// Adding a transient with no pending entry.
- NavigationEntry* transient_entry = new NavigationEntry;
+ NavigationEntryImpl* transient_entry = new NavigationEntryImpl;
transient_entry->SetURL(transient_url);
controller().AddTransientEntry(transient_entry);
@@ -1745,7 +1747,7 @@ TEST_F(NavigationControllerTest, TransientEntry) {
EXPECT_EQ(controller().entry_count(), 3);
// Add a transient again, then navigate with no pending entry this time.
- transient_entry = new NavigationEntry;
+ transient_entry = new NavigationEntryImpl;
transient_entry->SetURL(transient_url);
controller().AddTransientEntry(transient_entry);
EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL());
@@ -1757,7 +1759,7 @@ TEST_F(NavigationControllerTest, TransientEntry) {
// Initiate a navigation, add a transient then commit navigation.
controller().LoadURL(
url4, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string());
- transient_entry = new NavigationEntry;
+ transient_entry = new NavigationEntryImpl;
transient_entry->SetURL(transient_url);
controller().AddTransientEntry(transient_entry);
EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL());
@@ -1766,7 +1768,7 @@ TEST_F(NavigationControllerTest, TransientEntry) {
EXPECT_EQ(controller().entry_count(), 5);
// Add a transient and go back. This should simply remove the transient.
- transient_entry = new NavigationEntry;
+ transient_entry = new NavigationEntryImpl;
transient_entry->SetURL(transient_url);
controller().AddTransientEntry(transient_entry);
EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL());
@@ -1779,7 +1781,7 @@ TEST_F(NavigationControllerTest, TransientEntry) {
rvh()->SendNavigate(3, url3);
// Add a transient and go to an entry before the current one.
- transient_entry = new NavigationEntry;
+ transient_entry = new NavigationEntryImpl;
transient_entry->SetURL(transient_url);
controller().AddTransientEntry(transient_entry);
EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL());
@@ -1792,7 +1794,7 @@ TEST_F(NavigationControllerTest, TransientEntry) {
EXPECT_EQ(url1, controller().GetVisibleEntry()->GetURL());
// Add a transient and go to an entry after the current one.
- transient_entry = new NavigationEntry;
+ transient_entry = new NavigationEntryImpl;
transient_entry->SetURL(transient_url);
controller().AddTransientEntry(transient_entry);
EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL());
@@ -1806,7 +1808,7 @@ TEST_F(NavigationControllerTest, TransientEntry) {
EXPECT_EQ(url2, controller().GetVisibleEntry()->GetURL());
// Add a transient and go forward.
- transient_entry = new NavigationEntry;
+ transient_entry = new NavigationEntryImpl;
transient_entry->SetURL(transient_url);
controller().AddTransientEntry(transient_entry);
EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL());
@@ -1853,7 +1855,7 @@ TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) {
EXPECT_EQ(url1, controller().GetActiveEntry()->GetURL());
EXPECT_EQ(url0, controller().GetVisibleEntry()->GetURL());
EXPECT_TRUE(
- NavigationEntry::FromNavigationEntry(controller().GetPendingEntry())->
+ NavigationEntryImpl::FromNavigationEntry(controller().GetPendingEntry())->
is_renderer_initiated());
// After commit, both should be updated, and we should no longer treat the
@@ -1862,7 +1864,7 @@ TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) {
EXPECT_EQ(url1, controller().GetActiveEntry()->GetURL());
EXPECT_EQ(url1, controller().GetVisibleEntry()->GetURL());
EXPECT_FALSE(
- NavigationEntry::FromNavigationEntry(
+ NavigationEntryImpl::FromNavigationEntry(
controller().GetLastCommittedEntry())->is_renderer_initiated());
notifications.Reset();
@@ -1951,7 +1953,7 @@ TEST_F(NavigationControllerTest, CloneOmitsInterstitials) {
NavigateAndCommit(url2);
// Add an interstitial entry. Should be deleted with controller.
- NavigationEntry* interstitial_entry = new NavigationEntry();
+ NavigationEntryImpl* interstitial_entry = new NavigationEntryImpl();
interstitial_entry->set_page_type(content::PAGE_TYPE_INTERSTITIAL);
controller().AddTransientEntry(interstitial_entry);
@@ -2009,7 +2011,7 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune) {
NavigationController& other_controller = other_contents->GetController();
other_contents->NavigateAndCommit(url3);
other_contents->ExpectSetHistoryLengthAndPrune(
- NavigationEntry::FromNavigationEntry(
+ NavigationEntryImpl::FromNavigationEntry(
other_controller.GetEntryAtIndex(0))->site_instance(), 2,
other_controller.GetEntryAtIndex(0)->GetPageID());
other_controller.CopyStateFromAndPrune(&controller());
@@ -2208,7 +2210,7 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForTransient) {
rvh()->SendNavigate(1, url1);
// Adding a transient with no pending entry.
- NavigationEntry* transient_entry = new NavigationEntry;
+ NavigationEntryImpl* transient_entry = new NavigationEntryImpl;
transient_entry->SetURL(transient_url);
controller().AddTransientEntry(transient_entry);
diff --git a/content/browser/tab_contents/navigation_entry.cc b/content/browser/tab_contents/navigation_entry_impl.cc
index 4649514..e0b924c 100644
--- a/content/browser/tab_contents/navigation_entry.cc
+++ b/content/browser/tab_contents/navigation_entry_impl.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -12,9 +12,6 @@
#include "net/base/net_util.h"
#include "ui/base/text/text_elider.h"
-using content::FaviconStatus;
-using content::SSLStatus;
-
// Use this to get a new unique ID for a NavigationEntry during construction.
// The returned ID is guaranteed to be nonzero (which is the "no ID" indicator).
static int GetUniqueIDInConstructor() {
@@ -25,42 +22,40 @@ static int GetUniqueIDInConstructor() {
namespace content {
NavigationEntry* NavigationEntry::Create() {
- return new ::NavigationEntry();
+ return new NavigationEntryImpl();
}
NavigationEntry* NavigationEntry::Create(const NavigationEntry& copy) {
- return new ::NavigationEntry(static_cast<const ::NavigationEntry&>(copy));
-}
-
+ return new NavigationEntryImpl(static_cast<const NavigationEntryImpl&>(copy));
}
-NavigationEntry* NavigationEntry::FromNavigationEntry(
- content::NavigationEntry* entry) {
- return static_cast<NavigationEntry*>(entry);
+NavigationEntryImpl* NavigationEntryImpl::FromNavigationEntry(
+ NavigationEntry* entry) {
+ return static_cast<NavigationEntryImpl*>(entry);
}
-NavigationEntry::NavigationEntry()
+NavigationEntryImpl::NavigationEntryImpl()
: unique_id_(GetUniqueIDInConstructor()),
site_instance_(NULL),
- page_type_(content::PAGE_TYPE_NORMAL),
+ page_type_(PAGE_TYPE_NORMAL),
update_virtual_url_with_url_(false),
page_id_(-1),
- transition_type_(content::PAGE_TRANSITION_LINK),
+ transition_type_(PAGE_TRANSITION_LINK),
has_post_data_(false),
restore_type_(RESTORE_NONE),
is_renderer_initiated_(false) {
}
-NavigationEntry::NavigationEntry(SiteInstance* instance,
- int page_id,
- const GURL& url,
- const content::Referrer& referrer,
- const string16& title,
- content::PageTransition transition_type,
- bool is_renderer_initiated)
+NavigationEntryImpl::NavigationEntryImpl(SiteInstance* instance,
+ int page_id,
+ const GURL& url,
+ const Referrer& referrer,
+ const string16& title,
+ PageTransition transition_type,
+ bool is_renderer_initiated)
: unique_id_(GetUniqueIDInConstructor()),
site_instance_(instance),
- page_type_(content::PAGE_TYPE_NORMAL),
+ page_type_(PAGE_TYPE_NORMAL),
url_(url),
referrer_(referrer),
update_virtual_url_with_url_(false),
@@ -72,73 +67,73 @@ NavigationEntry::NavigationEntry(SiteInstance* instance,
is_renderer_initiated_(is_renderer_initiated) {
}
-NavigationEntry::~NavigationEntry() {
+NavigationEntryImpl::~NavigationEntryImpl() {
}
-int NavigationEntry::GetUniqueID() const {
+int NavigationEntryImpl::GetUniqueID() const {
return unique_id_;
}
-content::PageType NavigationEntry::GetPageType() const {
+PageType NavigationEntryImpl::GetPageType() const {
return page_type_;
}
-void NavigationEntry::SetURL(const GURL& url) {
+void NavigationEntryImpl::SetURL(const GURL& url) {
url_ = url;
cached_display_title_.clear();
}
-const GURL& NavigationEntry::GetURL() const {
+const GURL& NavigationEntryImpl::GetURL() const {
return url_;
}
-void NavigationEntry::SetReferrer(const content::Referrer& referrer) {
+void NavigationEntryImpl::SetReferrer(const Referrer& referrer) {
referrer_ = referrer;
}
-const content::Referrer& NavigationEntry::GetReferrer() const {
+const Referrer& NavigationEntryImpl::GetReferrer() const {
return referrer_;
}
-void NavigationEntry::SetVirtualURL(const GURL& url) {
+void NavigationEntryImpl::SetVirtualURL(const GURL& url) {
virtual_url_ = (url == url_) ? GURL() : url;
cached_display_title_.clear();
}
-const GURL& NavigationEntry::GetVirtualURL() const {
+const GURL& NavigationEntryImpl::GetVirtualURL() const {
return virtual_url_.is_empty() ? url_ : virtual_url_;
}
-void NavigationEntry::SetTitle(const string16& title) {
+void NavigationEntryImpl::SetTitle(const string16& title) {
title_ = title;
cached_display_title_.clear();
}
-const string16& NavigationEntry::GetTitle() const {
+const string16& NavigationEntryImpl::GetTitle() const {
return title_;
}
-void NavigationEntry::SetContentState(const std::string& state) {
+void NavigationEntryImpl::SetContentState(const std::string& state) {
content_state_ = state;
}
-const std::string& NavigationEntry::GetContentState() const {
+const std::string& NavigationEntryImpl::GetContentState() const {
return content_state_;
}
-void NavigationEntry::SetPageID(int page_id) {
+void NavigationEntryImpl::SetPageID(int page_id) {
page_id_ = page_id;
}
-int32 NavigationEntry::GetPageID() const {
+int32 NavigationEntryImpl::GetPageID() const {
return page_id_;
}
-void NavigationEntry::set_site_instance(SiteInstance* site_instance) {
+void NavigationEntryImpl::set_site_instance(SiteInstance* site_instance) {
site_instance_ = site_instance;
}
-const string16& NavigationEntry::GetTitleForDisplay(
+const string16& NavigationEntryImpl::GetTitleForDisplay(
const std::string& languages) const {
// Most pages have real titles. Don't even bother caching anything if this is
// the case.
@@ -165,47 +160,49 @@ const string16& NavigationEntry::GetTitleForDisplay(
title = title.substr(slashpos + 1);
}
- ui::ElideString(title, content::kMaxTitleChars, &cached_display_title_);
+ ui::ElideString(title, kMaxTitleChars, &cached_display_title_);
return cached_display_title_;
}
-bool NavigationEntry::IsViewSourceMode() const {
+bool NavigationEntryImpl::IsViewSourceMode() const {
return virtual_url_.SchemeIs(chrome::kViewSourceScheme);
}
-void NavigationEntry::SetTransitionType(
- content::PageTransition transition_type) {
+void NavigationEntryImpl::SetTransitionType(
+ PageTransition transition_type) {
transition_type_ = transition_type;
}
-content::PageTransition NavigationEntry::GetTransitionType() const {
+PageTransition NavigationEntryImpl::GetTransitionType() const {
return transition_type_;
}
-const GURL& NavigationEntry::GetUserTypedURL() const {
+const GURL& NavigationEntryImpl::GetUserTypedURL() const {
return user_typed_url_;
}
-void NavigationEntry::SetHasPostData(bool has_post_data) {
+void NavigationEntryImpl::SetHasPostData(bool has_post_data) {
has_post_data_ = has_post_data;
}
-bool NavigationEntry::GetHasPostData() const {
+bool NavigationEntryImpl::GetHasPostData() const {
return has_post_data_;
}
-const FaviconStatus& NavigationEntry::GetFavicon() const {
+const FaviconStatus& NavigationEntryImpl::GetFavicon() const {
return favicon_;
}
-FaviconStatus& NavigationEntry::GetFavicon() {
+FaviconStatus& NavigationEntryImpl::GetFavicon() {
return favicon_;
}
-const SSLStatus& NavigationEntry::GetSSL() const {
+const SSLStatus& NavigationEntryImpl::GetSSL() const {
return ssl_;
}
-SSLStatus& NavigationEntry::GetSSL() {
+SSLStatus& NavigationEntryImpl::GetSSL() {
return ssl_;
}
+
+} // namespace content
diff --git a/content/browser/tab_contents/navigation_entry.h b/content/browser/tab_contents/navigation_entry_impl.h
index d2e18dd..4032441 100644
--- a/content/browser/tab_contents/navigation_entry.h
+++ b/content/browser/tab_contents/navigation_entry_impl.h
@@ -2,12 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_
-#define CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_
+#ifndef CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_
+#define CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_
#pragma once
#include "base/basictypes.h"
-#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/global_request_id.h"
@@ -16,29 +15,29 @@
class SiteInstance;
-class CONTENT_EXPORT NavigationEntry
- : public NON_EXPORTED_BASE(content::NavigationEntry) {
- public:
-
- static NavigationEntry* FromNavigationEntry(content::NavigationEntry* entry);
-
- NavigationEntry();
- NavigationEntry(SiteInstance* instance,
- int page_id,
- const GURL& url,
- const content::Referrer& referrer,
- const string16& title,
- content::PageTransition transition_type,
- bool is_renderer_initiated);
- virtual ~NavigationEntry();
+namespace content {
- // content::NavigationEntry implementation:
+class NavigationEntryImpl : public NavigationEntry {
+ public:
+ static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry);
+
+ NavigationEntryImpl();
+ NavigationEntryImpl(SiteInstance* instance,
+ int page_id,
+ const GURL& url,
+ const Referrer& referrer,
+ const string16& title,
+ PageTransition transition_type,
+ bool is_renderer_initiated);
+ virtual ~NavigationEntryImpl();
+
+ // NavigationEntry implementation:
virtual int GetUniqueID() const OVERRIDE;
- virtual content::PageType GetPageType() const OVERRIDE;
+ virtual PageType GetPageType() const OVERRIDE;
virtual void SetURL(const GURL& url) OVERRIDE;
virtual const GURL& GetURL() const OVERRIDE;
- virtual void SetReferrer(const content::Referrer& referrer) OVERRIDE;
- virtual const content::Referrer& GetReferrer() const OVERRIDE;
+ virtual void SetReferrer(const Referrer& referrer) OVERRIDE;
+ virtual const Referrer& GetReferrer() const OVERRIDE;
virtual void SetVirtualURL(const GURL& url) OVERRIDE;
virtual const GURL& GetVirtualURL() const OVERRIDE;
virtual void SetTitle(const string16& title) OVERRIDE;
@@ -50,16 +49,15 @@ class CONTENT_EXPORT NavigationEntry
virtual const string16& GetTitleForDisplay(
const std::string& languages) const OVERRIDE;
virtual bool IsViewSourceMode() const OVERRIDE;
- virtual void SetTransitionType(
- content::PageTransition transition_type) OVERRIDE;
- virtual content::PageTransition GetTransitionType() const OVERRIDE;
+ virtual void SetTransitionType(PageTransition transition_type) OVERRIDE;
+ virtual PageTransition GetTransitionType() const OVERRIDE;
virtual const GURL& GetUserTypedURL() const OVERRIDE;
virtual void SetHasPostData(bool has_post_data) OVERRIDE;
virtual bool GetHasPostData() const OVERRIDE;
- virtual const content::FaviconStatus& GetFavicon() const OVERRIDE;
- virtual content::FaviconStatus& GetFavicon() OVERRIDE;
- virtual const content::SSLStatus& GetSSL() const OVERRIDE;
- virtual content::SSLStatus& GetSSL() OVERRIDE;
+ virtual const FaviconStatus& GetFavicon() const OVERRIDE;
+ virtual FaviconStatus& GetFavicon() OVERRIDE;
+ virtual const SSLStatus& GetSSL() const OVERRIDE;
+ virtual SSLStatus& GetSSL() OVERRIDE;
void set_unique_id(int unique_id) {
unique_id_ = unique_id;
@@ -77,7 +75,7 @@ class CONTENT_EXPORT NavigationEntry
return site_instance_;
}
- void set_page_type(content::PageType page_type) {
+ void set_page_type(PageType page_type) {
page_type_ = page_type;
}
@@ -136,11 +134,11 @@ class CONTENT_EXPORT NavigationEntry
}
void set_transferred_global_request_id(
- const content::GlobalRequestID& transferred_global_request_id) {
+ const GlobalRequestID& transferred_global_request_id) {
transferred_global_request_id_ = transferred_global_request_id;
}
- content::GlobalRequestID transferred_global_request_id() const {
+ GlobalRequestID transferred_global_request_id() const {
return transferred_global_request_id_;
}
@@ -154,17 +152,17 @@ class CONTENT_EXPORT NavigationEntry
// See the accessors above for descriptions.
int unique_id_;
scoped_refptr<SiteInstance> site_instance_;
- content::PageType page_type_;
+ PageType page_type_;
GURL url_;
- content::Referrer referrer_;
+ Referrer referrer_;
GURL virtual_url_;
bool update_virtual_url_with_url_;
string16 title_;
- content::FaviconStatus favicon_;
+ FaviconStatus favicon_;
std::string content_state_;
int32 page_id_;
- content::SSLStatus ssl_;
- content::PageTransition transition_type_;
+ SSLStatus ssl_;
+ PageTransition transition_type_;
GURL user_typed_url_;
bool has_post_data_;
RestoreType restore_type_;
@@ -190,9 +188,11 @@ class CONTENT_EXPORT NavigationEntry
// carries this |transferred_global_request_id_| annotation. Once the request
// is transferred to the new process, this is cleared and the request
// continues as normal.
- content::GlobalRequestID transferred_global_request_id_;
+ GlobalRequestID transferred_global_request_id_;
// Copy and assignment is explicitly allowed for this class.
};
-#endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_
+} // namespace content
+
+#endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_
diff --git a/content/browser/tab_contents/navigation_entry_unittest.cc b/content/browser/tab_contents/navigation_entry_impl_unittest.cc
index 2e8712d..dc8d9e9 100644
--- a/content/browser/tab_contents/navigation_entry_unittest.cc
+++ b/content/browser/tab_contents/navigation_entry_impl_unittest.cc
@@ -6,11 +6,11 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "content/browser/site_instance.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/public/browser/ssl_status.h"
#include "testing/gtest/include/gtest/gtest.h"
-using content::SSLStatus;
+namespace content {
class NavigationEntryTest : public testing::Test {
public:
@@ -18,15 +18,15 @@ class NavigationEntryTest : public testing::Test {
}
virtual void SetUp() {
- entry1_.reset(new NavigationEntry);
+ entry1_.reset(new NavigationEntryImpl);
instance_ = SiteInstance::CreateSiteInstance(NULL);
- entry2_.reset(new NavigationEntry(
+ entry2_.reset(new NavigationEntryImpl(
instance_, 3,
GURL("test:url"),
- content::Referrer(GURL("from"), WebKit::WebReferrerPolicyDefault),
+ Referrer(GURL("from"), WebKit::WebReferrerPolicyDefault),
ASCIIToUTF16("title"),
- content::PAGE_TRANSITION_TYPED,
+ PAGE_TRANSITION_TYPED,
false));
}
@@ -34,8 +34,8 @@ class NavigationEntryTest : public testing::Test {
}
protected:
- scoped_ptr<NavigationEntry> entry1_;
- scoped_ptr<NavigationEntry> entry2_;
+ scoped_ptr<NavigationEntryImpl> entry1_;
+ scoped_ptr<NavigationEntryImpl> entry2_;
// SiteInstances are deleted when their NavigationEntries are gone.
SiteInstance* instance_;
};
@@ -101,10 +101,8 @@ TEST_F(NavigationEntryTest, NavigationEntryFavicons) {
// Test SSLStatus inner class
TEST_F(NavigationEntryTest, NavigationEntrySSLStatus) {
// Default (unknown)
- EXPECT_EQ(content::SECURITY_STYLE_UNKNOWN,
- entry1_.get()->GetSSL().security_style);
- EXPECT_EQ(content::SECURITY_STYLE_UNKNOWN,
- entry2_.get()->GetSSL().security_style);
+ EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry1_.get()->GetSSL().security_style);
+ EXPECT_EQ(SECURITY_STYLE_UNKNOWN, entry2_.get()->GetSSL().security_style);
EXPECT_EQ(0, entry1_.get()->GetSSL().cert_id);
EXPECT_EQ(0U, entry1_.get()->GetSSL().cert_status);
EXPECT_EQ(-1, entry1_.get()->GetSSL().security_bits);
@@ -122,16 +120,16 @@ TEST_F(NavigationEntryTest, NavigationEntryAccessors) {
EXPECT_EQ(instance_, entry1_.get()->site_instance());
// Page type
- EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry1_.get()->GetPageType());
- EXPECT_EQ(content::PAGE_TYPE_NORMAL, entry2_.get()->GetPageType());
- entry2_.get()->set_page_type(content::PAGE_TYPE_INTERSTITIAL);
- EXPECT_EQ(content::PAGE_TYPE_INTERSTITIAL, entry2_.get()->GetPageType());
+ EXPECT_EQ(PAGE_TYPE_NORMAL, entry1_.get()->GetPageType());
+ EXPECT_EQ(PAGE_TYPE_NORMAL, entry2_.get()->GetPageType());
+ entry2_.get()->set_page_type(PAGE_TYPE_INTERSTITIAL);
+ EXPECT_EQ(PAGE_TYPE_INTERSTITIAL, entry2_.get()->GetPageType());
// Referrer
EXPECT_EQ(GURL(), entry1_.get()->GetReferrer().url);
EXPECT_EQ(GURL("from"), entry2_.get()->GetReferrer().url);
entry2_.get()->SetReferrer(
- content::Referrer(GURL("from2"), WebKit::WebReferrerPolicyDefault));
+ Referrer(GURL("from2"), WebKit::WebReferrerPolicyDefault));
EXPECT_EQ(GURL("from2"), entry2_.get()->GetReferrer().url);
// Title
@@ -153,11 +151,10 @@ TEST_F(NavigationEntryTest, NavigationEntryAccessors) {
EXPECT_EQ(2, entry2_.get()->GetPageID());
// Transition type
- EXPECT_EQ(content::PAGE_TRANSITION_LINK, entry1_.get()->GetTransitionType());
- EXPECT_EQ(content::PAGE_TRANSITION_TYPED, entry2_.get()->GetTransitionType());
- entry2_.get()->SetTransitionType(content::PAGE_TRANSITION_RELOAD);
- EXPECT_EQ(content::PAGE_TRANSITION_RELOAD,
- entry2_.get()->GetTransitionType());
+ EXPECT_EQ(PAGE_TRANSITION_LINK, entry1_.get()->GetTransitionType());
+ EXPECT_EQ(PAGE_TRANSITION_TYPED, entry2_.get()->GetTransitionType());
+ entry2_.get()->SetTransitionType(PAGE_TRANSITION_RELOAD);
+ EXPECT_EQ(PAGE_TRANSITION_RELOAD, entry2_.get()->GetTransitionType());
// Is renderer initiated
EXPECT_FALSE(entry1_.get()->is_renderer_initiated());
@@ -172,8 +169,10 @@ TEST_F(NavigationEntryTest, NavigationEntryAccessors) {
EXPECT_TRUE(entry2_.get()->GetHasPostData());
// Restored
- EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type());
- EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type());
- entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION);
- EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type());
+ EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, entry1_->restore_type());
+ EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, entry2_->restore_type());
+ entry2_->set_restore_type(NavigationEntryImpl::RESTORE_LAST_SESSION);
+ EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, entry2_->restore_type());
}
+
+} // namespace content
diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc
index 3cd70f2..4c4c636 100644
--- a/content/browser/tab_contents/render_view_host_manager.cc
+++ b/content/browser/tab_contents/render_view_host_manager.cc
@@ -13,7 +13,7 @@
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/navigation_controller.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/browser/webui/web_ui.h"
#include "content/browser/webui/web_ui_factory.h"
@@ -24,9 +24,8 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
-namespace base {
-class WaitableEvent;
-}
+using content::NavigationEntry;
+using content::NavigationEntryImpl;
RenderViewHostManager::RenderViewHostManager(
RenderViewHostDelegate* render_view_delegate,
@@ -79,7 +78,8 @@ RenderWidgetHostView* RenderViewHostManager::GetRenderWidgetHostView() const {
return render_view_host_->view();
}
-RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) {
+RenderViewHost* RenderViewHostManager::Navigate(
+ const NavigationEntryImpl& entry) {
// Create a pending RenderViewHost. It will give us the one we should use
RenderViewHost* dest_render_view_host = UpdateRendererStateForNavigate(entry);
if (!dest_render_view_host)
@@ -329,8 +329,8 @@ bool RenderViewHostManager::ShouldTransitionCrossSite() {
}
bool RenderViewHostManager::ShouldSwapProcessesForNavigation(
- const content::NavigationEntry* cur_entry,
- const NavigationEntry* new_entry) const {
+ const NavigationEntry* cur_entry,
+ const NavigationEntryImpl* new_entry) const {
DCHECK(new_entry);
// Check for reasons to swap processes even if we are in a process model that
@@ -374,7 +374,7 @@ bool RenderViewHostManager::ShouldSwapProcessesForNavigation(
}
SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
- const NavigationEntry& entry,
+ const NavigationEntryImpl& entry,
SiteInstance* curr_instance) {
// NOTE: This is only called when ShouldTransitionCrossSite is true.
@@ -429,7 +429,7 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
// In the case of session restore, as it loads all the pages immediately
// we need to set the site first, otherwise after a restore none of the
// pages would share renderers in process-per-site.
- if (entry.restore_type() != NavigationEntry::RESTORE_NONE)
+ if (entry.restore_type() != NavigationEntryImpl::RESTORE_NONE)
curr_instance->SetSite(dest_url);
return curr_instance;
@@ -445,7 +445,7 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
// For now, though, we're in a hybrid model where you only switch
// SiteInstances if you type in a cross-site URL. This means we have to
// compare the entry's URL to the last committed entry's URL.
- content::NavigationEntry* curr_entry = controller.GetLastCommittedEntry();
+ NavigationEntry* curr_entry = controller.GetLastCommittedEntry();
if (interstitial_page_) {
// The interstitial is currently the last committed entry, but we want to
// compare against the last non-interstitial entry.
@@ -489,8 +489,8 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
}
bool RenderViewHostManager::CreatePendingRenderView(
- const NavigationEntry& entry, SiteInstance* instance) {
- content::NavigationEntry* curr_entry =
+ const NavigationEntryImpl& entry, SiteInstance* instance) {
+ NavigationEntry* curr_entry =
delegate_->GetControllerForRenderManager().GetLastCommittedEntry();
if (curr_entry) {
DCHECK(!curr_entry->GetContentState().empty());
@@ -531,7 +531,7 @@ bool RenderViewHostManager::CreatePendingRenderView(
}
bool RenderViewHostManager::InitRenderView(RenderViewHost* render_view_host,
- const NavigationEntry& entry) {
+ const NavigationEntryImpl& entry) {
// If the pending navigation is to a WebUI, tell the RenderView about any
// bindings it will need enabled.
if (pending_web_ui_.get())
@@ -636,7 +636,7 @@ void RenderViewHostManager::CommitPending() {
}
RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate(
- const NavigationEntry& entry) {
+ const NavigationEntryImpl& entry) {
// If we are cross-navigating, then we want to get back to normal and navigate
// as usual.
if (cross_navigation_pending_) {
diff --git a/content/browser/tab_contents/render_view_host_manager.h b/content/browser/tab_contents/render_view_host_manager.h
index 4c524f7..a8051f2 100644
--- a/content/browser/tab_contents/render_view_host_manager.h
+++ b/content/browser/tab_contents/render_view_host_manager.h
@@ -17,7 +17,6 @@
class InterstitialPage;
class NavigationController;
-class NavigationEntry;
class RenderViewHost;
class RenderWidgetHostView;
class WebUI;
@@ -25,6 +24,7 @@ class WebUI;
namespace content {
class BrowserContext;
class NavigationEntry;
+class NavigationEntryImpl;
}
// Manages RenderViewHosts for a TabContents. Normally there is only one and
@@ -132,7 +132,7 @@ class CONTENT_EXPORT RenderViewHostManager
// navigation entry. It may create a new RenderViewHost or re-use an existing
// one. The RenderViewHost to navigate will be returned. Returns NULL if one
// could not be created.
- RenderViewHost* Navigate(const NavigationEntry& entry);
+ RenderViewHost* Navigate(const content::NavigationEntryImpl& entry);
// Instructs the various live views to stop. Called when the user directed the
// page to stop loading.
@@ -215,23 +215,24 @@ class CONTENT_EXPORT RenderViewHostManager
// Either of the entries may be NULL.
bool ShouldSwapProcessesForNavigation(
const content::NavigationEntry* cur_entry,
- const NavigationEntry* new_entry) const;
+ const content::NavigationEntryImpl* new_entry) const;
// Returns an appropriate SiteInstance object for the given NavigationEntry,
// possibly reusing the current SiteInstance.
// Never called if --process-per-tab is used.
- SiteInstance* GetSiteInstanceForEntry(const NavigationEntry& entry,
- SiteInstance* curr_instance);
+ SiteInstance* GetSiteInstanceForEntry(
+ const content::NavigationEntryImpl& entry,
+ SiteInstance* curr_instance);
// Helper method to create a pending RenderViewHost for a cross-site
// navigation.
- bool CreatePendingRenderView(const NavigationEntry& entry,
+ bool CreatePendingRenderView(const content::NavigationEntryImpl& entry,
SiteInstance* instance);
// Sets up the necessary state for a new RenderViewHost navigating to the
// given entry.
bool InitRenderView(RenderViewHost* render_view_host,
- const NavigationEntry& entry);
+ const content::NavigationEntryImpl& entry);
// Sets the pending RenderViewHost/WebUI to be the active one. Note that this
// doesn't require the pending render_view_host_ pointer to be non-NULL, since
@@ -241,7 +242,8 @@ class CONTENT_EXPORT RenderViewHostManager
// Helper method to terminate the pending RenderViewHost.
void CancelPending();
- RenderViewHost* UpdateRendererStateForNavigate(const NavigationEntry& entry);
+ RenderViewHost* UpdateRendererStateForNavigate(
+ const content::NavigationEntryImpl& entry);
// Called when a renderer process is starting to close. We should not
// schedule new navigations in its swapped out RenderViewHosts after this.
diff --git a/content/browser/tab_contents/render_view_host_manager_unittest.cc b/content/browser/tab_contents/render_view_host_manager_unittest.cc
index 497cd5f..6ad75931 100644
--- a/content/browser/tab_contents/render_view_host_manager_unittest.cc
+++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc
@@ -8,7 +8,7 @@
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/navigation_controller.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/render_view_host_manager.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/browser/webui/empty_web_ui_factory.h"
@@ -27,6 +27,8 @@
using content::BrowserThread;
using content::BrowserThreadImpl;
+using content::NavigationEntry;
+using content::NavigationEntryImpl;
namespace {
@@ -139,8 +141,8 @@ class RenderViewHostManagerTest : public RenderViewHostTestHarness {
}
bool ShouldSwapProcesses(RenderViewHostManager* manager,
- const NavigationEntry* cur_entry,
- const NavigationEntry* new_entry) const {
+ const NavigationEntryImpl* cur_entry,
+ const NavigationEntryImpl* new_entry) const {
return manager->ShouldSwapProcessesForNavigation(cur_entry, new_entry);
}
@@ -303,10 +305,10 @@ TEST_F(RenderViewHostManagerTest, Navigate) {
// 1) The first navigation. --------------------------
const GURL kUrl1("http://www.google.com/");
- NavigationEntry entry1(NULL /* instance */, -1 /* page_id */, kUrl1,
- content::Referrer(), string16() /* title */,
- content::PAGE_TRANSITION_TYPED,
- false /* is_renderer_init */);
+ NavigationEntryImpl entry1(
+ NULL /* instance */, -1 /* page_id */, kUrl1, content::Referrer(),
+ string16() /* title */, content::PAGE_TRANSITION_TYPED,
+ false /* is_renderer_init */);
host = manager.Navigate(entry1);
// The RenderViewHost created in Init will be reused.
@@ -323,7 +325,7 @@ TEST_F(RenderViewHostManagerTest, Navigate) {
// 2) Navigate to next site. -------------------------
const GURL kUrl2("http://www.google.com/foo");
- NavigationEntry entry2(
+ NavigationEntryImpl entry2(
NULL /* instance */, -1 /* page_id */, kUrl2,
content::Referrer(kUrl1, WebKit::WebReferrerPolicyDefault),
string16() /* title */, content::PAGE_TRANSITION_LINK,
@@ -342,7 +344,7 @@ TEST_F(RenderViewHostManagerTest, Navigate) {
// 3) Cross-site navigate to next site. --------------
const GURL kUrl3("http://webkit.org/");
- NavigationEntry entry3(
+ NavigationEntryImpl entry3(
NULL /* instance */, -1 /* page_id */, kUrl3,
content::Referrer(kUrl2, WebKit::WebReferrerPolicyDefault),
string16() /* title */, content::PAGE_TRANSITION_LINK,
@@ -389,10 +391,10 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) {
// 1) The first navigation. --------------------------
const GURL kUrl1("http://www.google.com/");
- NavigationEntry entry1(NULL /* instance */, -1 /* page_id */, kUrl1,
- content::Referrer(), string16() /* title */,
- content::PAGE_TRANSITION_TYPED,
- false /* is_renderer_init */);
+ NavigationEntryImpl entry1(NULL /* instance */, -1 /* page_id */, kUrl1,
+ content::Referrer(), string16() /* title */,
+ content::PAGE_TRANSITION_TYPED,
+ false /* is_renderer_init */);
RenderViewHost* host = manager.Navigate(entry1);
// The RenderViewHost created in Init will be reused.
@@ -415,10 +417,10 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) {
// 2) Cross-site navigate to next site. -------------------------
const GURL kUrl2("http://www.example.com");
- NavigationEntry entry2(NULL /* instance */, -1 /* page_id */, kUrl2,
- content::Referrer(), string16() /* title */,
- content::PAGE_TRANSITION_TYPED,
- false /* is_renderer_init */);
+ NavigationEntryImpl entry2(
+ NULL /* instance */, -1 /* page_id */, kUrl2, content::Referrer(),
+ string16() /* title */, content::PAGE_TRANSITION_TYPED,
+ false /* is_renderer_init */);
RenderViewHost* host2 = manager.Navigate(entry2);
// A new RenderViewHost should be created.
@@ -463,10 +465,10 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) {
// 3) Cross-site navigate to next site before 2) has committed. --------------
const GURL kUrl3("http://webkit.org/");
- NavigationEntry entry3(NULL /* instance */, -1 /* page_id */, kUrl3,
- content::Referrer(), string16() /* title */,
- content::PAGE_TRANSITION_TYPED,
- false /* is_renderer_init */);
+ NavigationEntryImpl entry3(NULL /* instance */, -1 /* page_id */, kUrl3,
+ content::Referrer(), string16() /* title */,
+ content::PAGE_TRANSITION_TYPED,
+ false /* is_renderer_init */);
RenderViewHost* host3 = manager.Navigate(entry3);
// A new RenderViewHost should be created.
@@ -515,10 +517,10 @@ TEST_F(RenderViewHostManagerTest, WebUI) {
manager.Init(browser_context(), instance, MSG_ROUTING_NONE);
const GURL kUrl(chrome::kTestNewTabURL);
- NavigationEntry entry(NULL /* instance */, -1 /* page_id */, kUrl,
- content::Referrer(), string16() /* title */,
- content::PAGE_TRANSITION_TYPED,
- false /* is_renderer_init */);
+ NavigationEntryImpl entry(NULL /* instance */, -1 /* page_id */, kUrl,
+ content::Referrer(), string16() /* title */,
+ content::PAGE_TRANSITION_TYPED,
+ false /* is_renderer_init */);
RenderViewHost* host = manager.Navigate(entry);
EXPECT_TRUE(host);
@@ -554,17 +556,17 @@ TEST_F(RenderViewHostManagerTest, NonWebUIChromeURLs) {
// NTP is a Web UI page.
const GURL kNtpUrl(chrome::kTestNewTabURL);
- NavigationEntry ntp_entry(NULL /* instance */, -1 /* page_id */, kNtpUrl,
- content::Referrer(), string16() /* title */,
- content::PAGE_TRANSITION_TYPED,
- false /* is_renderer_init */);
+ NavigationEntryImpl ntp_entry(NULL /* instance */, -1 /* page_id */, kNtpUrl,
+ content::Referrer(), string16() /* title */,
+ content::PAGE_TRANSITION_TYPED,
+ false /* is_renderer_init */);
// A URL with the Chrome UI scheme, that isn't handled by Web UI.
GURL about_url(kChromeUISchemeButNotWebUIURL);
- NavigationEntry about_entry(NULL /* instance */, -1 /* page_id */, about_url,
- content::Referrer(), string16() /* title */,
- content::PAGE_TRANSITION_TYPED,
- false /* is_renderer_init */);
+ NavigationEntryImpl about_entry(
+ NULL /* instance */, -1 /* page_id */, about_url,
+ content::Referrer(), string16() /* title */,
+ content::PAGE_TRANSITION_TYPED, false /* is_renderer_init */);
EXPECT_TRUE(ShouldSwapProcesses(&manager, &ntp_entry, &about_entry));
}
@@ -610,8 +612,7 @@ TEST_F(RenderViewHostManagerTest, PageDoesBackAndReload) {
EXPECT_EQ(evil_rvh, contents()->GetRenderManagerForTesting()->current_host());
// Also we should not have a pending navigation entry.
- content::NavigationEntry* entry =
- contents()->GetController().GetActiveEntry();
+ NavigationEntry* entry = contents()->GetController().GetActiveEntry();
ASSERT_TRUE(entry != NULL);
EXPECT_EQ(kUrl2, entry->GetURL());
}
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 215dcde..b7b5b05 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -28,7 +28,7 @@
#include "content/browser/renderer_host/resource_request_details.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/interstitial_page.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/provisional_load_details.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/browser/tab_contents/title_updated_details.h"
@@ -112,6 +112,8 @@ using content::DevToolsManagerImpl;
using content::DownloadItem;
using content::DownloadManager;
using content::GlobalRequestID;
+using content::NavigationEntry;
+using content::NavigationEntryImpl;
using content::OpenURLParams;
using content::SSLStatus;
using content::UserMetricsAction;
@@ -139,7 +141,7 @@ BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) {
#endif
ViewMsg_Navigate_Type::Value GetNavigationType(
- content::BrowserContext* browser_context, const NavigationEntry& entry,
+ content::BrowserContext* browser_context, const NavigationEntryImpl& entry,
NavigationController::ReloadType reload_type) {
switch (reload_type) {
case NavigationController::RELOAD:
@@ -150,14 +152,14 @@ ViewMsg_Navigate_Type::Value GetNavigationType(
break; // Fall through to rest of function.
}
- if (entry.restore_type() == NavigationEntry::RESTORE_LAST_SESSION &&
+ if (entry.restore_type() == NavigationEntryImpl::RESTORE_LAST_SESSION &&
browser_context->DidLastSessionExitCleanly())
return ViewMsg_Navigate_Type::RESTORE;
return ViewMsg_Navigate_Type::NORMAL;
}
-void MakeNavigateParams(const NavigationEntry& entry,
+void MakeNavigateParams(const NavigationEntryImpl& entry,
const NavigationController& controller,
content::WebContentsDelegate* delegate,
NavigationController::ReloadType reload_type,
@@ -372,7 +374,7 @@ content::ViewType TabContents::GetViewType() const {
const GURL& TabContents::GetURL() const {
// We may not have a navigation entry yet
- content::NavigationEntry* entry = controller_.GetActiveEntry();
+ NavigationEntry* entry = controller_.GetActiveEntry();
return entry ? entry->GetVirtualURL() : GURL::EmptyGURL();
}
@@ -431,7 +433,7 @@ WebUI* TabContents::GetCommittedWebUI() const {
const string16& TabContents::GetTitle() const {
// Transient entries take precedence. They are used for interstitial pages
// that are shown on top of existing pages.
- content::NavigationEntry* entry = controller_.GetTransientEntry();
+ NavigationEntry* entry = controller_.GetTransientEntry();
std::string accept_languages =
content::GetContentClient()->browser()->GetAcceptLangs(
GetBrowserContext());
@@ -779,12 +781,12 @@ WebContents* TabContents::OpenURL(const OpenURLParams& params) {
bool TabContents::NavigateToPendingEntry(
NavigationController::ReloadType reload_type) {
return NavigateToEntry(
- *NavigationEntry::FromNavigationEntry(controller_.GetPendingEntry()),
+ *NavigationEntryImpl::FromNavigationEntry(controller_.GetPendingEntry()),
reload_type);
}
bool TabContents::NavigateToEntry(
- const NavigationEntry& entry,
+ const NavigationEntryImpl& entry,
NavigationController::ReloadType reload_type) {
// The renderer will reject IPC messages with URLs longer than
// this limit, so don't attempt to navigate with a longer URL.
@@ -917,8 +919,8 @@ bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path,
}
bool TabContents::IsActiveEntry(int32 page_id) {
- NavigationEntry* active_entry =
- NavigationEntry::FromNavigationEntry(controller_.GetActiveEntry());
+ NavigationEntryImpl* active_entry =
+ NavigationEntryImpl::FromNavigationEntry(controller_.GetActiveEntry());
return (active_entry != NULL &&
active_entry->site_instance() == GetSiteInstance() &&
active_entry->GetPageID() == page_id);
@@ -999,7 +1001,7 @@ double TabContents::GetZoomLevel() const {
GetRenderProcessHost()->GetID(), GetRenderViewHost()->routing_id());
} else {
GURL url;
- content::NavigationEntry* active_entry = GetController().GetActiveEntry();
+ NavigationEntry* active_entry = GetController().GetActiveEntry();
// Since zoom map is updated using rewritten URL, use rewritten URL
// to get the zoom level.
url = active_entry ? active_entry->GetURL() : GURL::EmptyGURL();
@@ -1024,7 +1026,7 @@ void TabContents::ViewSource() {
if (!delegate_)
return;
- content::NavigationEntry* active_entry = GetController().GetActiveEntry();
+ NavigationEntry* active_entry = GetController().GetActiveEntry();
if (!active_entry)
return;
@@ -1105,7 +1107,7 @@ bool TabContents::FocusLocationBarByDefault() {
WebUI* web_ui = GetWebUIForCurrentState();
if (web_ui)
return web_ui->focus_location_bar_by_default();
- content::NavigationEntry* entry = controller_.GetActiveEntry();
+ NavigationEntry* entry = controller_.GetActiveEntry();
if (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL))
return true;
return false;
@@ -1163,7 +1165,7 @@ void TabContents::OnDidRedirectProvisionalLoad(int32 page_id,
// TODO(creis): Remove this method and have the pre-rendering code listen to
// the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification
// instead. See http://crbug.com/78512.
- content::NavigationEntry* entry;
+ NavigationEntry* entry;
if (page_id == -1)
entry = controller_.GetPendingEntry();
else
@@ -1329,7 +1331,7 @@ void TabContents::OnUpdateContentRestrictions(int restrictions) {
void TabContents::OnGoToEntryAtOffset(int offset) {
if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) {
- NavigationEntry* entry = NavigationEntry::FromNavigationEntry(
+ NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
controller_.GetEntryAtOffset(offset));
if (!entry)
return;
@@ -1345,7 +1347,7 @@ void TabContents::OnGoToEntryAtOffset(int offset) {
// If the entry is being restored and doesn't have a SiteInstance yet, fill
// it in now that we know. This allows us to find the entry when it commits.
if (!entry->site_instance() &&
- entry->restore_type() != NavigationEntry::RESTORE_NONE) {
+ entry->restore_type() != NavigationEntryImpl::RESTORE_NONE) {
entry->set_site_instance(GetPendingSiteInstance());
}
}
@@ -1509,7 +1511,7 @@ void TabContents::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) {
UpdateMaxPageIDForSiteInstance(rvh->site_instance(), max_restored_page_id);
}
-bool TabContents::UpdateTitleForEntry(NavigationEntry* entry,
+bool TabContents::UpdateTitleForEntry(NavigationEntryImpl* entry,
const string16& title) {
// For file URLs without a title, use the pathname instead. In the case of a
// synthesized title, we don't want the update to count toward the "one set
@@ -1613,7 +1615,7 @@ void TabContents::RenderViewCreated(RenderViewHost* render_view_host) {
content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB,
content::Source<TabContents>(this),
content::Details<RenderViewHost>(render_view_host));
- content::NavigationEntry* entry = controller_.GetActiveEntry();
+ NavigationEntry* entry = controller_.GetActiveEntry();
if (!entry)
return;
@@ -1760,7 +1762,7 @@ void TabContents::UpdateState(RenderViewHost* rvh,
rvh->site_instance(), page_id);
if (entry_index < 0)
return;
- content::NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index);
+ NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index);
if (state == entry->GetContentState())
return; // Nothing to update.
@@ -1777,8 +1779,8 @@ void TabContents::UpdateTitle(RenderViewHost* rvh,
SetNotWaitingForResponse();
DCHECK(rvh == GetRenderViewHost());
- NavigationEntry* entry = controller_.GetEntryWithPageID(rvh->site_instance(),
- page_id);
+ NavigationEntryImpl* entry = controller_.GetEntryWithPageID(
+ rvh->site_instance(), page_id);
// TODO(evan): make use of title_direction.
// http://code.google.com/p/chromium/issues/detail?id=27094
@@ -1853,7 +1855,7 @@ void TabContents::DidStartLoading() {
void TabContents::DidStopLoading() {
scoped_ptr<LoadNotificationDetails> details;
- content::NavigationEntry* entry = controller_.GetActiveEntry();
+ NavigationEntry* entry = controller_.GetActiveEntry();
// An entry may not exist for a stop when loading an initial blank page or
// if an iframe injected by script into a blank page finishes loading.
if (entry) {
@@ -2163,8 +2165,8 @@ WebUI* TabContents::CreateWebUIForRenderManager(const GURL& url) {
return content::WebUIFactory::Get()->CreateWebUIForURL(this, url);
}
-content::NavigationEntry*
-TabContents::GetLastCommittedNavigationEntryForRenderManager() {
+NavigationEntry*
+ TabContents::GetLastCommittedNavigationEntryForRenderManager() {
return controller_.GetLastCommittedEntry();
}
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index 809c6ed..ddf9a1c 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -466,12 +466,13 @@ class CONTENT_EXPORT TabContents
// This is used as the backend for state updates, which include a new title,
// or the dedicated set title message. It returns true if the new title is
// different and was therefore updated.
- bool UpdateTitleForEntry(NavigationEntry* entry, const string16& title);
+ bool UpdateTitleForEntry(content::NavigationEntryImpl* entry,
+ const string16& title);
// Causes the TabContents to navigate in the right renderer to |entry|, which
// must be already part of the entries in the navigation controller.
// This does not change the NavigationController state.
- bool NavigateToEntry(const NavigationEntry& entry,
+ bool NavigateToEntry(const content::NavigationEntryImpl& entry,
NavigationController::ReloadType reload_type);
// Sets the history for this tab_contents to |history_length| entries, and
diff --git a/content/browser/tab_contents/tab_contents_unittest.cc b/content/browser/tab_contents/tab_contents_unittest.cc
index 4a2fdfd..bd73255 100644
--- a/content/browser/tab_contents/tab_contents_unittest.cc
+++ b/content/browser/tab_contents/tab_contents_unittest.cc
@@ -10,7 +10,7 @@
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/interstitial_page.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/browser/webui/empty_web_ui_factory.h"
#include "content/common/view_messages.h"
@@ -26,6 +26,8 @@
#include "webkit/glue/webkit_glue.h"
using content::BrowserThread;
+using content::NavigationEntry;
+using content::NavigationEntryImpl;
using webkit::forms::PasswordForm;
namespace {
@@ -305,7 +307,7 @@ TEST_F(TabContentsTest, SimpleNavigation) {
// Controller's pending entry will have a NULL site instance until we assign
// it in DidNavigate.
EXPECT_TRUE(
- NavigationEntry::FromNavigationEntry(controller().GetActiveEntry())->
+ NavigationEntryImpl::FromNavigationEntry(controller().GetActiveEntry())->
site_instance() == NULL);
// DidNavigate from the page
@@ -317,7 +319,7 @@ TEST_F(TabContentsTest, SimpleNavigation) {
// able to find it later.
EXPECT_EQ(
instance1,
- NavigationEntry::FromNavigationEntry(controller().GetActiveEntry())->
+ NavigationEntryImpl::FromNavigationEntry(controller().GetActiveEntry())->
site_instance());
}
@@ -658,14 +660,14 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) {
url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string());
TestRenderViewHost* ntp_rvh = rvh();
contents()->TestDidNavigate(ntp_rvh, 1, url1, content::PAGE_TRANSITION_TYPED);
- content::NavigationEntry* entry1 = controller().GetLastCommittedEntry();
+ NavigationEntry* entry1 = controller().GetLastCommittedEntry();
SiteInstance* instance1 = contents()->GetSiteInstance();
EXPECT_FALSE(contents()->cross_navigation_pending());
EXPECT_EQ(ntp_rvh, contents()->GetRenderViewHost());
EXPECT_EQ(url1, entry1->GetURL());
EXPECT_EQ(instance1,
- NavigationEntry::FromNavigationEntry(entry1)->site_instance());
+ NavigationEntryImpl::FromNavigationEntry(entry1)->site_instance());
EXPECT_TRUE(ntp_rvh->enabled_bindings() & content::BINDINGS_POLICY_WEB_UI);
// Navigate to new site.
@@ -682,7 +684,7 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) {
// DidNavigate from the pending page.
contents()->TestDidNavigate(
google_rvh, 1, url2, content::PAGE_TRANSITION_TYPED);
- content::NavigationEntry* entry2 = controller().GetLastCommittedEntry();
+ NavigationEntry* entry2 = controller().GetLastCommittedEntry();
SiteInstance* instance2 = contents()->GetSiteInstance();
EXPECT_FALSE(contents()->cross_navigation_pending());
@@ -691,7 +693,7 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) {
EXPECT_FALSE(contents()->pending_rvh());
EXPECT_EQ(url2, entry2->GetURL());
EXPECT_EQ(instance2,
- NavigationEntry::FromNavigationEntry(entry2)->site_instance());
+ NavigationEntryImpl::FromNavigationEntry(entry2)->site_instance());
EXPECT_FALSE(google_rvh->enabled_bindings() &
content::BINDINGS_POLICY_WEB_UI);
@@ -702,7 +704,7 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) {
EXPECT_FALSE(contents()->cross_navigation_pending());
contents()->TestDidNavigate(
google_rvh, 2, url3, content::PAGE_TRANSITION_TYPED);
- content::NavigationEntry* entry3 = controller().GetLastCommittedEntry();
+ NavigationEntry* entry3 = controller().GetLastCommittedEntry();
SiteInstance* instance3 = contents()->GetSiteInstance();
EXPECT_FALSE(contents()->cross_navigation_pending());
@@ -711,7 +713,7 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) {
EXPECT_FALSE(contents()->pending_rvh());
EXPECT_EQ(url3, entry3->GetURL());
EXPECT_EQ(instance3,
- NavigationEntry::FromNavigationEntry(entry3)->site_instance());
+ NavigationEntryImpl::FromNavigationEntry(entry3)->site_instance());
// Go back within the site.
controller().GoBack();
@@ -740,11 +742,11 @@ TEST_F(TabContentsTest, CrossSiteNavigationBackPreempted) {
// We should not have corrupted the NTP entry.
EXPECT_EQ(instance3,
- NavigationEntry::FromNavigationEntry(entry3)->site_instance());
+ NavigationEntryImpl::FromNavigationEntry(entry3)->site_instance());
EXPECT_EQ(instance2,
- NavigationEntry::FromNavigationEntry(entry2)->site_instance());
+ NavigationEntryImpl::FromNavigationEntry(entry2)->site_instance());
EXPECT_EQ(instance1,
- NavigationEntry::FromNavigationEntry(entry1)->site_instance());
+ NavigationEntryImpl::FromNavigationEntry(entry1)->site_instance());
EXPECT_EQ(url1, entry1->GetURL());
}
@@ -921,7 +923,7 @@ TEST_F(TabContentsTest, NavigationEntryContentState) {
const GURL url("http://www.google.com");
controller().LoadURL(
url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string());
- content::NavigationEntry* entry = controller().GetLastCommittedEntry();
+ NavigationEntry* entry = controller().GetLastCommittedEntry();
EXPECT_TRUE(entry == NULL);
// Committed entry should have content state after DidNavigate.
@@ -961,7 +963,7 @@ TEST_F(TabContentsTest, NavigationEntryContentStateNewWindow) {
contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED);
// Should have a content state here.
- content::NavigationEntry* entry = controller().GetLastCommittedEntry();
+ NavigationEntry* entry = controller().GetLastCommittedEntry();
EXPECT_FALSE(entry->GetContentState().empty());
}
@@ -1001,7 +1003,7 @@ TEST_F(TabContentsTest,
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
- content::NavigationEntry* entry = controller().GetActiveEntry();
+ NavigationEntry* entry = controller().GetActiveEntry();
ASSERT_TRUE(entry != NULL);
EXPECT_TRUE(entry->GetURL() == url2);
@@ -1046,7 +1048,7 @@ TEST_F(TabContentsTest,
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
- content::NavigationEntry* entry = controller().GetActiveEntry();
+ NavigationEntry* entry = controller().GetActiveEntry();
ASSERT_TRUE(entry != NULL);
EXPECT_TRUE(entry->GetURL() == url2);
@@ -1089,7 +1091,7 @@ TEST_F(TabContentsTest, ShowInterstitialNoNewNavigationDontProceed) {
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
- content::NavigationEntry* entry = controller().GetActiveEntry();
+ NavigationEntry* entry = controller().GetActiveEntry();
ASSERT_TRUE(entry != NULL);
// The URL specified to the interstitial should have been ignored.
EXPECT_TRUE(entry->GetURL() == url1);
@@ -1138,7 +1140,7 @@ TEST_F(TabContentsTest,
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
- content::NavigationEntry* entry = controller().GetActiveEntry();
+ NavigationEntry* entry = controller().GetActiveEntry();
ASSERT_TRUE(entry != NULL);
EXPECT_TRUE(entry->GetURL() == url2);
@@ -1193,7 +1195,7 @@ TEST_F(TabContentsTest,
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
- content::NavigationEntry* entry = controller().GetActiveEntry();
+ NavigationEntry* entry = controller().GetActiveEntry();
ASSERT_TRUE(entry != NULL);
EXPECT_TRUE(entry->GetURL() == url2);
@@ -1247,7 +1249,7 @@ TEST_F(TabContentsTest, ShowInterstitialNoNewNavigationProceed) {
EXPECT_TRUE(interstitial->is_showing());
EXPECT_TRUE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == interstitial);
- content::NavigationEntry* entry = controller().GetActiveEntry();
+ NavigationEntry* entry = controller().GetActiveEntry();
ASSERT_TRUE(entry != NULL);
// The URL specified to the interstitial should have been ignored.
EXPECT_TRUE(entry->GetURL() == url1);
@@ -1315,7 +1317,7 @@ TEST_F(TabContentsTest, ShowInterstitialThenGoBack) {
// gone.
EXPECT_TRUE(deleted);
EXPECT_EQ(TestInterstitialPage::CANCELED, state);
- content::NavigationEntry* entry = controller().GetActiveEntry();
+ NavigationEntry* entry = controller().GetActiveEntry();
ASSERT_TRUE(entry);
EXPECT_EQ(url1.spec(), entry->GetURL().spec());
}
@@ -1353,7 +1355,7 @@ TEST_F(TabContentsTest, ShowInterstitialCrashRendererThenGoBack) {
// gone.
EXPECT_TRUE(deleted);
EXPECT_EQ(TestInterstitialPage::CANCELED, state);
- content::NavigationEntry* entry = controller().GetActiveEntry();
+ NavigationEntry* entry = controller().GetActiveEntry();
ASSERT_TRUE(entry);
EXPECT_EQ(url1.spec(), entry->GetURL().spec());
}
@@ -1482,7 +1484,7 @@ TEST_F(TabContentsTest, ShowInterstitialOnInterstitial) {
EXPECT_TRUE(deleted2);
EXPECT_FALSE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == NULL);
- content::NavigationEntry* entry = controller().GetActiveEntry();
+ NavigationEntry* entry = controller().GetActiveEntry();
ASSERT_TRUE(entry != NULL);
EXPECT_TRUE(entry->GetURL() == landing_url);
EXPECT_EQ(2, controller().entry_count());
@@ -1537,7 +1539,7 @@ TEST_F(TabContentsTest, ShowInterstitialProceedShowInterstitial) {
EXPECT_TRUE(deleted2);
EXPECT_FALSE(contents()->ShowingInterstitialPage());
EXPECT_TRUE(contents()->GetInterstitialPage() == NULL);
- content::NavigationEntry* entry = controller().GetActiveEntry();
+ NavigationEntry* entry = controller().GetActiveEntry();
ASSERT_TRUE(entry != NULL);
EXPECT_TRUE(entry->GetURL() == landing_url);
EXPECT_EQ(2, controller().entry_count());
@@ -1680,8 +1682,7 @@ TEST_F(TabContentsTest, NewInterstitialDoesNotCancelPendingEntry) {
interstitial2->TestDidNavigate(1, kGURL);
// Make sure we still have an entry.
- content::NavigationEntry* entry =
- contents()->GetController().GetPendingEntry();
+ NavigationEntry* entry = contents()->GetController().GetPendingEntry();
ASSERT_TRUE(entry);
EXPECT_EQ(kUrl, entry->GetURL().spec());
@@ -1757,7 +1758,7 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) {
NavigationController& other_controller = other_contents->GetController();
other_contents->NavigateAndCommit(url3);
other_contents->ExpectSetHistoryLengthAndPrune(
- NavigationEntry::FromNavigationEntry(
+ NavigationEntryImpl::FromNavigationEntry(
other_controller.GetEntryAtIndex(0))->site_instance(), 1,
other_controller.GetEntryAtIndex(0)->GetPageID());
other_controller.CopyStateFromAndPrune(&controller());
@@ -1801,7 +1802,7 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneTargetInterstitial) {
EXPECT_TRUE(interstitial->is_showing());
EXPECT_EQ(2, other_controller.entry_count());
other_contents->ExpectSetHistoryLengthAndPrune(
- NavigationEntry::FromNavigationEntry(
+ NavigationEntryImpl::FromNavigationEntry(
other_controller.GetEntryAtIndex(0))->site_instance(), 1,
other_controller.GetEntryAtIndex(0)->GetPageID());
other_controller.CopyStateFromAndPrune(&controller());
diff --git a/content/browser/tab_contents/test_tab_contents.cc b/content/browser/tab_contents/test_tab_contents.cc
index f989f5d..8b664f9 100644
--- a/content/browser/tab_contents/test_tab_contents.cc
+++ b/content/browser/tab_contents/test_tab_contents.cc
@@ -11,12 +11,14 @@
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/test_render_view_host.h"
#include "content/browser/site_instance.h"
-#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/common/view_messages.h"
#include "content/public/common/page_transition_types.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/forms/password_form.h"
+using content::NavigationEntry;
+
TestTabContents::TestTabContents(content::BrowserContext* browser_context,
SiteInstance* instance)
: TabContents(browser_context, instance, MSG_ROUTING_NONE, NULL, NULL),
@@ -111,7 +113,7 @@ void TestTabContents::CommitPendingNavigation() {
if (!rvh)
rvh = static_cast<TestRenderViewHost*>(old_rvh);
- const content::NavigationEntry* entry = GetController().GetPendingEntry();
+ const NavigationEntry* entry = GetController().GetPendingEntry();
DCHECK(entry);
int page_id = entry->GetPageID();
if (page_id == -1) {
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 89c7193..0d13edc 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -592,8 +592,8 @@
'browser/tab_contents/interstitial_page.h',
'browser/tab_contents/navigation_controller.cc',
'browser/tab_contents/navigation_controller.h',
- 'browser/tab_contents/navigation_entry.cc',
- 'browser/tab_contents/navigation_entry.h',
+ 'browser/tab_contents/navigation_entry_impl.cc',
+ 'browser/tab_contents/navigation_entry_impl.h',
'browser/tab_contents/popup_menu_helper_mac.h',
'browser/tab_contents/popup_menu_helper_mac.mm',
'browser/tab_contents/provisional_load_details.cc',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index e636229..f4d321b 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -234,7 +234,7 @@
'browser/speech/speech_recognizer_unittest.cc',
'browser/ssl/ssl_host_state_unittest.cc',
'browser/tab_contents/navigation_controller_unittest.cc',
- 'browser/tab_contents/navigation_entry_unittest.cc',
+ 'browser/tab_contents/navigation_entry_impl_unittest.cc',
'browser/tab_contents/render_view_host_manager_unittest.cc',
'browser/tab_contents/tab_contents_delegate_unittest.cc',
'browser/tab_contents/tab_contents_unittest.cc',