Commit 0885c956 authored by Dominic Farolino's avatar Dominic Farolino Committed by Commit Bot

Notify BrowserAccessibilityManager via WebContentsObserver

This is the last of a series of CLs that remove manual notifications
BrowserAccessibilityManager, now that it implements WebContentsObserver.
This CL removes manual BAM::Navigation{Succeeded,Failed} notifications
in favor of WCO::DidFinishNavigation, and BAM::UserIsNavigatingAway in
favor of WCO::DidStartLoading.

Bug: 981271
Change-Id: Ieca6ce0b97f2a0267fd7f2582ab1e333deb11b95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1938489Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720102}
parent 58e2cde2
...@@ -342,20 +342,12 @@ void BrowserAccessibilityManager::OnWindowBlurred() { ...@@ -342,20 +342,12 @@ void BrowserAccessibilityManager::OnWindowBlurred() {
SetLastFocusedNode(nullptr); SetLastFocusedNode(nullptr);
} }
void BrowserAccessibilityManager::UserIsNavigatingAway() {
user_is_navigating_away_ = true;
}
void BrowserAccessibilityManager::UserIsReloading() { void BrowserAccessibilityManager::UserIsReloading() {
user_is_navigating_away_ = true; user_is_navigating_away_ = true;
} }
void BrowserAccessibilityManager::NavigationSucceeded() { void BrowserAccessibilityManager::DidStartLoading() {
user_is_navigating_away_ = false; user_is_navigating_away_ = true;
}
void BrowserAccessibilityManager::NavigationFailed() {
user_is_navigating_away_ = false;
} }
void BrowserAccessibilityManager::DidStopLoading() { void BrowserAccessibilityManager::DidStopLoading() {
......
...@@ -191,14 +191,16 @@ class CONTENT_EXPORT BrowserAccessibilityManager : public ui::AXTreeObserver, ...@@ -191,14 +191,16 @@ class CONTENT_EXPORT BrowserAccessibilityManager : public ui::AXTreeObserver,
// view lost focus. // view lost focus.
virtual void OnWindowBlurred(); virtual void OnWindowBlurred();
// Notify the accessibility manager about page navigation.
// TODO(domfarolino, dmazzoni): Implement WebContentsObserver methods that
// correspond to the ones we provide today, so we can stop being manually
// notified of navigation events when they happen.
void UserIsNavigatingAway();
virtual void UserIsReloading(); virtual void UserIsReloading();
void NavigationSucceeded();
void NavigationFailed(); // WebContentsObserver implementation.
// Notify the accessibility manager about page navigation.
// BrowserAccessibilityManager used to be manually notified at the same time
// WebContentsObserver's DidStartLoading(), DidStopLoading(), and
// DidFinishNavigation() methods were called. Since then, it was determined
// BrowserAccessibilityManager does not need to distinguish between
// DidFinishNavigation() and DidStopLoading().
void DidStartLoading() override;
void DidStopLoading() override; void DidStopLoading() override;
// Keep track of if this page is hidden by an interstitial, in which case // Keep track of if this page is hidden by an interstitial, in which case
......
...@@ -4484,20 +4484,6 @@ void WebContentsImpl::DidFinishNavigation(NavigationHandle* navigation_handle) { ...@@ -4484,20 +4484,6 @@ void WebContentsImpl::DidFinishNavigation(NavigationHandle* navigation_handle) {
display_cutout_host_impl_->DidFinishNavigation(navigation_handle); display_cutout_host_impl_->DidFinishNavigation(navigation_handle);
if (navigation_handle->HasCommitted()) { if (navigation_handle->HasCommitted()) {
// TODO(domfarolino, dmazzoni): Do this using WebContentsObserver. See
// https://crbug.com/981271.
BrowserAccessibilityManager* manager =
static_cast<RenderFrameHostImpl*>(
navigation_handle->GetRenderFrameHost())
->browser_accessibility_manager();
if (manager) {
if (navigation_handle->IsErrorPage()) {
manager->NavigationFailed();
} else {
manager->NavigationSucceeded();
}
}
if (navigation_handle->IsInMainFrame()) { if (navigation_handle->IsInMainFrame()) {
last_committed_source_id_including_same_document_ = last_committed_source_id_including_same_document_ =
ukm::ConvertToSourceId(navigation_handle->GetNavigationId(), ukm::ConvertToSourceId(navigation_handle->GetNavigationId(),
...@@ -5982,15 +5968,6 @@ void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node, ...@@ -5982,15 +5968,6 @@ void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node,
// Reset the focus state from DidStartNavigation to false if a new load starts // Reset the focus state from DidStartNavigation to false if a new load starts
// afterward, in case loading logic triggers a FocusLocationBarByDefault call. // afterward, in case loading logic triggers a FocusLocationBarByDefault call.
should_focus_location_bar_by_default_ = false; should_focus_location_bar_by_default_ = false;
// Notify accessibility that the user is navigating away from the
// current document.
// TODO(domfarolino, dmazzoni): Do this using WebContentsObserver. See
// https://crbug.com/981271.
BrowserAccessibilityManager* manager =
frame_tree_node->current_frame_host()->browser_accessibility_manager();
if (manager)
manager->UserIsNavigatingAway();
} }
void WebContentsImpl::DidStopLoading() { void WebContentsImpl::DidStopLoading() {
......
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