Split audibility-related notifications from INVALIDATE_TYPE_TAB

Notifying of an audibility change in a WebContents is done by calling
NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB). This CL adds
INVALIDATE_TYPE_AUDIO and notifies with this more specific flag instead.

This is to enable the browser UI side to filter this notification and
instead use RecentlyAudibleHelper for this purpose.

This is part of a refactor detailed in the attached bug.

Bug: 846374
Change-Id: I91b9d27453b2910ba262a4af581ac7662cce803e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1815725
Reviewed-by: Avi Drissman <[email protected]>
Commit-Queue: Collin Baker <[email protected]>
Cr-Commit-Position: refs/heads/master@{#698613}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index a7b8568..fa9038a 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1551,7 +1551,7 @@
     observer.DidUpdateAudioMutingState(mute);
 
   // Notification for UI updates in response to the changed muting state.
-  NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
+  NotifyNavigationStateChanged(INVALIDATE_TYPE_AUDIO);
 }
 
 bool WebContentsImpl::IsCurrentlyAudible() {
@@ -1652,7 +1652,7 @@
 void WebContentsImpl::NotifyNavigationStateChanged(
     InvalidateTypes changed_flags) {
   // Notify the media observer of potential audibility changes.
-  if (changed_flags & INVALIDATE_TYPE_TAB) {
+  if (changed_flags & INVALIDATE_TYPE_AUDIO) {
     media_web_contents_observer_->MaybeUpdateAudibleState();
   }
 
@@ -1694,7 +1694,7 @@
       new PageMsg_AudioStateChanged(MSG_ROUTING_NONE, is_currently_audible_));
 
   // Notification for UI updates in response to the changed audio state.
-  NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
+  NotifyNavigationStateChanged(INVALIDATE_TYPE_AUDIO);
 
   // Ensure that audio state changes propagate from innermost to outermost
   // WebContents.