Skip to content

Commit

Permalink
MPArch: Replace DidFinishNavigation with PrimaryPageChanged in SoundC…
Browse files Browse the repository at this point in the history
…ontentSettingObserver

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 <mcnee@chromium.org>
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/main@{#951800}
  • Loading branch information
Gyuyoung authored and Chromium LUCI CQ committed Dec 15, 2021
1 parent 3f64b4d commit eee38bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SoundContentSettingObserver>,
Expand All @@ -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.
Expand Down

0 comments on commit eee38bb

Please sign in to comment.