[LSC] Replace base::string16 with std::u16string in //cr/browser/[h-z]*

This change replaces base::string16 with std::u16string in
//chrome/browser/[h-z]*.

Reproduction steps:
$ git grep -lw 'base::string16' chrome/browser/[h-z]* | \
      xargs sed -i 's/\bbase::string16\b/std::u16string/g'
$ git cl format

Bug: 1184339
Change-Id: Ibb73866fc5c9171ba525a1fd7dc9b4b7e619468d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2752228
Commit-Queue: Jan Wilken Dörrie <[email protected]>
Owners-Override: Peter Kasting <[email protected]>
Reviewed-by: Peter Kasting <[email protected]>
Cr-Commit-Position: refs/heads/master@{#862036}
diff --git a/chrome/browser/usb/usb_chooser_context.cc b/chrome/browser/usb/usb_chooser_context.cc
index 5384c469..39c0d93 100644
--- a/chrome/browser/usb/usb_chooser_context.cc
+++ b/chrome/browser/usb/usb_chooser_context.cc
@@ -68,7 +68,7 @@
   return std::make_pair(vendor_id, product_id);
 }
 
-base::string16 GetDeviceNameFromIds(int vendor_id, int product_id) {
+std::u16string GetDeviceNameFromIds(int vendor_id, int product_id) {
 #if !defined(OS_ANDROID)
   const char* product_name =
       device::UsbIds::GetProductName(vendor_id, product_id);
@@ -106,7 +106,7 @@
 
 base::Value DeviceIdsToValue(int vendor_id, int product_id) {
   base::Value device_value(base::Value::Type::DICTIONARY);
-  base::string16 device_name = GetDeviceNameFromIds(vendor_id, product_id);
+  std::u16string device_name = GetDeviceNameFromIds(vendor_id, product_id);
 
   device_value.SetStringKey(kDeviceNameKey, device_name);
   device_value.SetIntKey(kVendorIdKey, vendor_id);
@@ -421,7 +421,7 @@
           object.FindStringKey(kGuidKey));
 }
 
-base::string16 UsbChooserContext::GetObjectDisplayName(
+std::u16string UsbChooserContext::GetObjectDisplayName(
     const base::Value& object) {
   const std::string* name = object.FindStringKey(kDeviceNameKey);
   DCHECK(name);
diff --git a/chrome/browser/usb/usb_chooser_context.h b/chrome/browser/usb/usb_chooser_context.h
index 082fc526..c39eb34 100644
--- a/chrome/browser/usb/usb_chooser_context.h
+++ b/chrome/browser/usb/usb_chooser_context.h
@@ -55,7 +55,7 @@
   void RevokeObjectPermission(const url::Origin& origin,
                               const base::Value& object) override;
   bool IsValidObject(const base::Value& object) override;
-  base::string16 GetObjectDisplayName(const base::Value& object) override;
+  std::u16string GetObjectDisplayName(const base::Value& object) override;
 
   // Grants |origin| access to the USB device.
   void GrantDevicePermission(const url::Origin& origin,
diff --git a/chrome/browser/usb/usb_chooser_controller.cc b/chrome/browser/usb/usb_chooser_controller.cc
index bced457de..2d055ef 100644
--- a/chrome/browser/usb/usb_chooser_controller.cc
+++ b/chrome/browser/usb/usb_chooser_controller.cc
@@ -34,9 +34,9 @@
 
 namespace {
 
-base::string16 FormatUsbDeviceName(
+std::u16string FormatUsbDeviceName(
     const device::mojom::UsbDeviceInfo& device_info) {
-  base::string16 device_name;
+  std::u16string device_name;
   if (device_info.product_name)
     device_name = *device_info.product_name;
 
@@ -111,15 +111,15 @@
     std::move(callback_).Run(nullptr);
 }
 
-base::string16 UsbChooserController::GetNoOptionsText() const {
+std::u16string UsbChooserController::GetNoOptionsText() const {
   return l10n_util::GetStringUTF16(IDS_DEVICE_CHOOSER_NO_DEVICES_FOUND_PROMPT);
 }
 
-base::string16 UsbChooserController::GetOkButtonLabel() const {
+std::u16string UsbChooserController::GetOkButtonLabel() const {
   return l10n_util::GetStringUTF16(IDS_USB_DEVICE_CHOOSER_CONNECT_BUTTON_TEXT);
 }
 
-std::pair<base::string16, base::string16>
+std::pair<std::u16string, std::u16string>
 UsbChooserController::GetThrobberLabelAndTooltip() const {
   return {
       l10n_util::GetStringUTF16(IDS_USB_DEVICE_CHOOSER_LOADING_LABEL),
@@ -130,9 +130,9 @@
   return devices_.size();
 }
 
-base::string16 UsbChooserController::GetOption(size_t index) const {
+std::u16string UsbChooserController::GetOption(size_t index) const {
   DCHECK_LT(index, devices_.size());
-  const base::string16& device_name = devices_[index].second;
+  const std::u16string& device_name = devices_[index].second;
   const auto& it = device_name_map_.find(device_name);
   DCHECK(it != device_name_map_.end());
 
@@ -206,7 +206,7 @@
 void UsbChooserController::OnDeviceAdded(
     const device::mojom::UsbDeviceInfo& device_info) {
   if (DisplayDevice(device_info)) {
-    base::string16 device_name = FormatUsbDeviceName(device_info);
+    std::u16string device_name = FormatUsbDeviceName(device_info);
     devices_.push_back(std::make_pair(device_info.guid, device_name));
     ++device_name_map_[device_name];
     if (view())
@@ -241,7 +241,7 @@
   for (auto& device_info : devices) {
     DCHECK(device_info);
     if (DisplayDevice(*device_info)) {
-      base::string16 device_name = FormatUsbDeviceName(*device_info);
+      std::u16string device_name = FormatUsbDeviceName(*device_info);
       devices_.push_back(std::make_pair(device_info->guid, device_name));
       ++device_name_map_[device_name];
     }
diff --git a/chrome/browser/usb/usb_chooser_controller.h b/chrome/browser/usb/usb_chooser_controller.h
index 7641c4aa..826a31d8 100644
--- a/chrome/browser/usb/usb_chooser_controller.h
+++ b/chrome/browser/usb/usb_chooser_controller.h
@@ -36,12 +36,12 @@
   ~UsbChooserController() override;
 
   // ChooserController:
-  base::string16 GetNoOptionsText() const override;
-  base::string16 GetOkButtonLabel() const override;
-  std::pair<base::string16, base::string16> GetThrobberLabelAndTooltip()
+  std::u16string GetNoOptionsText() const override;
+  std::u16string GetOkButtonLabel() const override;
+  std::pair<std::u16string, std::u16string> GetThrobberLabelAndTooltip()
       const override;
   size_t NumOptions() const override;
-  base::string16 GetOption(size_t index) const override;
+  std::u16string GetOption(size_t index) const override;
   bool IsPaired(size_t index) const override;
   void Select(const std::vector<size_t>& indices) override;
   void Cancel() override;
@@ -68,9 +68,9 @@
       observer_;
 
   // Each pair is a (device guid, device name).
-  std::vector<std::pair<std::string, base::string16>> devices_;
+  std::vector<std::pair<std::string, std::u16string>> devices_;
   // Maps from device name to number of devices.
-  std::unordered_map<base::string16, int> device_name_map_;
+  std::unordered_map<std::u16string, int> device_name_map_;
   base::WeakPtrFactory<UsbChooserController> weak_factory_{this};
 
   DISALLOW_COPY_AND_ASSIGN(UsbChooserController);
diff --git a/chrome/browser/usb/web_usb_detector.cc b/chrome/browser/usb/web_usb_detector.cc
index 6e28665b..12ca403 100644
--- a/chrome/browser/usb/web_usb_detector.cc
+++ b/chrome/browser/usb/web_usb_detector.cc
@@ -125,7 +125,7 @@
   }
 
   void Click(const base::Optional<int>& button_index,
-             const base::Optional<base::string16>& reply) override {
+             const base::Optional<std::u16string>& reply) override {
     disposition_ = WEBUSB_NOTIFICATION_CLOSED_CLICKED;
 
     // If the URL is already open, activate that tab.
@@ -210,7 +210,7 @@
   if (!device_info->product_name || !device_info->webusb_landing_page)
     return;
 
-  const base::string16& product_name = *device_info->product_name;
+  const std::u16string& product_name = *device_info->product_name;
   if (product_name.empty())
     return;
 
@@ -240,7 +240,7 @@
               landing_page, url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC)),
       gfx::Image(gfx::CreateVectorIcon(vector_icons::kUsbIcon, 64,
                                        gfx::kChromeIconGrey)),
-      base::string16(), GURL(),
+      std::u16string(), GURL(),
       message_center::NotifierId(message_center::NotifierType::SYSTEM_COMPONENT,
                                  kNotifierWebUsb),
       rich_notification_data,
diff --git a/chrome/browser/usb/web_usb_detector_unittest.cc b/chrome/browser/usb/web_usb_detector_unittest.cc
index 3d813676..3cf5f0ba 100644
--- a/chrome/browser/usb/web_usb_detector_unittest.cc
+++ b/chrome/browser/usb/web_usb_detector_unittest.cc
@@ -134,10 +134,10 @@
   base::Optional<message_center::Notification> notification =
       display_service_->GetNotification(device->guid());
   ASSERT_TRUE(notification);
-  base::string16 expected_title =
+  std::u16string expected_title =
       base::ASCIIToUTF16("Google Product A detected");
   EXPECT_EQ(expected_title, notification->title());
-  base::string16 expected_message =
+  std::u16string expected_message =
       base::ASCIIToUTF16("Go to www.google.com to connect.");
   EXPECT_EQ(expected_message, notification->message());
   EXPECT_TRUE(notification->delegate() != nullptr);
@@ -332,10 +332,10 @@
   base::Optional<message_center::Notification> notification =
       display_service_->GetNotification(guid_2);
   ASSERT_TRUE(notification);
-  base::string16 expected_title =
+  std::u16string expected_title =
       base::ASCIIToUTF16("Google Product B detected");
   EXPECT_EQ(expected_title, notification->title());
-  base::string16 expected_message =
+  std::u16string expected_message =
       base::ASCIIToUTF16("Go to www.google.com to connect.");
   EXPECT_EQ(expected_message, notification->message());
   EXPECT_TRUE(notification->delegate() != nullptr);
@@ -369,10 +369,10 @@
   base::Optional<message_center::Notification> notification_1 =
       display_service_->GetNotification(guid_1);
   ASSERT_TRUE(notification_1);
-  base::string16 expected_title_1 =
+  std::u16string expected_title_1 =
       base::ASCIIToUTF16("Google Product A detected");
   EXPECT_EQ(expected_title_1, notification_1->title());
-  base::string16 expected_message_1 =
+  std::u16string expected_message_1 =
       base::ASCIIToUTF16("Go to www.google.com to connect.");
   EXPECT_EQ(expected_message_1, notification_1->message());
   EXPECT_TRUE(notification_1->delegate() != nullptr);
@@ -386,10 +386,10 @@
   base::Optional<message_center::Notification> notification_2 =
       display_service_->GetNotification(guid_2);
   ASSERT_TRUE(notification_2);
-  base::string16 expected_title_2 =
+  std::u16string expected_title_2 =
       base::ASCIIToUTF16("Google Product B detected");
   EXPECT_EQ(expected_title_2, notification_2->title());
-  base::string16 expected_message_2 =
+  std::u16string expected_message_2 =
       base::ASCIIToUTF16("Go to www.google.com to connect.");
   EXPECT_EQ(expected_message_2, notification_2->message());
   EXPECT_TRUE(notification_2->delegate() != nullptr);
@@ -403,10 +403,10 @@
   base::Optional<message_center::Notification> notification_3 =
       display_service_->GetNotification(guid_3);
   ASSERT_TRUE(notification_3);
-  base::string16 expected_title_3 =
+  std::u16string expected_title_3 =
       base::ASCIIToUTF16("Google Product C detected");
   EXPECT_EQ(expected_title_3, notification_3->title());
-  base::string16 expected_message_3 =
+  std::u16string expected_message_3 =
       base::ASCIIToUTF16("Go to www.google.com to connect.");
   EXPECT_EQ(expected_message_3, notification_3->message());
   EXPECT_TRUE(notification_3->delegate() != nullptr);
@@ -440,10 +440,10 @@
   base::Optional<message_center::Notification> notification_1 =
       display_service_->GetNotification(guid_1);
   ASSERT_TRUE(notification_1);
-  base::string16 expected_title_1 =
+  std::u16string expected_title_1 =
       base::ASCIIToUTF16("Google Product A detected");
   EXPECT_EQ(expected_title_1, notification_1->title());
-  base::string16 expected_message_1 =
+  std::u16string expected_message_1 =
       base::ASCIIToUTF16("Go to www.google.com to connect.");
   EXPECT_EQ(expected_message_1, notification_1->message());
   EXPECT_TRUE(notification_1->delegate() != nullptr);
@@ -453,10 +453,10 @@
   base::Optional<message_center::Notification> notification_2 =
       display_service_->GetNotification(guid_2);
   ASSERT_TRUE(notification_2);
-  base::string16 expected_title_2 =
+  std::u16string expected_title_2 =
       base::ASCIIToUTF16("Google Product B detected");
   EXPECT_EQ(expected_title_2, notification_2->title());
-  base::string16 expected_message_2 =
+  std::u16string expected_message_2 =
       base::ASCIIToUTF16("Go to www.google.com to connect.");
   EXPECT_EQ(expected_message_2, notification_2->message());
   EXPECT_TRUE(notification_2->delegate() != nullptr);
@@ -470,10 +470,10 @@
   base::Optional<message_center::Notification> notification_3 =
       display_service_->GetNotification(guid_3);
   ASSERT_TRUE(notification_3);
-  base::string16 expected_title_3 =
+  std::u16string expected_title_3 =
       base::ASCIIToUTF16("Google Product C detected");
   EXPECT_EQ(expected_title_3, notification_3->title());
-  base::string16 expected_message_3 =
+  std::u16string expected_message_3 =
       base::ASCIIToUTF16("Go to www.google.com to connect.");
   EXPECT_EQ(expected_message_3, notification_3->message());
   EXPECT_TRUE(notification_3->delegate() != nullptr);
@@ -636,10 +636,10 @@
   base::Optional<message_center::Notification> notification_1 =
       display_service_->GetNotification(guid_1);
   ASSERT_TRUE(notification_1);
-  base::string16 expected_title_1 =
+  std::u16string expected_title_1 =
       base::ASCIIToUTF16("Google Product A detected");
   EXPECT_EQ(expected_title_1, notification_1->title());
-  base::string16 expected_message_1 =
+  std::u16string expected_message_1 =
       base::ASCIIToUTF16("Go to www.google.com to connect.");
   EXPECT_EQ(expected_message_1, notification_1->message());
   EXPECT_TRUE(notification_1->delegate() != nullptr);
@@ -661,10 +661,10 @@
   base::Optional<message_center::Notification> notification_2 =
       display_service_->GetNotification(guid_2);
   ASSERT_TRUE(notification_2);
-  base::string16 expected_title_2 =
+  std::u16string expected_title_2 =
       base::ASCIIToUTF16("Google Product B detected");
   EXPECT_EQ(expected_title_2, notification_2->title());
-  base::string16 expected_message_2 =
+  std::u16string expected_message_2 =
       base::ASCIIToUTF16("Go to www.google.com to connect.");
   EXPECT_EQ(expected_message_2, notification_2->message());
   EXPECT_TRUE(notification_2->delegate() != nullptr);