Convert base::StringPiece to std::string_view left overs.

The changes of this CL are made using the following script.
Script: https://issues.chromium.org/issues/40506050#comment343

Bug: 40506050
Change-Id: I768b3590141a698385319a615f2aefb71215ec84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5601472
Reviewed-by: Nico Weber <thakis@chromium.org>
Auto-Submit: Helmut Januschka <helmut@januschka.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Owners-Override: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1313356}
NOKEYCHECK=True
GitOrigin-RevId: 1dce9dcaeaa1b6b2a278869566f7554c62b10dc7
diff --git a/google/zip_internal.cc b/google/zip_internal.cc
index d15c6cf..aa49f45 100644
--- a/google/zip_internal.cc
+++ b/google/zip_internal.cc
@@ -8,12 +8,12 @@
 #include <string.h>
 
 #include <algorithm>
+#include <string_view>
 
 #include "base/containers/fixed_flat_set.h"
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/notreached.h"
-#include "base/strings/string_piece.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 
@@ -398,64 +398,64 @@
   if (ext.empty())
     return kDeflated;
 
-  using StringPiece = base::FilePath::StringPieceType;
 
   // Skip the leading dot.
-  StringPiece ext_without_dot = ext;
+  base::FilePath::StringPieceType ext_without_dot = ext;
   DCHECK_EQ(ext_without_dot.front(), FILE_PATH_LITERAL('.'));
   ext_without_dot.remove_prefix(1);
 
   // Well known filename extensions of files that a likely to be already
   // compressed. The extensions are in lower case without the leading dot.
