Skip to content

Commit

Permalink
[mparch] Rename NCD::NotifyNavigationStateChanged to NCD::NotifyNavig…
Browse files Browse the repository at this point in the history
…ationStateChangedFromController

In this CL, the following improvements are made:
1. rename NCD::NotifyNavigationStateChanged to
NCD::NotifyNavigationStateChangedFromController
2. implement NCD::NotifyNavigationStateChangedFromController in
WebContentsImpl to calls WebContents::NotifyNavigationStateChanged
internally

Bug: 1224294
Change-Id: Ie0eb71ddc1c9bbcbc15b6214965c170cace3605b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4001065
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1068978}
  • Loading branch information
abhijeetk authored and Chromium LUCI CQ committed Nov 9, 2022
1 parent 726cdfe commit 3dc6e60
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 10 deletions.
2 changes: 0 additions & 2 deletions content/browser/fenced_frame/fenced_frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ const base::UnguessableToken& FencedFrame::GetDevToolsFrameToken() const {
return frame_tree_->GetMainFrame()->GetDevToolsFrameToken();
}

void FencedFrame::NotifyNavigationStateChanged(InvalidateTypes changed_flags) {}

void FencedFrame::NotifyBeforeFormRepostWarningShow() {}

void FencedFrame::NotifyNavigationEntryCommitted(
Expand Down
3 changes: 2 additions & 1 deletion content/browser/fenced_frame/fenced_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class CONTENT_EXPORT FencedFrame : public blink::mojom::FencedFrameOwnerHost,

private:
// NavigationControllerDelegate
void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override;
void NotifyNavigationStateChangedFromController(
InvalidateTypes changed_flags) override {}
void NotifyBeforeFormRepostWarningShow() override;
void NotifyNavigationEntryCommitted(
const LoadCommittedDetails& load_details) override;
Expand Down
3 changes: 2 additions & 1 deletion content/browser/preloading/prerender/prerender_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ class CONTENT_EXPORT PrerenderHost : public FrameTree::Delegate,
bool IsPortal() override;

// NavigationControllerDelegate
void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override {}
void NotifyNavigationStateChangedFromController(
InvalidateTypes changed_flags) override {}
void NotifyBeforeFormRepostWarningShow() override {}
void NotifyNavigationEntryCommitted(
const LoadCommittedDetails& load_details) override {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class NavigationControllerDelegate {
public:
virtual ~NavigationControllerDelegate() {}

// TODO(https://crbug.com/1224294): Remove duplicates of WebContents methods.
virtual void NotifyNavigationStateChanged(InvalidateTypes changed_flags) = 0;
virtual void NotifyNavigationStateChangedFromController(
InvalidateTypes changed_flags) = 0;

// Methods from WebContentsImpl that NavigationControllerImpl needs to
// call. NavigationControllerImpl cannot call them directly because
Expand Down
8 changes: 4 additions & 4 deletions content/browser/renderer_host/navigation_controller_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4090,7 +4090,7 @@ void NavigationControllerImpl::NotifyNavigationEntryCommitted(
// when it wants to draw. See http://crbug.com/11157
ssl_manager_.DidCommitProvisionalLoad(*details);

delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_ALL);
delegate_->NotifyNavigationStateChangedFromController(INVALIDATE_TYPE_ALL);
delegate_->NotifyNavigationEntryCommitted(*details);

// TODO(avi): Remove. http://crbug.com/170921
Expand Down Expand Up @@ -4250,7 +4250,7 @@ void NavigationControllerImpl::DiscardNonCommittedEntriesWithCommitDetails(

if (!delegate_)
return;
delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_ALL);
delegate_->NotifyNavigationStateChangedFromController(INVALIDATE_TYPE_ALL);
}

int NavigationControllerImpl::GetEntryIndexWithUniqueID(
Expand Down Expand Up @@ -4371,7 +4371,7 @@ void NavigationControllerImpl::PendingEntryRefDeleted(PendingEntryRef* ref) {
return;

DiscardPendingEntry(true);
delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
delegate_->NotifyNavigationStateChangedFromController(INVALIDATE_TYPE_URL);
}

std::unique_ptr<PolicyContainerPolicies>
Expand Down Expand Up @@ -4430,7 +4430,7 @@ void NavigationControllerImpl::DidAccessInitialMainDocument() {
DiscardPendingEntry(false);

// Update the URL display.
delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
delegate_->NotifyNavigationStateChangedFromController(INVALIDATE_TYPE_URL);
}

void NavigationControllerImpl::UpdateStateForFrame(
Expand Down
5 changes: 5 additions & 0 deletions content/browser/web_contents/web_contents_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5848,6 +5848,11 @@ bool WebContentsImpl::ShouldPreserveAbortedURLs() {
return delegate_->ShouldPreserveAbortedURLs(this);
}

void WebContentsImpl::NotifyNavigationStateChangedFromController(
InvalidateTypes changed_flags) {
NotifyNavigationStateChanged(changed_flags);
}

void WebContentsImpl::DidNavigateMainFramePreCommit(
FrameTreeNode* frame_tree_node,
bool navigation_is_within_page) {
Expand Down
2 changes: 2 additions & 0 deletions content/browser/web_contents/web_contents_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,8 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
void NotifyNavigationListPruned(const PrunedDetails& pruned_details) override;
void NotifyNavigationEntriesDeleted() override;
bool ShouldPreserveAbortedURLs() override;
void NotifyNavigationStateChangedFromController(
InvalidateTypes changed_flags) override;

// Invoked before a form repost warning is shown.
void NotifyBeforeFormRepostWarningShow() override;
Expand Down

0 comments on commit 3dc6e60

Please sign in to comment.