[SH iOS] Cleanup for "Adding text fragment parsing"

This CL addresses a few comments that were received after landing
https://chromium-review.googlesource.com/c/chromium/src/+/2337407

Bug: 1099268
Change-Id: Ieb8fa406f69fc28ab15ce89d79030d93b39cc8ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2341665
Commit-Queue: Tommy Martino <tmartino@chromium.org>
Reviewed-by: Eugene But <eugenebut@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#796172}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 3f80a26c4e151f5ae16748ba551896268f8c0a3f
diff --git a/web/navigation/text_fragment_utils.mm b/web/navigation/text_fragment_utils.mm
index eae6df6..57688e4 100644
--- a/web/navigation/text_fragment_utils.mm
+++ b/web/navigation/text_fragment_utils.mm
@@ -4,6 +4,8 @@
 
 #import "ios/web/navigation/text_fragment_utils.h"
 
+#include <cstring.h>
+
 #include "base/strings/string_split.h"
 #include "ios/web/common/features.h"
 #import "ios/web/public/navigation/navigation_context.h"
@@ -14,8 +16,10 @@
 #endif
 
 namespace {
-const std::string kDirectivePrefix = ":~:";
-const std::string kTextFragmentPrefix = "text=";
+
+const char kDirectivePrefix[] = ":~:";
+const char kTextFragmentPrefix[] = "text=";
+
 }  // namespace
 
 namespace web {
@@ -63,7 +67,7 @@
   size_t start_pos = ref_string.find(kDirectivePrefix);
   if (start_pos == std::string::npos)
     return {};
-  ref_string.erase(0, start_pos + kDirectivePrefix.size());
+  ref_string.erase(0, start_pos + strlen(kDirectivePrefix));
 
   std::vector<std::string> fragment_strings;
   while (ref_string.size()) {
@@ -71,7 +75,7 @@
     size_t prefix_pos = ref_string.find(kTextFragmentPrefix);
     if (prefix_pos == std::string::npos)
       break;
-    ref_string.erase(0, prefix_pos + kTextFragmentPrefix.size());
+    ref_string.erase(0, prefix_pos + strlen(kTextFragmentPrefix));
 
     // A & indicates the end of the fragment (and the start of the next).
     // Save everything up to this point, and then consume it (including the &).
diff --git a/web/navigation/text_fragment_utils_unittest.mm b/web/navigation/text_fragment_utils_unittest.mm
index 508a4f8..3b715b8 100644
--- a/web/navigation/text_fragment_utils_unittest.mm
+++ b/web/navigation/text_fragment_utils_unittest.mm
@@ -18,12 +18,16 @@
 #error "This file requires ARC support."
 #endif
 
+namespace {
+
 // These values correspond to the members that the JavaScript implementation is
 // expecting.
-const std::string kPrefixKey = "prefix";
-const std::string kTextStartKey = "textStart";
-const std::string kTextEndKey = "textEnd";
-const std::string kSuffixKey = "suffix";
+const char kPrefixKey[] = "prefix";
+const char kTextStartKey[] = "textStart";
+const char kTextEndKey[] = "textEnd";
+const char kSuffixKey[] = "suffix";
+
+}  // namespace
 
 namespace web {