Introduce StoragePartitionId type to wrap current string representation.

This change simply creates an explicit type to wrap the string that is
used to represent the storage partition ID. This is the first step in
migrating away from the string representation to a
StoragePartitionConfig. The type will make it easier to switch out the
representation and simplify reviews during the transition. There are
no significant behavior changes in this patch.

- Created StoragePartitionId type and update all existing code to use
  it.
- Remove ContentBrowserClient::IsValidStoragePartitionId() since it was
  not really used and place existing validation in StoragePartitionId
  constructor.
- Created CreateMapWithDefaultSessionStorageNamespace() helper function
  to simplify code that creates a default map. This function helps
  prevent followup changes from having to revisit these call sites as
  the representation evolves.

Bug: 1166021
Change-Id: I40b505255c7803b353a86b5b1803e3539dd3049e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2734095
Reviewed-by: Ryan Sturm <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Reilly Grant <[email protected]>
Commit-Queue: Aaron Colwell <[email protected]>
Cr-Commit-Position: refs/heads/master@{#862098}
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc
index edb4b2e..9af368c 100644
--- a/content/browser/renderer_host/navigation_controller_impl.cc
+++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -2485,7 +2485,7 @@
 }
 
 void NavigationControllerImpl::SetSessionStorageNamespace(
-    const std::string& partition_id,
+    const StoragePartitionId& partition_id,
     SessionStorageNamespace* session_storage_namespace) {
   if (!session_storage_namespace)
     return;
@@ -2495,9 +2495,9 @@
   // so die hard on an error.
   bool successful_insert =
       session_storage_namespace_map_
-          .insert(
-              make_pair(partition_id, static_cast<SessionStorageNamespaceImpl*>(
-                                          session_storage_namespace)))
+          .insert(std::make_pair(partition_id,
+                                 static_cast<SessionStorageNamespaceImpl*>(
+                                     session_storage_namespace)))
           .second;
   CHECK(successful_insert) << "Cannot replace existing SessionStorageNamespace";
 }
@@ -2509,7 +2509,7 @@
 
 SessionStorageNamespace* NavigationControllerImpl::GetSessionStorageNamespace(
     SiteInstance* instance) {
-  std::string partition_id;
+  StoragePartitionId partition_id;
   if (instance) {
     // TODO(ajwong): When GetDefaultSessionStorageNamespace() goes away, remove
     // this if statement so |instance| must not be null.