content: Move encoding from RenderFrameHostImpl => PageImpl

[email protected]

Bug: 1225366
Change-Id: I737622cc85fe1f28ce277bed74b3c04b7476eb61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3266393
Reviewed-by: Alexander Timin <[email protected]>
Commit-Queue: Dominic Farolino <[email protected]>
Cr-Commit-Position: refs/heads/main@{#952702}
diff --git a/content/browser/renderer_host/page_impl.cc b/content/browser/renderer_host/page_impl.cc
index ce4287f..2e175c4 100644
--- a/content/browser/renderer_host/page_impl.cc
+++ b/content/browser/renderer_host/page_impl.cc
@@ -5,6 +5,7 @@
 #include "content/browser/renderer_host/page_impl.h"
 
 #include "base/barrier_closure.h"
+#include "base/i18n/character_encoding.h"
 #include "base/trace_event/optional_trace_event.h"
 #include "content/browser/manifest/manifest_manager_host.h"
 #include "content/browser/renderer_host/frame_tree_node.h"
@@ -248,4 +249,13 @@
       constraints, current, animate);
 }
 
+void PageImpl::UpdateEncoding(const std::string& encoding_name) {
+  if (encoding_name == last_reported_encoding_)
+    return;
+  last_reported_encoding_ = encoding_name;
+
+  canonical_encoding_ =
+      base::GetCanonicalEncodingNameByAliasName(encoding_name);
+}
+
 }  // namespace content