[content] Add RenderFrameHostImpl::GetPageUkmSourceId.

Replace WebContentsImpl::GetUkmSourceIdForLastCommittedSource with a
RenderFrameHost-based method.

- RenderFrameHost-based method works correctly for non-current frames,
  unlike WebContentsImpl-based method.
- GetPageUkmSourceId (page load == main-frame committed cross-document
  navigation) should be more intuitive than
  GetUkmSourceIdForLastCommittedSource.

BUG=1061899
[email protected],[email protected]
[email protected]
CC=​​​​[email protected],[email protected]

Change-Id: I66d1520fbcb8ea4b59d7d0c3cbcbdbfa16516789
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132393
Reviewed-by: Alexander Timin <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Reviewed-by: Bryan McQuade <[email protected]>
Reviewed-by: Steven Holte <[email protected]>
Commit-Queue: Alexander Timin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#760530}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index d0401023..3529479 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2244,10 +2244,6 @@
     delegate_->LostCapture();
 }
 
-ukm::SourceId WebContentsImpl::GetUkmSourceIdForLastCommittedSource() const {
-  return last_committed_source_id_;
-}
-
 ukm::SourceId
 WebContentsImpl::GetUkmSourceIdForLastCommittedSourceIncludingSameDocument()
     const {
@@ -4564,8 +4560,6 @@
 
       if (!navigation_handle->IsSameDocument()) {
         was_ever_audible_ = false;
-        last_committed_source_id_ =
-            last_committed_source_id_including_same_document_;
       }
     }
 
@@ -6874,10 +6868,6 @@
   return GetAudioStreamFactory()->group_id();
 }
 
-ukm::SourceId WebContentsImpl::GetLastCommittedSourceId() {
-  return last_committed_source_id_;
-}
-
 const std::vector<blink::mojom::FaviconURLPtr>&
 WebContentsImpl::GetFaviconURLs() {
   return favicon_urls_;
@@ -7540,4 +7530,8 @@
   return focused_frame->GetFrameInputHandler();
 }
 
+ukm::SourceId WebContentsImpl::GetCurrentPageUkmSourceId() {
+  return GetMainFrame()->GetPageUkmSourceId();
+}
+
 }  // namespace content