-  static constexpr auto kExts = base::MakeFixedFlatSet<StringPiece>({
-      FILE_PATH_LITERAL("3g2"),   //
-      FILE_PATH_LITERAL("3gp"),   //
-      FILE_PATH_LITERAL("7z"),    //
-      FILE_PATH_LITERAL("7zip"),  //
-      FILE_PATH_LITERAL("aac"),   //
-      FILE_PATH_LITERAL("avi"),   //
-      FILE_PATH_LITERAL("bz"),    //
-      FILE_PATH_LITERAL("bz2"),   //
-      FILE_PATH_LITERAL("crx"),   //
-      FILE_PATH_LITERAL("gif"),   //
-      FILE_PATH_LITERAL("gz"),    //
-      FILE_PATH_LITERAL("jar"),   //
-      FILE_PATH_LITERAL("jpeg"),  //
-      FILE_PATH_LITERAL("jpg"),   //
-      FILE_PATH_LITERAL("lz"),    //
-      FILE_PATH_LITERAL("m2v"),   //
-      FILE_PATH_LITERAL("m4p"),   //
-      FILE_PATH_LITERAL("m4v"),   //
-      FILE_PATH_LITERAL("mng"),   //
-      FILE_PATH_LITERAL("mov"),   //
-      FILE_PATH_LITERAL("mp2"),   //
-      FILE_PATH_LITERAL("mp3"),   //
-      FILE_PATH_LITERAL("mp4"),   //
-      FILE_PATH_LITERAL("mpe"),   //
-      FILE_PATH_LITERAL("mpeg"),  //
-      FILE_PATH_LITERAL("mpg"),   //
-      FILE_PATH_LITERAL("mpv"),   //
-      FILE_PATH_LITERAL("ogg"),   //
-      FILE_PATH_LITERAL("ogv"),   //
-      FILE_PATH_LITERAL("png"),   //
-      FILE_PATH_LITERAL("qt"),    //
-      FILE_PATH_LITERAL("rar"),   //
-      FILE_PATH_LITERAL("taz"),   //
-      FILE_PATH_LITERAL("tb2"),   //
-      FILE_PATH_LITERAL("tbz"),   //
-      FILE_PATH_LITERAL("tbz2"),  //
-      FILE_PATH_LITERAL("tgz"),   //
-      FILE_PATH_LITERAL("tlz"),   //
-      FILE_PATH_LITERAL("tz"),    //
-      FILE_PATH_LITERAL("tz2"),   //
-      FILE_PATH_LITERAL("vob"),   //
-      FILE_PATH_LITERAL("webm"),  //
-      FILE_PATH_LITERAL("wma"),   //
-      FILE_PATH_LITERAL("wmv"),   //
-      FILE_PATH_LITERAL("xz"),    //
-      FILE_PATH_LITERAL("z"),     //
-      FILE_PATH_LITERAL("zip"),   //
-  });
+  static constexpr auto kExts =
+      base::MakeFixedFlatSet<base::FilePath::StringPieceType>({
+          FILE_PATH_LITERAL("3g2"),   //
+          FILE_PATH_LITERAL("3gp"),   //
+          FILE_PATH_LITERAL("7z"),    //
+          FILE_PATH_LITERAL("7zip"),  //
+          FILE_PATH_LITERAL("aac"),   //
+          FILE_PATH_LITERAL("avi"),   //
+          FILE_PATH_LITERAL("bz"),    //
+          FILE_PATH_LITERAL("bz2"),   //
+          FILE_PATH_LITERAL("crx"),   //
+          FILE_PATH_LITERAL("gif"),   //
+          FILE_PATH_LITERAL("gz"),    //
+          FILE_PATH_LITERAL("jar"),   //
+          FILE_PATH_LITERAL("jpeg"),  //
+          FILE_PATH_LITERAL("jpg"),   //
+          FILE_PATH_LITERAL("lz"),    //
+          FILE_PATH_LITERAL("m2v"),   //
+          FILE_PATH_LITERAL("m4p"),   //
+          FILE_PATH_LITERAL("m4v"),   //
+          FILE_PATH_LITERAL("mng"),   //
+          FILE_PATH_LITERAL("mov"),   //
+          FILE_PATH_LITERAL("mp2"),   //
+          FILE_PATH_LITERAL("mp3"),   //
+          FILE_PATH_LITERAL("mp4"),   //
+          FILE_PATH_LITERAL("mpe"),   //
+          FILE_PATH_LITERAL("mpeg"),  //
+          FILE_PATH_LITERAL("mpg"),   //
+          FILE_PATH_LITERAL("mpv"),   //
+          FILE_PATH_LITERAL("ogg"),   //
+          FILE_PATH_LITERAL("ogv"),   //
+          FILE_PATH_LITERAL("png"),   //
+          FILE_PATH_LITERAL("qt"),    //
+          FILE_PATH_LITERAL("rar"),   //
+          FILE_PATH_LITERAL("taz"),   //
+          FILE_PATH_LITERAL("tb2"),   //
+          FILE_PATH_LITERAL("tbz"),   //
+          FILE_PATH_LITERAL("tbz2"),  //
+          FILE_PATH_LITERAL("tgz"),   //
+          FILE_PATH_LITERAL("tlz"),   //
+          FILE_PATH_LITERAL("tz"),    //
+          FILE_PATH_LITERAL("tz2"),   //
+          FILE_PATH_LITERAL("vob"),   //
+          FILE_PATH_LITERAL("webm"),  //
+          FILE_PATH_LITERAL("wma"),   //
+          FILE_PATH_LITERAL("wmv"),   //
+          FILE_PATH_LITERAL("xz"),    //
+          FILE_PATH_LITERAL("z"),     //
+          FILE_PATH_LITERAL("zip"),   //
+      });
 
   if (kExts.count(ext_without_dot)) {
     return kStored;
diff --git a/google/zip_reader.cc b/google/zip_reader.cc
index 34a815e..182a802 100644
--- a/google/zip_reader.cc
+++ b/google/zip_reader.cc
@@ -5,6 +5,7 @@
 #include "third_party/zlib/google/zip_reader.h"
 
 #include <algorithm>
+#include <string_view>
 #include <utility>
 
 #include "base/check.h"
@@ -15,7 +16,6 @@
 #include "base/logging.h"
 #include "base/numerics/safe_conversions.h"
 #include "base/strings/strcat.h"
-#include "base/strings/string_piece.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/task/sequenced_task_runner.h"
@@ -267,7 +267,7 @@
   return true;
 }
 
