Commit 91ca0146 authored by Mike Dougherty's avatar Mike Dougherty Committed by Chromium LUCI CQ

Remove unused NavigationManager methods

These methods were never implemented for WKBasedNavigationManager, which
is now the only concrete implementation of NavigationManager.

Bug: 533848, 1156272
Change-Id: Ia705e35a9605494b468308a97eca7df81dd29a1d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2577918
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Auto-Submit: Mike Dougherty <michaeldo@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834408}
parent 0a7e64de
......@@ -69,17 +69,6 @@ TEST_F(NavigationManagerUtilTest, GetCommittedItemWithUniqueID) {
EXPECT_EQ(item, GetItemWithUniqueID(manager_.get(), context.get()));
EXPECT_EQ(0, GetCommittedItemIndexWithUniqueID(manager_.get(), unique_id));
// Commit another navigation so that the current item is updated. This allows
// for removing the item with |unique_id|.
manager_->AddPendingItem(GURL("http://test.org"), Referrer(),
ui::PAGE_TRANSITION_TYPED,
web::NavigationInitiationType::BROWSER_INITIATED);
manager_->CommitPendingItem();
manager_->RemoveItemAtIndex(0);
EXPECT_FALSE(GetCommittedItemWithUniqueID(manager_.get(), unique_id));
EXPECT_FALSE(GetItemWithUniqueID(manager_.get(), context.get()));
EXPECT_EQ(-1, GetCommittedItemIndexWithUniqueID(manager_.get(), unique_id));
// Add transient item.
manager_->AddTransientItem(GURL("http://chromium.org"));
item = manager_->GetTransientItem();
......
......@@ -122,7 +122,6 @@ class WKBasedNavigationManagerImpl : public NavigationManagerImpl {
NavigationItem* GetItemAtIndex(size_t index) const override;
int GetIndexOfItem(const NavigationItem* item) const override;
int GetPendingItemIndex() const override;
bool RemoveItemAtIndex(int index) override;
bool CanGoBack() const override;
bool CanGoForward() const override;
bool CanGoToOffset(int offset) const override;
......@@ -130,8 +129,6 @@ class WKBasedNavigationManagerImpl : public NavigationManagerImpl {
void GoForward() override;
NavigationItemList GetBackwardItems() const override;
NavigationItemList GetForwardItems() const override;
void CopyStateFromAndPrune(const NavigationManager* source) override;
bool CanPruneAllButLastCommittedItem() const override;
void Restore(int last_committed_item_index,
std::vector<std::unique_ptr<NavigationItem>> items) override;
void LoadURLWithParams(const NavigationManager::WebLoadParams&) override;
......
......@@ -564,11 +564,6 @@ int WKBasedNavigationManagerImpl::GetPendingItemIndex() const {
return pending_item_index_;
}
bool WKBasedNavigationManagerImpl::RemoveItemAtIndex(int index) {
DLOG(WARNING) << "Not yet implemented.";
return true;
}
bool WKBasedNavigationManagerImpl::CanGoBack() const {
return CanGoToOffset(-1);
}
......@@ -632,16 +627,6 @@ NavigationItemList WKBasedNavigationManagerImpl::GetForwardItems() const {
return items;
}
void WKBasedNavigationManagerImpl::CopyStateFromAndPrune(
const NavigationManager* source) {
DLOG(WARNING) << "Not yet implemented.";
}
bool WKBasedNavigationManagerImpl::CanPruneAllButLastCommittedItem() const {
DLOG(WARNING) << "Not yet implemented.";
return true;
}
void WKBasedNavigationManagerImpl::
ApplyWKWebViewForwardHistoryClobberWorkaround() {
DCHECK(web_view_cache_.IsAttachedToWebView());
......
......@@ -140,12 +140,6 @@ class NavigationManager {
// TODO(crbug.com/533848): Update to return size_t.
virtual int GetPendingItemIndex() const = 0;
// Removes the item at the specified |index|. If the index is the last
// committed index or the pending item, this does nothing and returns false.
// Otherwise this call discards any transient or pending entries.
// TODO(crbug.com/533848): Update to use size_t.
virtual bool RemoveItemAtIndex(int index) = 0;
// Navigation relative to the current item.
virtual bool CanGoBack() const = 0;
virtual bool CanGoForward() const = 0;
......@@ -191,26 +185,6 @@ class NavigationManager {
// TODO(crbug.com/904502): This API is only needed for clearing cookies.
// Remove after //ios/web exposes a proper cookie clearing API.
virtual void AddRestoreCompletionCallback(base::OnceClosure callback) = 0;
// Removes all items from this except the last committed item, and inserts
// copies of all items from |source| at the beginning of the session history.
//
// For example:
// source: A B *C* D
// this: E F *G*
// result: A B C *G*
//
// If there is a pending item after *G* in |this|, it is also preserved.
// This ignores any pending or transient entries in |source|. This will be a
// no-op if called while CanPruneAllButLastCommittedItem() is false.
virtual void CopyStateFromAndPrune(const NavigationManager* source) = 0;
// Whether the NavigationManager can prune all but the last committed item.
// This is true when all the following conditions are met:
// - There is a last committed NavigationItem.
// - There is no pending history navigation.
// - There is no transient NavigationItem.
virtual bool CanPruneAllButLastCommittedItem() const = 0;
};
} // namespace web
......
......@@ -35,7 +35,6 @@ class TestNavigationManager : public NavigationManager {
int GetIndexOfItem(const NavigationItem* item) const override;
int GetPendingItemIndex() const override;
int GetLastCommittedItemIndex() const override;
bool RemoveItemAtIndex(int index) override;
bool CanGoBack() const override;
bool CanGoForward() const override;
bool CanGoToOffset(int offset) const override;
......@@ -50,8 +49,6 @@ class TestNavigationManager : public NavigationManager {
std::vector<std::unique_ptr<NavigationItem>> items) override;
bool IsRestoreSessionInProgress() const override;
void AddRestoreCompletionCallback(base::OnceClosure callback) override;
void CopyStateFromAndPrune(const NavigationManager* source) override;
bool CanPruneAllButLastCommittedItem() const override;
// Setters for test data.
// Sets a value for last committed item that will be returned by
......
......@@ -113,16 +113,6 @@ void TestNavigationManager::SetPendingItemIndex(int index) {
pending_item_index_ = index;
}
bool TestNavigationManager::RemoveItemAtIndex(int index) {
if (index < 0 || index >= GetItemCount())
return false;
DCHECK(items_index_ != index);
items_.erase(items_.begin() + index);
if (items_index_ > index)
--items_index_;
return true;
}
bool TestNavigationManager::CanGoBack() const {
return items_index_ > 0;
}
......@@ -181,16 +171,6 @@ void TestNavigationManager::AddRestoreCompletionCallback(
NOTREACHED();
}
void TestNavigationManager::CopyStateFromAndPrune(
const NavigationManager* source) {
NOTREACHED();
}
bool TestNavigationManager::CanPruneAllButLastCommittedItem() const {
NOTREACHED();
return false;
}
// Adds a new navigation item of |transition| type at the end of this
// navigation manager.
void TestNavigationManager::AddItem(const GURL& url,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment