From eee38bb985ee7cfb0be7c031e3a149123d7c7e19 Mon Sep 17 00:00:00 2001 From: Gyuyoung Kim Date: Wed, 15 Dec 2021 03:17:59 +0000 Subject: [PATCH] MPArch: Replace DidFinishNavigation with PrimaryPageChanged in SoundContentSettingObserver As a clean-up of fixing long tail of features for MPArch, this CL renames DidFinishNavigation to PrimaryPageChanged in SoundContentSettingObserver, because PrimaryPageChanged is preferred when DidFinishNavigation only handles changes to the document the user sees. Bug: 1269645 Change-Id: Ic56b330cd515b5dfac2b0c8041c374bf311ff8cd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3275869 Reviewed-by: Kevin McNee Reviewed-by: Balazs Engedy Commit-Queue: Gyuyoung Kim Cr-Commit-Position: refs/heads/main@{#951800} --- .../sound_content_setting_observer.cc | 11 +++-------- .../content_settings/sound_content_setting_observer.h | 7 +++++-- 2 files changed, 8 insertions(+), 10 deletions(-) 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.