diff --git a/chrome/browser/content_settings/sound_content_setting_observer.cc b/chrome/browser/content_settings/sound_content_setting_observer.cc index 2b7ae43e68c977..bc4fd51283c4ca 100644 --- a/chrome/browser/content_settings/sound_content_setting_observer.cc +++ b/chrome/browser/content_settings/sound_content_setting_observer.cc @@ -86,14 +86,9 @@ void SoundContentSettingObserver::ReadyToCommitNavigation( blink::mojom::kAutoplayFlagUserException); } -void SoundContentSettingObserver::DidFinishNavigation( - content::NavigationHandle* navigation_handle) { - if (navigation_handle->IsInPrimaryMainFrame() && - navigation_handle->HasCommitted() && - !navigation_handle->IsSameDocument()) { - MuteOrUnmuteIfNecessary(); - logged_site_muted_ukm_ = false; - } +void SoundContentSettingObserver::PrimaryPageChanged(content::Page& page) { + MuteOrUnmuteIfNecessary(); + logged_site_muted_ukm_ = false; } void SoundContentSettingObserver::OnAudioStateChanged(bool audible) { diff --git a/chrome/browser/content_settings/sound_content_setting_observer.h b/chrome/browser/content_settings/sound_content_setting_observer.h index 6de46715a46a76..7d96899d07564e 100644 --- a/chrome/browser/content_settings/sound_content_setting_observer.h +++ b/chrome/browser/content_settings/sound_content_setting_observer.h @@ -15,6 +15,10 @@ #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" +namespace content { +class Page; +} + class SoundContentSettingObserver : public content::WebContentsObserver, public content::WebContentsUserData, @@ -37,8 +41,7 @@ class SoundContentSettingObserver // content::WebContentsObserver implementation. void ReadyToCommitNavigation( content::NavigationHandle* navigation_handle) override; - void DidFinishNavigation( - content::NavigationHandle* navigation_handle) override; + void PrimaryPageChanged(content::Page& page) override; void OnAudioStateChanged(bool audible) override; // content_settings::Observer implementation.