Commit a9033e27 authored by Steven Holte's avatar Steven Holte Committed by Commit Bot

Migrate Sound UKM to shared SourceID.

Bug: 754889
Change-Id: I7dd1233e282fab6a3e00c40526e5c69b54637726
Reviewed-on: https://chromium-review.googlesource.com/806925
Commit-Queue: Steven Holte <holte@chromium.org>
Reviewed-by: default avatarRaymes Khoury <raymes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521940}
parent 90ecf2f4
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/ukm/content/source_url_recorder.h"
#include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_handle.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_builders.h"
...@@ -113,12 +114,10 @@ void SoundContentSettingObserver::RecordSiteMutedUKM() { ...@@ -113,12 +114,10 @@ void SoundContentSettingObserver::RecordSiteMutedUKM() {
return; return;
logged_site_muted_ukm_ = true; logged_site_muted_ukm_ = true;
ukm::UkmRecorder* recorder = ukm::UkmRecorder::Get(); ukm::builders::Media_SiteMuted(
ukm::SourceId source_id = ukm::UkmRecorder::GetNewSourceID(); ukm::GetSourceIdForWebContentsDocument(web_contents()))
recorder->UpdateSourceURL(source_id, web_contents()->GetLastCommittedURL());
ukm::builders::Media_SiteMuted(source_id)
.SetMuteReason(GetSiteMutedReason()) .SetMuteReason(GetSiteMutedReason())
.Record(recorder); .Record(ukm::UkmRecorder::Get());
} }
SoundContentSettingObserver::MuteReason SoundContentSettingObserver::MuteReason
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/ukm/content/source_url_recorder.h"
#include "components/ukm/test_ukm_recorder.h" #include "components/ukm/test_ukm_recorder.h"
#include "content/public/test/web_contents_tester.h" #include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -39,6 +40,7 @@ class SoundContentSettingObserverTest : public ChromeRenderViewHostTestHarness { ...@@ -39,6 +40,7 @@ class SoundContentSettingObserverTest : public ChromeRenderViewHostTestHarness {
ChromeRenderViewHostTestHarness::SetUp(); ChromeRenderViewHostTestHarness::SetUp();
SoundContentSettingObserver::CreateForWebContents(web_contents()); SoundContentSettingObserver::CreateForWebContents(web_contents());
ukm::InitializeSourceUrlRecorderForWebContents(web_contents());
host_content_settings_map_ = HostContentSettingsMapFactory::GetForProfile( host_content_settings_map_ = HostContentSettingsMapFactory::GetForProfile(
Profile::FromBrowserContext(web_contents()->GetBrowserContext())); Profile::FromBrowserContext(web_contents()->GetBrowserContext()));
test_ukm_recorder_ = base::MakeUnique<ukm::TestAutoSetUkmRecorder>(); test_ukm_recorder_ = base::MakeUnique<ukm::TestAutoSetUkmRecorder>();
......
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