-void ZipReader::Normalize(base::StringPiece16 in) {
+void ZipReader::Normalize(std::u16string_view in) {
   entry_.is_unsafe = true;
 
   // Directory entries in ZIP have a path ending with "/".
@@ -281,15 +281,16 @@
 
   for (;;) {
     // Consume initial path separators.
-    const base::StringPiece16::size_type i = in.find_first_not_of(u'/');
-    if (i == base::StringPiece16::npos)
+    const std::u16string_view::size_type i = in.find_first_not_of(u'/');
+    if (i == std::u16string_view::npos) {
       break;
+    }
 
     in.remove_prefix(i);
     DCHECK(!in.empty());
 
     // Isolate next path component.
-    const base::StringPiece16 part = in.substr(0, in.find_first_of(u'/'));
+    const std::u16string_view part = in.substr(0, in.find_first_of(u'/'));
     DCHECK(!part.empty());
 
     in.remove_prefix(part.size());
diff --git a/google/zip_reader.h b/google/zip_reader.h
index b7680cc..0dbf50b 100644
--- a/google/zip_reader.h
+++ b/google/zip_reader.h
@@ -10,6 +10,7 @@
 #include <limits>
 #include <memory>
 #include <string>
+#include <string_view>
 
 #include "base/files/file.h"
 #include "base/files/file_path.h"
@@ -281,7 +282,7 @@
 
   // Normalizes the given path passed as UTF-16 string piece. Sets entry_.path,
   // entry_.is_directory and entry_.is_unsafe.
-  void Normalize(base::StringPiece16 in);
+  void Normalize(std::u16string_view in);
 
   // Runs the ListenerCallback at a throttled rate.
   void ReportProgress(ListenerCallback listener_callback, uint64_t bytes) const;
diff --git a/google/zip_reader_unittest.cc b/google/zip_reader_unittest.cc
index 9eb7d7d..9d1406f 100644
--- a/google/zip_reader_unittest.cc
+++ b/google/zip_reader_unittest.cc
@@ -10,6 +10,7 @@
 
 #include <iterator>
 #include <string>
+#include <string_view>
 #include <vector>
 
 #include "base/check.h"
@@ -22,7 +23,6 @@
 #include "base/i18n/time_formatting.h"
 #include "base/path_service.h"
 #include "base/run_loop.h"
-#include "base/strings/string_piece.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/test/bind.h"
@@ -172,7 +172,7 @@
   }
 
   static Paths GetPaths(const base::FilePath& zip_path,
-                        base::StringPiece encoding = {}) {
+                        std::string_view encoding = {}) {
     Paths paths;
 
     if (ZipReader reader; reader.Open(zip_path)) {
@@ -422,7 +422,7 @@
     EXPECT_EQ("This is not encrypted.\n", contents);
   }
 
-  for (const base::StringPiece path : {
+  for (const std::string_view path : {
            "Encrypted AES-128.txt",
            "Encrypted AES-192.txt",
            "Encrypted AES-256.txt",
@@ -458,7 +458,7 @@
   }
 
   // TODO(crbug.com/1296838) Support AES encryption.
-  for (const base::StringPiece path : {
+  for (const std::string_view path : {
            "Encrypted AES-128.txt",
            "Encrypted AES-192.txt",
            "Encrypted AES-256.txt",
@@ -713,12 +713,12 @@
     if (i > 0) {
       // Exact byte read limit: must pass.
       EXPECT_TRUE(reader.ExtractCurrentEntryToString(i, &contents));
-      EXPECT_EQ(std::string(base::StringPiece("0123456", i)), contents);
+      EXPECT_EQ(std::string(std::string_view("0123456", i)), contents);
     }
 
     // More than necessary byte read limit: must pass.
     EXPECT_TRUE(reader.ExtractCurrentEntryToString(&contents));
-    EXPECT_EQ(std::string(base::StringPiece("0123456", i)), contents);
+    EXPECT_EQ(std::string(std::string_view("0123456", i)), contents);
   }
   reader.Close();
 }
diff --git a/google/zip_unittest.cc b/google/zip_unittest.cc
index 922d383..58bafb8 100644
--- a/google/zip_unittest.cc
+++ b/google/zip_unittest.cc
@@ -2,12 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "third_party/zlib/google/zip.h"
+
 #include <stddef.h>
 #include <stdint.h>
 
 #include <iomanip>
 #include <limits>
 #include <string>
+#include <string_view>
 #include <unordered_map>
 #include <unordered_set>
 #include <vector>
@@ -29,7 +32,6 @@
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/platform_test.h"
-#include "third_party/zlib/google/zip.h"
 #include "third_party/zlib/google/zip_internal.h"
 #include "third_party/zlib/google/zip_reader.h"
 
@@ -1290,7 +1292,7 @@
   EXPECT_TRUE(base::CreateDirectory(src_dir));
 
   // Create some dummy source files.
-  for (const base::StringPiece s : {"foo", "bar.txt", ".hidden"}) {
+  for (const std::string_view s : {"foo", "bar.txt", ".hidden"}) {
     base::File f(src_dir.AppendASCII(s),
                  base::File::FLAG_CREATE | base::File::FLAG_WRITE);
     ASSERT_TRUE(f.SetLength(5000));