From 22d8f22cfb698e9cd8667cdf14b1d68b76df8d4e Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 12:18:45 -0400 Subject: [PATCH] 2757472: Reland "Reland "[LSC] Remove base::string16 alias"" https://chromium-review.googlesource.com/c/chromium/src/+/2757472 --- .../browser/certificate_manager_model.cc | 2 +- .../browser/certificate_manager_model.h | 2 +- shell/app/electron_content_client.cc | 2 +- shell/app/electron_content_client.h | 2 +- shell/browser/api/electron_api_app.cc | 2 +- shell/browser/api/electron_api_base_window.cc | 6 +- .../api/electron_api_browser_window.cc | 2 +- .../browser/api/electron_api_browser_window.h | 2 +- shell/browser/api/electron_api_menu.cc | 22 ++-- shell/browser/api/electron_api_menu.h | 22 ++-- .../browser/api/electron_api_notification.cc | 36 +++--- shell/browser/api/electron_api_notification.h | 56 ++++----- shell/browser/api/electron_api_url_loader.cc | 2 +- .../browser/api/electron_api_web_contents.cc | 26 ++--- shell/browser/api/electron_api_web_contents.h | 14 +-- .../api/electron_api_web_frame_main.cc | 2 +- .../browser/api/electron_api_web_frame_main.h | 2 +- shell/browser/browser.h | 24 ++-- shell/browser/browser_linux.cc | 4 +- shell/browser/browser_mac.mm | 14 +-- shell/browser/browser_win.cc | 106 +++++++++--------- shell/browser/electron_autofill_driver.cc | 4 +- shell/browser/electron_autofill_driver.h | 4 +- shell/browser/electron_browser_client.cc | 2 +- shell/browser/electron_browser_main_parts.cc | 4 +- .../electron_javascript_dialog_manager.cc | 14 +-- .../electron_javascript_dialog_manager.h | 4 +- .../browser/extended_web_contents_observer.h | 2 +- .../electron_management_api_delegate.cc | 2 +- .../electron_management_api_delegate.h | 2 +- shell/browser/file_select_helper.cc | 2 +- shell/browser/font_defaults.cc | 8 +- shell/browser/lib/bluetooth_chooser.cc | 2 +- shell/browser/lib/bluetooth_chooser.h | 6 +- shell/browser/login_handler.cc | 2 +- shell/browser/native_window.cc | 2 +- shell/browser/native_window.h | 4 +- shell/browser/native_window_observer.h | 2 +- shell/browser/native_window_views.cc | 2 +- shell/browser/native_window_views.h | 2 +- shell/browser/notifications/notification.h | 22 ++-- .../win/notification_presenter_win.cc | 2 +- .../win/notification_presenter_win.h | 2 +- .../osr/osr_render_widget_host_view.cc | 2 +- .../browser/osr/osr_render_widget_host_view.h | 2 +- shell/browser/osr/osr_web_contents_view.cc | 2 +- shell/browser/osr/osr_web_contents_view.h | 2 +- shell/browser/ui/autofill_popup.cc | 8 +- shell/browser/ui/autofill_popup.h | 12 +- .../ui/cocoa/electron_menu_controller.mm | 10 +- shell/browser/ui/electron_menu_model.cc | 18 +-- shell/browser/ui/electron_menu_model.h | 18 +-- shell/browser/ui/gtk/app_indicator_icon.cc | 4 +- shell/browser/ui/gtk/app_indicator_icon.h | 4 +- shell/browser/ui/gtk/gtk_status_icon.cc | 4 +- shell/browser/ui/gtk/gtk_status_icon.h | 4 +- shell/browser/ui/gtk/status_icon.cc | 2 +- shell/browser/ui/gtk/status_icon.h | 2 +- shell/browser/ui/inspectable_web_contents.cc | 8 +- shell/browser/ui/inspectable_web_contents.h | 4 +- .../ui/inspectable_web_contents_view.h | 2 +- .../ui/inspectable_web_contents_view_mac.h | 2 +- .../ui/inspectable_web_contents_view_mac.mm | 2 +- shell/browser/ui/message_box.h | 2 +- shell/browser/ui/message_box_gtk.cc | 2 +- shell/browser/ui/message_box_mac.mm | 2 +- shell/browser/ui/message_box_win.cc | 30 ++--- shell/browser/ui/tray_icon.h | 4 +- shell/browser/ui/tray_icon_gtk.cc | 2 +- shell/browser/ui/tray_icon_gtk.h | 4 +- shell/browser/ui/views/autofill_popup_view.h | 4 +- .../ui/views/electron_views_delegate.cc | 4 +- .../ui/views/electron_views_delegate.h | 4 +- shell/browser/ui/views/global_menu_bar_x11.cc | 2 +- .../inspectable_web_contents_view_views.cc | 4 +- .../inspectable_web_contents_view_views.h | 6 +- shell/browser/ui/views/menu_delegate.cc | 2 +- shell/browser/ui/views/menu_delegate.h | 2 +- shell/browser/ui/views/submenu_button.cc | 8 +- shell/browser/ui/views/submenu_button.h | 6 +- shell/browser/ui/win/jump_list.cc | 2 +- shell/browser/ui/win/jump_list.h | 12 +- shell/browser/web_contents_preferences.cc | 4 +- shell/browser/web_dialog_helper.cc | 4 +- shell/common/api/electron_api_clipboard.cc | 32 +++--- shell/common/api/electron_api_clipboard.h | 18 +-- .../common/api/electron_api_clipboard_mac.mm | 4 +- shell/common/api/electron_api_shell.cc | 2 +- shell/common/application_info.h | 2 +- shell/common/application_info_win.cc | 6 +- .../common/gin_converters/blink_converter.cc | 6 +- shell/common/language_util.h | 2 +- shell/common/language_util_win.cc | 4 +- shell/common/platform_util_win.cc | 4 +- .../api/electron_api_spell_check_client.cc | 30 ++--- .../api/electron_api_spell_check_client.h | 8 +- shell/renderer/api/electron_api_web_frame.cc | 22 ++-- shell/renderer/electron_autofill_agent.cc | 18 +-- shell/renderer/electron_autofill_agent.h | 6 +- shell/renderer/renderer_client_base.cc | 2 +- 100 files changed, 417 insertions(+), 417 deletions(-) diff --git a/chromium_src/chrome/browser/certificate_manager_model.cc b/chromium_src/chrome/browser/certificate_manager_model.cc index 8a38b5370853..4166c8b36d19 100644 --- a/chromium_src/chrome/browser/certificate_manager_model.cc +++ b/chromium_src/chrome/browser/certificate_manager_model.cc @@ -90,7 +90,7 @@ CertificateManagerModel::~CertificateManagerModel() = default; int CertificateManagerModel::ImportFromPKCS12( PK11SlotInfo* slot_info, const std::string& data, - const base::string16& password, + const std::u16string& password, bool is_extractable, net::ScopedCERTCertificateList* imported_certs) { return cert_db_->ImportFromPKCS12(slot_info, data, password, is_extractable, diff --git a/chromium_src/chrome/browser/certificate_manager_model.h b/chromium_src/chrome/browser/certificate_manager_model.h index b68a650e24b1..661a524aecd8 100644 --- a/chromium_src/chrome/browser/certificate_manager_model.h +++ b/chromium_src/chrome/browser/certificate_manager_model.h @@ -46,7 +46,7 @@ class CertificateManagerModel { // Returns a net error code on failure. int ImportFromPKCS12(PK11SlotInfo* slot_info, const std::string& data, - const base::string16& password, + const std::u16string& password, bool is_extractable, net::ScopedCERTCertificateList* imported_certs); diff --git a/shell/app/electron_content_client.cc b/shell/app/electron_content_client.cc index 530637ac4d54..421601aefb7e 100644 --- a/shell/app/electron_content_client.cc +++ b/shell/app/electron_content_client.cc @@ -161,7 +161,7 @@ ElectronContentClient::ElectronContentClient() = default; ElectronContentClient::~ElectronContentClient() = default; -base::string16 ElectronContentClient::GetLocalizedString(int message_id) { +std::u16string ElectronContentClient::GetLocalizedString(int message_id) { return l10n_util::GetStringUTF16(message_id); } diff --git a/shell/app/electron_content_client.h b/shell/app/electron_content_client.h index 0e6eb9715e06..8ac3a688da3a 100644 --- a/shell/app/electron_content_client.h +++ b/shell/app/electron_content_client.h @@ -21,7 +21,7 @@ class ElectronContentClient : public content::ContentClient { protected: // content::ContentClient: - base::string16 GetLocalizedString(int message_id) override; + std::u16string GetLocalizedString(int message_id) override; base::StringPiece GetDataResource(int resource_id, ui::ScaleFactor) override; gfx::Image& GetNativeImageNamed(int resource_id) override; base::RefCountedMemory* GetDataResourceBytes(int resource_id) override; diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index 9ffe14483f12..0bbd531f51a3 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -549,7 +549,7 @@ void OnClientCertificateSelected( #if defined(USE_NSS_CERTS) int ImportIntoCertStore(CertificateManagerModel* model, base::Value options) { std::string file_data, cert_path; - base::string16 password; + std::u16string password; net::ScopedCERTCertificateList imported_certs; int rv = -1; diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index ff233e56bcbf..ec3b6f7d223c 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -1089,11 +1089,11 @@ bool BaseWindow::SetThumbnailToolTip(const std::string& tooltip) { } void BaseWindow::SetAppDetails(const gin_helper::Dictionary& options) { - base::string16 app_id; + std::u16string app_id; base::FilePath app_icon_path; int app_icon_index = 0; - base::string16 relaunch_command; - base::string16 relaunch_display_name; + std::u16string relaunch_command; + std::u16string relaunch_display_name; options.Get("appId", &app_id); options.Get("appIconPath", &app_icon_path); diff --git a/shell/browser/api/electron_api_browser_window.cc b/shell/browser/api/electron_api_browser_window.cc index 1ba361cbc379..b7ade31bdcd5 100644 --- a/shell/browser/api/electron_api_browser_window.cc +++ b/shell/browser/api/electron_api_browser_window.cc @@ -210,7 +210,7 @@ void BrowserWindow::OnActivateContents() { #endif } -void BrowserWindow::OnPageTitleUpdated(const base::string16& title, +void BrowserWindow::OnPageTitleUpdated(const std::u16string& title, bool explicit_set) { // Change window title to page title. auto self = GetWeakPtr(); diff --git a/shell/browser/api/electron_api_browser_window.h b/shell/browser/api/electron_api_browser_window.h index f0547d8039ad..d398249aee77 100644 --- a/shell/browser/api/electron_api_browser_window.h +++ b/shell/browser/api/electron_api_browser_window.h @@ -62,7 +62,7 @@ class BrowserWindow : public BaseWindow, const std::vector& regions) override; void OnSetContentBounds(const gfx::Rect& rect) override; void OnActivateContents() override; - void OnPageTitleUpdated(const base::string16& title, + void OnPageTitleUpdated(const std::u16string& title, bool explicit_set) override; #if defined(OS_MAC) void OnDevToolsResized() override; diff --git a/shell/browser/api/electron_api_menu.cc b/shell/browser/api/electron_api_menu.cc index 2ae9d02dce15..c973fa714ef0 100644 --- a/shell/browser/api/electron_api_menu.cc +++ b/shell/browser/api/electron_api_menu.cc @@ -163,7 +163,7 @@ base::OnceClosure Menu::BindSelfToClosure(base::OnceClosure callback) { void Menu::InsertItemAt(int index, int command_id, - const base::string16& label) { + const std::u16string& label) { model_->InsertItemAt(index, command_id, label); } @@ -173,20 +173,20 @@ void Menu::InsertSeparatorAt(int index) { void Menu::InsertCheckItemAt(int index, int command_id, - const base::string16& label) { + const std::u16string& label) { model_->InsertCheckItemAt(index, command_id, label); } void Menu::InsertRadioItemAt(int index, int command_id, - const base::string16& label, + const std::u16string& label, int group_id) { model_->InsertRadioItemAt(index, command_id, label, group_id); } void Menu::InsertSubMenuAt(int index, int command_id, - const base::string16& label, + const std::u16string& label, Menu* menu) { menu->parent_ = this; model_->InsertSubMenuAt(index, command_id, label, menu->model_.get()); @@ -196,15 +196,15 @@ void Menu::SetIcon(int index, const gfx::Image& image) { model_->SetIcon(index, ui::ImageModel::FromImage(image)); } -void Menu::SetSublabel(int index, const base::string16& sublabel) { +void Menu::SetSublabel(int index, const std::u16string& sublabel) { model_->SetSecondaryLabel(index, sublabel); } -void Menu::SetToolTip(int index, const base::string16& toolTip) { +void Menu::SetToolTip(int index, const std::u16string& toolTip) { model_->SetToolTip(index, toolTip); } -void Menu::SetRole(int index, const base::string16& role) { +void Menu::SetRole(int index, const std::u16string& role) { model_->SetRole(index, role); } @@ -224,19 +224,19 @@ int Menu::GetCommandIdAt(int index) const { return model_->GetCommandIdAt(index); } -base::string16 Menu::GetLabelAt(int index) const { +std::u16string Menu::GetLabelAt(int index) const { return model_->GetLabelAt(index); } -base::string16 Menu::GetSublabelAt(int index) const { +std::u16string Menu::GetSublabelAt(int index) const { return model_->GetSecondaryLabelAt(index); } -base::string16 Menu::GetToolTipAt(int index) const { +std::u16string Menu::GetToolTipAt(int index) const { return model_->GetToolTipAt(index); } -base::string16 Menu::GetAcceleratorTextAt(int index) const { +std::u16string Menu::GetAcceleratorTextAt(int index) const { ui::Accelerator accelerator; model_->GetAcceleratorAtWithParams(index, true, &accelerator); return accelerator.GetShortcutText(); diff --git a/shell/browser/api/electron_api_menu.h b/shell/browser/api/electron_api_menu.h index 5c47990fa69f..89150f5bd341 100644 --- a/shell/browser/api/electron_api_menu.h +++ b/shell/browser/api/electron_api_menu.h @@ -87,31 +87,31 @@ class Menu : public gin::Wrappable, void OnMenuWillShow() override; private: - void InsertItemAt(int index, int command_id, const base::string16& label); + void InsertItemAt(int index, int command_id, const std::u16string& label); void InsertSeparatorAt(int index); void InsertCheckItemAt(int index, int command_id, - const base::string16& label); + const std::u16string& label); void InsertRadioItemAt(int index, int command_id, - const base::string16& label, + const std::u16string& label, int group_id); void InsertSubMenuAt(int index, int command_id, - const base::string16& label, + const std::u16string& label, Menu* menu); void SetIcon(int index, const gfx::Image& image); - void SetSublabel(int index, const base::string16& sublabel); - void SetToolTip(int index, const base::string16& toolTip); - void SetRole(int index, const base::string16& role); + void SetSublabel(int index, const std::u16string& sublabel); + void SetToolTip(int index, const std::u16string& toolTip); + void SetRole(int index, const std::u16string& role); void Clear(); int GetIndexOfCommandId(int command_id); int GetItemCount() const; int GetCommandIdAt(int index) const; - base::string16 GetLabelAt(int index) const; - base::string16 GetSublabelAt(int index) const; - base::string16 GetToolTipAt(int index) const; - base::string16 GetAcceleratorTextAt(int index) const; + std::u16string GetLabelAt(int index) const; + std::u16string GetSublabelAt(int index) const; + std::u16string GetToolTipAt(int index) const; + std::u16string GetAcceleratorTextAt(int index) const; bool IsItemCheckedAt(int index) const; bool IsEnabledAt(int index) const; bool IsVisibleAt(int index) const; diff --git a/shell/browser/api/electron_api_notification.cc b/shell/browser/api/electron_api_notification.cc index 501daa43232d..5216b7407df3 100644 --- a/shell/browser/api/electron_api_notification.cc +++ b/shell/browser/api/electron_api_notification.cc @@ -92,15 +92,15 @@ gin::Handle Notification::New(gin_helper::ErrorThrower thrower, } // Getters -base::string16 Notification::GetTitle() const { +std::u16string Notification::GetTitle() const { return title_; } -base::string16 Notification::GetSubtitle() const { +std::u16string Notification::GetSubtitle() const { return subtitle_; } -base::string16 Notification::GetBody() const { +std::u16string Notification::GetBody() const { return body_; } @@ -112,19 +112,19 @@ bool Notification::GetHasReply() const { return has_reply_; } -base::string16 Notification::GetTimeoutType() const { +std::u16string Notification::GetTimeoutType() const { return timeout_type_; } -base::string16 Notification::GetReplyPlaceholder() const { +std::u16string Notification::GetReplyPlaceholder() const { return reply_placeholder_; } -base::string16 Notification::GetSound() const { +std::u16string Notification::GetSound() const { return sound_; } -base::string16 Notification::GetUrgency() const { +std::u16string Notification::GetUrgency() const { return urgency_; } @@ -132,24 +132,24 @@ std::vector Notification::GetActions() const { return actions_; } -base::string16 Notification::GetCloseButtonText() const { +std::u16string Notification::GetCloseButtonText() const { return close_button_text_; } -base::string16 Notification::GetToastXml() const { +std::u16string Notification::GetToastXml() const { return toast_xml_; } // Setters -void Notification::SetTitle(const base::string16& new_title) { +void Notification::SetTitle(const std::u16string& new_title) { title_ = new_title; } -void Notification::SetSubtitle(const base::string16& new_subtitle) { +void Notification::SetSubtitle(const std::u16string& new_subtitle) { subtitle_ = new_subtitle; } -void Notification::SetBody(const base::string16& new_body) { +void Notification::SetBody(const std::u16string& new_body) { body_ = new_body; } @@ -161,19 +161,19 @@ void Notification::SetHasReply(bool new_has_reply) { has_reply_ = new_has_reply; } -void Notification::SetTimeoutType(const base::string16& new_timeout_type) { +void Notification::SetTimeoutType(const std::u16string& new_timeout_type) { timeout_type_ = new_timeout_type; } -void Notification::SetReplyPlaceholder(const base::string16& new_placeholder) { +void Notification::SetReplyPlaceholder(const std::u16string& new_placeholder) { reply_placeholder_ = new_placeholder; } -void Notification::SetSound(const base::string16& new_sound) { +void Notification::SetSound(const std::u16string& new_sound) { sound_ = new_sound; } -void Notification::SetUrgency(const base::string16& new_urgency) { +void Notification::SetUrgency(const std::u16string& new_urgency) { urgency_ = new_urgency; } @@ -182,11 +182,11 @@ void Notification::SetActions( actions_ = actions; } -void Notification::SetCloseButtonText(const base::string16& text) { +void Notification::SetCloseButtonText(const std::u16string& text) { close_button_text_ = text; } -void Notification::SetToastXml(const base::string16& new_toast_xml) { +void Notification::SetToastXml(const std::u16string& new_toast_xml) { toast_xml_ = new_toast_xml; } diff --git a/shell/browser/api/electron_api_notification.h b/shell/browser/api/electron_api_notification.h index a914f88082b4..64a6cbec319f 100644 --- a/shell/browser/api/electron_api_notification.h +++ b/shell/browser/api/electron_api_notification.h @@ -65,49 +65,49 @@ class Notification : public gin::Wrappable, void Close(); // Prop Getters - base::string16 GetTitle() const; - base::string16 GetSubtitle() const; - base::string16 GetBody() const; + std::u16string GetTitle() const; + std::u16string GetSubtitle() const; + std::u16string GetBody() const; bool GetSilent() const; bool GetHasReply() const; - base::string16 GetTimeoutType() const; - base::string16 GetReplyPlaceholder() const; - base::string16 GetUrgency() const; - base::string16 GetSound() const; + std::u16string GetTimeoutType() const; + std::u16string GetReplyPlaceholder() const; + std::u16string GetUrgency() const; + std::u16string GetSound() const; std::vector GetActions() const; - base::string16 GetCloseButtonText() const; - base::string16 GetToastXml() const; + std::u16string GetCloseButtonText() const; + std::u16string GetToastXml() const; // Prop Setters - void SetTitle(const base::string16& new_title); - void SetSubtitle(const base::string16& new_subtitle); - void SetBody(const base::string16& new_body); + void SetTitle(const std::u16string& new_title); + void SetSubtitle(const std::u16string& new_subtitle); + void SetBody(const std::u16string& new_body); void SetSilent(bool new_silent); void SetHasReply(bool new_has_reply); - void SetUrgency(const base::string16& new_urgency); - void SetTimeoutType(const base::string16& new_timeout_type); - void SetReplyPlaceholder(const base::string16& new_reply_placeholder); - void SetSound(const base::string16& sound); + void SetUrgency(const std::u16string& new_urgency); + void SetTimeoutType(const std::u16string& new_timeout_type); + void SetReplyPlaceholder(const std::u16string& new_reply_placeholder); + void SetSound(const std::u16string& sound); void SetActions(const std::vector& actions); - void SetCloseButtonText(const base::string16& text); - void SetToastXml(const base::string16& new_toast_xml); + void SetCloseButtonText(const std::u16string& text); + void SetToastXml(const std::u16string& new_toast_xml); private: - base::string16 title_; - base::string16 subtitle_; - base::string16 body_; + std::u16string title_; + std::u16string subtitle_; + std::u16string body_; gfx::Image icon_; - base::string16 icon_path_; + std::u16string icon_path_; bool has_icon_ = false; bool silent_ = false; bool has_reply_ = false; - base::string16 timeout_type_; - base::string16 reply_placeholder_; - base::string16 sound_; - base::string16 urgency_; + std::u16string timeout_type_; + std::u16string reply_placeholder_; + std::u16string sound_; + std::u16string urgency_; std::vector actions_; - base::string16 close_button_text_; - base::string16 toast_xml_; + std::u16string close_button_text_; + std::u16string toast_xml_; electron::NotificationPresenter* presenter_; diff --git a/shell/browser/api/electron_api_url_loader.cc b/shell/browser/api/electron_api_url_loader.cc index afe48e40cd27..25058ec12b1c 100644 --- a/shell/browser/api/electron_api_url_loader.cc +++ b/shell/browser/api/electron_api_url_loader.cc @@ -343,7 +343,7 @@ void SimpleURLLoaderWrapper::OnAuthRequired( auto cb = base::BindOnce( [](mojo::Remote auth_responder, gin::Arguments* args) { - base::string16 username_str, password_str; + std::u16string username_str, password_str; if (!args->GetNext(&username_str) || !args->GetNext(&password_str)) { auth_responder->OnAuthCredentials(base::nullopt); return; diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 004f7323d85d..a56bf717a70e 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -408,7 +408,7 @@ base::Optional GetCursorBlinkInterval() { // This will return false if no printer with the provided device_name can be // found on the network. We need to check this because Chromium does not do // sanity checking of device_name validity and so will crash on invalid names. -bool IsDeviceNameValid(const base::string16& device_name) { +bool IsDeviceNameValid(const std::u16string& device_name) { #if defined(OS_MAC) base::ScopedCFTypeRef new_printer_id( base::SysUTF16ToCFStringRef(device_name)); @@ -423,7 +423,7 @@ bool IsDeviceNameValid(const base::string16& device_name) { return true; } -base::string16 GetDefaultPrinterAsync() { +std::u16string GetDefaultPrinterAsync() { #if defined(OS_WIN) // Blocking is needed here because Windows printer drivers are oftentimes // not thread-safe and have to be accessed on the UI thread. @@ -958,9 +958,9 @@ void WebContents::Destroy() { bool WebContents::DidAddMessageToConsole( content::WebContents* source, blink::mojom::ConsoleMessageLevel level, - const base::string16& message, + const std::u16string& message, int32_t line_no, - const base::string16& source_id) { + const std::u16string& source_id) { return Emit("console-message", static_cast(level), message, line_no, source_id); } @@ -1717,7 +1717,7 @@ void WebContents::DidFinishNavigation( } void WebContents::TitleWasSet(content::NavigationEntry* entry) { - base::string16 final_title; + std::u16string final_title; bool explicit_set = true; if (entry) { auto title = entry->GetTitle(); @@ -1983,7 +1983,7 @@ GURL WebContents::GetURL() const { return web_contents()->GetURL(); } -base::string16 WebContents::GetTitle() const { +std::u16string WebContents::GetTitle() const { return web_contents()->GetTitle(); } @@ -2292,9 +2292,9 @@ bool WebContents::IsCurrentlyAudible() { void WebContents::OnGetDefaultPrinter( base::Value print_settings, printing::CompletionCallback print_callback, - base::string16 device_name, + std::u16string device_name, bool silent, - base::string16 default_printer) { + std::u16string default_printer) { // The content::WebContents might be already deleted at this point, and the // PrintViewManagerBasic class does not do null check. if (!web_contents()) { @@ -2303,7 +2303,7 @@ void WebContents::OnGetDefaultPrinter( return; } - base::string16 printer_name = + std::u16string printer_name = device_name.empty() ? default_printer : device_name; // If there are no valid printers available on the network, we bail. @@ -2401,7 +2401,7 @@ void WebContents::Print(gin::Arguments* args) { // We set the default to the system's default printer and only update // if at the Chromium level if the user overrides. // Printer device name as opened by the OS. - base::string16 device_name; + std::u16string device_name; options.Get("deviceName", &device_name); if (!device_name.empty() && !IsDeviceNameValid(device_name)) { gin_helper::ErrorThrower(args->isolate()) @@ -2570,16 +2570,16 @@ void WebContents::Unselect() { web_contents()->CollapseSelection(); } -void WebContents::Replace(const base::string16& word) { +void WebContents::Replace(const std::u16string& word) { web_contents()->Replace(word); } -void WebContents::ReplaceMisspelling(const base::string16& word) { +void WebContents::ReplaceMisspelling(const std::u16string& word) { web_contents()->ReplaceMisspelling(word); } uint32_t WebContents::FindInPage(gin::Arguments* args) { - base::string16 search_text; + std::u16string search_text; if (!args->GetNext(&search_text) || search_text.empty()) { gin_helper::ErrorThrower(args->isolate()) .ThrowError("Must provide a non-empty search content"); diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 0ac3d3cc1d50..9d7eadc2384b 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -156,7 +156,7 @@ class WebContents : public gin::Wrappable, void LoadURL(const GURL& url, const gin_helper::Dictionary& options); void DownloadURL(const GURL& url); GURL GetURL() const; - base::string16 GetTitle() const; + std::u16string GetTitle() const; bool IsLoading() const; bool IsLoadingMainFrame() const; bool IsWaitingForResponse() const; @@ -201,9 +201,9 @@ class WebContents : public gin::Wrappable, #if BUILDFLAG(ENABLE_PRINTING) void OnGetDefaultPrinter(base::Value print_settings, printing::CompletionCallback print_callback, - base::string16 device_name, + std::u16string device_name, bool silent, - base::string16 default_printer); + std::u16string default_printer); void Print(gin::Arguments* args); // Print current page as PDF. v8::Local PrintToPDF(base::DictionaryValue settings); @@ -225,8 +225,8 @@ class WebContents : public gin::Wrappable, void Delete(); void SelectAll(); void Unselect(); - void Replace(const base::string16& word); - void ReplaceMisspelling(const base::string16& word); + void Replace(const std::u16string& word); + void ReplaceMisspelling(const std::u16string& word); uint32_t FindInPage(gin::Arguments* args); void StopFindInPage(content::StopFindAction action); void ShowDefinitionForSelection(); @@ -444,9 +444,9 @@ class WebContents : public gin::Wrappable, // content::WebContentsDelegate: bool DidAddMessageToConsole(content::WebContents* source, blink::mojom::ConsoleMessageLevel level, - const base::string16& message, + const std::u16string& message, int32_t line_no, - const base::string16& source_id) override; + const std::u16string& source_id) override; bool IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, diff --git a/shell/browser/api/electron_api_web_frame_main.cc b/shell/browser/api/electron_api_web_frame_main.cc index 8834eef51c66..9ef45ea185ec 100644 --- a/shell/browser/api/electron_api_web_frame_main.cc +++ b/shell/browser/api/electron_api_web_frame_main.cc @@ -78,7 +78,7 @@ bool WebFrameMain::CheckRenderFrame() const { v8::Local WebFrameMain::ExecuteJavaScript( gin::Arguments* args, - const base::string16& code) { + const std::u16string& code) { gin_helper::Promise promise(args->isolate()); v8::Local handle = promise.GetHandle(); diff --git a/shell/browser/api/electron_api_web_frame_main.h b/shell/browser/api/electron_api_web_frame_main.h index 18e7515ec9c2..4d0dc989055e 100644 --- a/shell/browser/api/electron_api_web_frame_main.h +++ b/shell/browser/api/electron_api_web_frame_main.h @@ -78,7 +78,7 @@ class WebFrameMain : public gin::Wrappable, void Connect(); v8::Local ExecuteJavaScript(gin::Arguments* args, - const base::string16& code); + const std::u16string& code); bool Reload(); void Send(v8::Isolate* isolate, bool internal, diff --git a/shell/browser/browser.h b/shell/browser/browser.h index 07aae2b1a95f..21ff40453b32 100755 --- a/shell/browser/browser.h +++ b/shell/browser/browser.h @@ -85,7 +85,7 @@ class Browser : public WindowListObserver { void ClearRecentDocuments(); // Set the application user model ID. - void SetAppUserModelID(const base::string16& name); + void SetAppUserModelID(const std::u16string& name); // Remove the default protocol handler registry key bool RemoveAsDefaultProtocolClient(const std::string& protocol, @@ -99,7 +99,7 @@ class Browser : public WindowListObserver { bool IsDefaultProtocolClient(const std::string& protocol, gin::Arguments* args); - base::string16 GetApplicationNameForProtocol(const GURL& url); + std::u16string GetApplicationNameForProtocol(const GURL& url); #if !defined(OS_LINUX) // get the name, icon and path for an application @@ -113,10 +113,10 @@ class Browser : public WindowListObserver { #if defined(OS_WIN) struct LaunchItem { - base::string16 name; - base::string16 path; - base::string16 scope; - std::vector args; + std::u16string name; + std::u16string path; + std::u16string scope; + std::vector args; bool enabled = true; LaunchItem(); @@ -132,13 +132,13 @@ class Browser : public WindowListObserver { bool restore_state = false; bool opened_at_login = false; bool opened_as_hidden = false; - base::string16 path; - std::vector args; + std::u16string path; + std::vector args; #if defined(OS_WIN) // used in browser::setLoginItemSettings bool enabled = true; - base::string16 name = base::string16(); + std::u16string name = std::u16string(); // used in browser::getLoginItemSettings bool executable_will_launch_at_login = false; @@ -238,9 +238,9 @@ class Browser : public WindowListObserver { #if defined(OS_WIN) struct UserTask { base::FilePath program; - base::string16 arguments; - base::string16 title; - base::string16 description; + std::u16string arguments; + std::u16string title; + std::u16string description; base::FilePath working_dir; base::FilePath icon_path; int icon_index; diff --git a/shell/browser/browser_linux.cc b/shell/browser/browser_linux.cc index 8d3c26e95d0e..8c5e59e427dc 100644 --- a/shell/browser/browser_linux.cc +++ b/shell/browser/browser_linux.cc @@ -88,7 +88,7 @@ void Browser::AddRecentDocument(const base::FilePath& path) {} void Browser::ClearRecentDocuments() {} -void Browser::SetAppUserModelID(const base::string16& name) {} +void Browser::SetAppUserModelID(const std::u16string& name) {} bool Browser::SetAsDefaultProtocolClient(const std::string& protocol, gin::Arguments* args) { @@ -122,7 +122,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, return false; } -base::string16 Browser::GetApplicationNameForProtocol(const GURL& url) { +std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) { const std::vector argv = { "xdg-mime", "query", "default", std::string("x-scheme-handler/") + url.scheme()}; diff --git a/shell/browser/browser_mac.mm b/shell/browser/browser_mac.mm index 5bc184dd0b07..97daa1ded023 100644 --- a/shell/browser/browser_mac.mm +++ b/shell/browser/browser_mac.mm @@ -58,7 +58,7 @@ gfx::Image GetApplicationIconForProtocol(NSString* _Nonnull app_path) { return icon; } -base::string16 GetAppDisplayNameForProtocol(NSString* app_path) { +std::u16string GetAppDisplayNameForProtocol(NSString* app_path) { NSString* app_display_name = [[NSFileManager defaultManager] displayNameAtPath:app_path]; return base::SysNSStringToUTF16(app_display_name); @@ -81,8 +81,8 @@ v8::Local Browser::GetApplicationInfoForProtocol( return handle; } - base::string16 app_path = base::SysNSStringToUTF16(ns_app_path); - base::string16 app_display_name = GetAppDisplayNameForProtocol(ns_app_path); + std::u16string app_path = base::SysNSStringToUTF16(ns_app_path); + std::u16string app_display_name = GetAppDisplayNameForProtocol(ns_app_path); gfx::Image app_icon = GetApplicationIconForProtocol(ns_app_path); dict.Set("name", app_display_name); @@ -209,16 +209,16 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol, return result == NSOrderedSame; } -base::string16 Browser::GetApplicationNameForProtocol(const GURL& url) { +std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) { NSString* app_path = GetAppPathForProtocol(url); if (!app_path) { - return base::string16(); + return std::u16string(); } - base::string16 app_display_name = GetAppDisplayNameForProtocol(app_path); + std::u16string app_display_name = GetAppDisplayNameForProtocol(app_path); return app_display_name; } -void Browser::SetAppUserModelID(const base::string16& name) {} +void Browser::SetAppUserModelID(const std::u16string& name) {} bool Browser::SetBadgeCount(base::Optional count) { DockSetBadgeText(!count.has_value() || count.value() != 0 diff --git a/shell/browser/browser_win.cc b/shell/browser/browser_win.cc index ce488e982ea8..5014bd5d7bb2 100755 --- a/shell/browser/browser_win.cc +++ b/shell/browser/browser_win.cc @@ -48,7 +48,7 @@ namespace electron { namespace { -bool GetProcessExecPath(base::string16* exe) { +bool GetProcessExecPath(std::u16string* exe) { base::FilePath path; if (!base::PathService::Get(base::FILE_EXE, &path)) { return false; @@ -57,13 +57,13 @@ bool GetProcessExecPath(base::string16* exe) { return true; } -bool GetProtocolLaunchPath(gin::Arguments* args, base::string16* exe) { +bool GetProtocolLaunchPath(gin::Arguments* args, std::u16string* exe) { if (!args->GetNext(exe) && !GetProcessExecPath(exe)) { return false; } // Read in optional args arg - std::vector launch_args; + std::vector launch_args; if (args->GetNext(&launch_args) && !launch_args.empty()) *exe = base::StringPrintf(L"\"%ls\" %ls \"%%1\"", exe->c_str(), base::JoinString(launch_args, L" ").c_str()); @@ -75,7 +75,7 @@ bool GetProtocolLaunchPath(gin::Arguments* args, base::string16* exe) { // Windows treats a given scheme as an Internet scheme only if its registry // entry has a "URL Protocol" key. Check this, otherwise we allow ProgIDs to be // used as custom protocols which leads to security bugs. -bool IsValidCustomProtocol(const base::string16& scheme) { +bool IsValidCustomProtocol(const std::u16string& scheme) { if (scheme.empty()) return false; base::win::RegKey cmd_key(HKEY_CLASSES_ROOT, scheme.c_str(), KEY_QUERY_VALUE); @@ -90,11 +90,11 @@ bool IsValidCustomProtocol(const base::string16& scheme) { // Windows 8 introduced a new protocol->executable binding system which cannot // be retrieved in the HKCR registry subkey method implemented below. We call // AssocQueryString with the new Win8-only flag ASSOCF_IS_PROTOCOL instead. -base::string16 GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, +std::u16string GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, const GURL& url) { - const base::string16 url_scheme = base::ASCIIToUTF16(url.scheme()); + const std::u16string url_scheme = base::ASCIIToUTF16(url.scheme()); if (!IsValidCustomProtocol(url_scheme)) - return base::string16(); + return std::u16string(); wchar_t out_buffer[1024]; DWORD buffer_size = base::size(out_buffer); @@ -103,13 +103,13 @@ base::string16 GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, out_buffer, &buffer_size); if (FAILED(hr)) { DLOG(WARNING) << "AssocQueryString failed!"; - return base::string16(); + return std::u16string(); } - return base::string16(out_buffer); + return std::u16string(out_buffer); } void OnIconDataAvailable(const base::FilePath& app_path, - const base::string16& app_display_name, + const std::u16string& app_display_name, gin_helper::Promise promise, gfx::Image icon) { if (!icon.IsEmpty()) { @@ -126,21 +126,21 @@ void OnIconDataAvailable(const base::FilePath& app_path, } } -base::string16 GetAppDisplayNameForProtocol(const GURL& url) { +std::u16string GetAppDisplayNameForProtocol(const GURL& url) { return GetAppInfoHelperForProtocol(ASSOCSTR_FRIENDLYAPPNAME, url); } -base::string16 GetAppPathForProtocol(const GURL& url) { +std::u16string GetAppPathForProtocol(const GURL& url) { return GetAppInfoHelperForProtocol(ASSOCSTR_EXECUTABLE, url); } -base::string16 GetAppForProtocolUsingRegistry(const GURL& url) { - const base::string16 url_scheme = base::ASCIIToUTF16(url.scheme()); +std::u16string GetAppForProtocolUsingRegistry(const GURL& url) { + const std::u16string url_scheme = base::ASCIIToUTF16(url.scheme()); if (!IsValidCustomProtocol(url_scheme)) - return base::string16(); + return std::u16string(); // First, try and extract the application's display name. - base::string16 command_to_launch; + std::u16string command_to_launch; base::win::RegKey cmd_key_name(HKEY_CLASSES_ROOT, url_scheme.c_str(), KEY_READ); if (cmd_key_name.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS && @@ -150,7 +150,7 @@ base::string16 GetAppForProtocolUsingRegistry(const GURL& url) { // Otherwise, parse the command line in the registry, and return the basename // of the program path if it exists. - const base::string16 cmd_key_path = url_scheme + L"\\shell\\open\\command"; + const std::u16string cmd_key_path = url_scheme + L"\\shell\\open\\command"; base::win::RegKey cmd_key_exe(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); if (cmd_key_exe.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS) { @@ -159,11 +159,11 @@ base::string16 GetAppForProtocolUsingRegistry(const GURL& url) { return command_line.GetProgram().BaseName().value(); } - return base::string16(); + return std::u16string(); } -bool FormatCommandLineString(base::string16* exe, - const std::vector& launch_args) { +bool FormatCommandLineString(std::u16string* exe, + const std::vector& launch_args) { if (exe->empty() && !GetProcessExecPath(exe)) { return false; } @@ -184,13 +184,13 @@ bool FormatCommandLineString(base::string16* exe, std::vector GetLoginItemSettingsHelper( base::win::RegistryValueIterator* it, boolean* executable_will_launch_at_login, - base::string16 scope, + std::u16string scope, const Browser::LoginItemSettings& options) { std::vector launch_items; base::FilePath lookup_exe_path; if (options.path.empty()) { - base::string16 process_exe_path; + std::u16string process_exe_path; GetProcessExecPath(&process_exe_path); lookup_exe_path = base::CommandLine::FromString(process_exe_path).GetProgram(); @@ -287,7 +287,7 @@ Browser::UserTask::~UserTask() = default; void GetFileIcon(const base::FilePath& path, v8::Isolate* isolate, base::CancelableTaskTracker* cancelable_task_tracker_, - const base::string16 app_display_name, + const std::u16string app_display_name, gin_helper::Promise promise) { base::FilePath normalized_path = path.NormalizePathSeparators(); IconLoader::IconSize icon_size = IconLoader::IconSize::LARGE; @@ -316,13 +316,13 @@ void GetApplicationInfoForProtocolUsingRegistry( base::CancelableTaskTracker* cancelable_task_tracker_) { base::FilePath app_path; - const base::string16 url_scheme = base::ASCIIToUTF16(url.scheme()); + const std::u16string url_scheme = base::ASCIIToUTF16(url.scheme()); if (!IsValidCustomProtocol(url_scheme)) { promise.RejectWithErrorMessage("invalid url_scheme"); return; } - base::string16 command_to_launch; - const base::string16 cmd_key_path = url_scheme + L"\\shell\\open\\command"; + std::u16string command_to_launch; + const std::u16string cmd_key_path = url_scheme + L"\\shell\\open\\command"; base::win::RegKey cmd_key_exe(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); if (cmd_key_exe.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS) { @@ -334,7 +334,7 @@ void GetApplicationInfoForProtocolUsingRegistry( "Unable to retrieve installation path to app"); return; } - const base::string16 app_display_name = GetAppForProtocolUsingRegistry(url); + const std::u16string app_display_name = GetAppForProtocolUsingRegistry(url); if (app_display_name.empty()) { promise.RejectWithErrorMessage( @@ -354,7 +354,7 @@ void GetApplicationInfoForProtocolUsingAssocQuery( const GURL& url, gin_helper::Promise promise, base::CancelableTaskTracker* cancelable_task_tracker_) { - base::string16 app_path = GetAppPathForProtocol(url); + std::u16string app_path = GetAppPathForProtocol(url); if (app_path.empty()) { promise.RejectWithErrorMessage( @@ -362,7 +362,7 @@ void GetApplicationInfoForProtocolUsingAssocQuery( return; } - base::string16 app_display_name = GetAppDisplayNameForProtocol(url); + std::u16string app_display_name = GetAppDisplayNameForProtocol(url); if (app_display_name.empty()) { promise.RejectWithErrorMessage("Unable to retrieve display name of app"); @@ -390,7 +390,7 @@ void Browser::ClearRecentDocuments() { SHAddToRecentDocs(SHARD_APPIDINFO, nullptr); } -void Browser::SetAppUserModelID(const base::string16& name) { +void Browser::SetAppUserModelID(const std::u16string& name) { electron::SetAppUserModelID(name); } @@ -426,12 +426,12 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, // Main Registry Key HKEY root = HKEY_CURRENT_USER; - base::string16 keyPath = L"Software\\Classes\\"; + std::u16string keyPath = L"Software\\Classes\\"; // Command Key - base::string16 wprotocol = base::UTF8ToUTF16(protocol); - base::string16 shellPath = wprotocol + L"\\shell"; - base::string16 cmdPath = keyPath + shellPath + L"\\open\\command"; + std::u16string wprotocol = base::UTF8ToUTF16(protocol); + std::u16string shellPath = wprotocol + L"\\shell"; + std::u16string cmdPath = keyPath + shellPath + L"\\open\\command"; base::win::RegKey classesKey; base::win::RegKey commandKey; @@ -445,12 +445,12 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, // Key doesn't even exist, we can confirm that it is not set return true; - base::string16 keyVal; + std::u16string keyVal; if (FAILED(commandKey.ReadValue(L"", &keyVal))) // Default value not set, we can confirm that it is not set return true; - base::string16 exe; + std::u16string exe; if (!GetProtocolLaunchPath(args, &exe)) return false; @@ -461,7 +461,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, // Let's clean up after ourselves base::win::RegKey protocolKey; - base::string16 protocolPath = keyPath + wprotocol; + std::u16string protocolPath = keyPath + wprotocol; if (SUCCEEDED( protocolKey.Open(root, protocolPath.c_str(), KEY_ALL_ACCESS))) { @@ -500,17 +500,17 @@ bool Browser::SetAsDefaultProtocolClient(const std::string& protocol, if (protocol.empty()) return false; - base::string16 exe; + std::u16string exe; if (!GetProtocolLaunchPath(args, &exe)) return false; // Main Registry Key HKEY root = HKEY_CURRENT_USER; - base::string16 keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); - base::string16 urlDecl = base::UTF8ToUTF16("URL:" + protocol); + std::u16string keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); + std::u16string urlDecl = base::UTF8ToUTF16("URL:" + protocol); // Command Key - base::string16 cmdPath = keyPath + L"\\shell\\open\\command"; + std::u16string cmdPath = keyPath + L"\\shell\\open\\command"; // Write information to registry base::win::RegKey key(root, keyPath.c_str(), KEY_ALL_ACCESS); @@ -530,16 +530,16 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol, if (protocol.empty()) return false; - base::string16 exe; + std::u16string exe; if (!GetProtocolLaunchPath(args, &exe)) return false; // Main Registry Key HKEY root = HKEY_CURRENT_USER; - base::string16 keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); + std::u16string keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); // Command Key - base::string16 cmdPath = keyPath + L"\\shell\\open\\command"; + std::u16string cmdPath = keyPath + L"\\shell\\open\\command"; base::win::RegKey key; base::win::RegKey commandKey; @@ -551,7 +551,7 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol, // Key doesn't exist, we can confirm that it is not set return false; - base::string16 keyVal; + std::u16string keyVal; if (FAILED(commandKey.ReadValue(L"", &keyVal))) // Default value not set, we can confirm that it is not set return false; @@ -560,10 +560,10 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol, return keyVal == exe; } -base::string16 Browser::GetApplicationNameForProtocol(const GURL& url) { +std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) { // Windows 8 or above has a new protocol association query. if (base::win::GetVersion() >= base::win::Version::WIN8) { - base::string16 application_name = GetAppDisplayNameForProtocol(url); + std::u16string application_name = GetAppDisplayNameForProtocol(url); if (!application_name.empty()) return application_name; } @@ -686,11 +686,11 @@ void Browser::UpdateBadgeContents( } void Browser::SetLoginItemSettings(LoginItemSettings settings) { - base::string16 key_path = + std::u16string key_path = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; base::win::RegKey key(HKEY_CURRENT_USER, key_path.c_str(), KEY_ALL_ACCESS); - base::string16 startup_approved_key_path = + std::u16string startup_approved_key_path = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApproved" L"\\Run"; base::win::RegKey startup_approved_key( @@ -699,7 +699,7 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) { !settings.name.empty() ? settings.name.c_str() : GetAppUserModelID(); if (settings.open_at_login) { - base::string16 exe = settings.path; + std::u16string exe = settings.path; if (FormatCommandLineString(&exe, settings.args)) { key.WriteValue(key_name, exe.c_str()); @@ -732,13 +732,13 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) { Browser::LoginItemSettings Browser::GetLoginItemSettings( const LoginItemSettings& options) { LoginItemSettings settings; - base::string16 keyPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; + std::u16string keyPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; base::win::RegKey key(HKEY_CURRENT_USER, keyPath.c_str(), KEY_ALL_ACCESS); - base::string16 keyVal; + std::u16string keyVal; // keep old openAtLogin behaviour if (!FAILED(key.ReadValue(GetAppUserModelID(), &keyVal))) { - base::string16 exe = options.path; + std::u16string exe = options.path; if (FormatCommandLineString(&exe, options.args)) { settings.open_at_login = keyVal == exe; } diff --git a/shell/browser/electron_autofill_driver.cc b/shell/browser/electron_autofill_driver.cc index 029df62158e7..fb541ac9f75e 100644 --- a/shell/browser/electron_autofill_driver.cc +++ b/shell/browser/electron_autofill_driver.cc @@ -27,8 +27,8 @@ AutofillDriver::~AutofillDriver() = default; void AutofillDriver::ShowAutofillPopup( const gfx::RectF& bounds, - const std::vector& values, - const std::vector& labels) { + const std::vector& values, + const std::vector& labels) { v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); v8::HandleScope scope(isolate); auto* web_contents = api::WebContents::From( diff --git a/shell/browser/electron_autofill_driver.h b/shell/browser/electron_autofill_driver.h index f1085e730901..2e3b0c489df9 100644 --- a/shell/browser/electron_autofill_driver.h +++ b/shell/browser/electron_autofill_driver.h @@ -27,8 +27,8 @@ class AutofillDriver : public mojom::ElectronAutofillDriver { ~AutofillDriver() override; void ShowAutofillPopup(const gfx::RectF& bounds, - const std::vector& values, - const std::vector& labels) override; + const std::vector& values, + const std::vector& labels) override; void HideAutofillPopup() override; private: diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 8d4234ef808f..7efd0359aced 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -920,7 +920,7 @@ ElectronBrowserClient::CreateWindowForPictureInPicture( content::PictureInPictureWindowController* controller) { auto overlay_window = content::OverlayWindow::Create(controller); #if defined(OS_WIN) - base::string16 app_user_model_id = Browser::Get()->GetAppUserModelID(); + std::u16string app_user_model_id = Browser::Get()->GetAppUserModelID(); if (!app_user_model_id.empty()) { auto* overlay_window_view = static_cast(overlay_window.get()); diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index e4ae699c6047..f5229da5b8a1 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -142,7 +142,7 @@ int GetMinimumFontSize() { } #endif -base::string16 MediaStringProvider(media::MessageId id) { +std::u16string MediaStringProvider(media::MessageId id) { switch (id) { case media::DEFAULT_AUDIO_DEVICE_NAME: return base::ASCIIToUTF16("Default"); @@ -151,7 +151,7 @@ base::string16 MediaStringProvider(media::MessageId id) { return base::ASCIIToUTF16("Communications"); #endif default: - return base::string16(); + return std::u16string(); } } diff --git a/shell/browser/electron_javascript_dialog_manager.cc b/shell/browser/electron_javascript_dialog_manager.cc index 519dc0aa98b5..b78d5c5f4247 100644 --- a/shell/browser/electron_javascript_dialog_manager.cc +++ b/shell/browser/electron_javascript_dialog_manager.cc @@ -34,8 +34,8 @@ void ElectronJavaScriptDialogManager::RunJavaScriptDialog( content::WebContents* web_contents, content::RenderFrameHost* rfh, JavaScriptDialogType dialog_type, - const base::string16& message_text, - const base::string16& default_prompt_text, + const std::u16string& message_text, + const std::u16string& default_prompt_text, DialogClosedCallback callback, bool* did_suppress_message) { auto origin_url = rfh->GetLastCommittedURL(); @@ -50,19 +50,19 @@ void ElectronJavaScriptDialogManager::RunJavaScriptDialog( } if (origin_counts_[origin] == kUserWantsNoMoreDialogs) { - return std::move(callback).Run(false, base::string16()); + return std::move(callback).Run(false, std::u16string()); } if (dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_ALERT && dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_CONFIRM) { - std::move(callback).Run(false, base::string16()); + std::move(callback).Run(false, std::u16string()); return; } auto* web_preferences = WebContentsPreferences::From(web_contents); if (web_preferences && web_preferences->IsEnabled("disableDialogs")) { - return std::move(callback).Run(false, base::string16()); + return std::move(callback).Run(false, std::u16string()); } // No default button @@ -116,7 +116,7 @@ void ElectronJavaScriptDialogManager::RunBeforeUnloadDialog( auto* api_web_contents = api::WebContents::From(web_contents); if (api_web_contents) { bool default_prevented = api_web_contents->Emit("will-prevent-unload"); - std::move(callback).Run(default_prevented, base::string16()); + std::move(callback).Run(default_prevented, std::u16string()); } } @@ -131,7 +131,7 @@ void ElectronJavaScriptDialogManager::OnMessageBoxCallback( bool checkbox_checked) { if (checkbox_checked) origin_counts_[origin] = kUserWantsNoMoreDialogs; - std::move(callback).Run(code == 0, base::string16()); + std::move(callback).Run(code == 0, std::u16string()); } } // namespace electron diff --git a/shell/browser/electron_javascript_dialog_manager.h b/shell/browser/electron_javascript_dialog_manager.h index 0794a6aa063d..4c5135c9edaf 100644 --- a/shell/browser/electron_javascript_dialog_manager.h +++ b/shell/browser/electron_javascript_dialog_manager.h @@ -26,8 +26,8 @@ class ElectronJavaScriptDialogManager void RunJavaScriptDialog(content::WebContents* web_contents, content::RenderFrameHost* rfh, content::JavaScriptDialogType dialog_type, - const base::string16& message_text, - const base::string16& default_prompt_text, + const std::u16string& message_text, + const std::u16string& default_prompt_text, DialogClosedCallback callback, bool* did_suppress_message) override; void RunBeforeUnloadDialog(content::WebContents* web_contents, diff --git a/shell/browser/extended_web_contents_observer.h b/shell/browser/extended_web_contents_observer.h index 3914789eaf7c..49b1f30163de 100644 --- a/shell/browser/extended_web_contents_observer.h +++ b/shell/browser/extended_web_contents_observer.h @@ -23,7 +23,7 @@ class ExtendedWebContentsObserver : public base::CheckedObserver { const std::vector& regions) {} virtual void OnSetContentBounds(const gfx::Rect& rect) {} virtual void OnActivateContents() {} - virtual void OnPageTitleUpdated(const base::string16& title, + virtual void OnPageTitleUpdated(const std::u16string& title, bool explicit_set) {} virtual void OnDevToolsResized() {} diff --git a/shell/browser/extensions/api/management/electron_management_api_delegate.cc b/shell/browser/extensions/api/management/electron_management_api_delegate.cc index 8ff304855214..2239c8759c21 100644 --- a/shell/browser/extensions/api/management/electron_management_api_delegate.cc +++ b/shell/browser/extensions/api/management/electron_management_api_delegate.cc @@ -204,7 +204,7 @@ bool ElectronManagementAPIDelegate::UninstallExtension( content::BrowserContext* context, const std::string& transient_extension_id, extensions::UninstallReason reason, - base::string16* error) const { + std::u16string* error) const { // TODO(sentialx): we don't have ExtensionService // return extensions::ExtensionSystem::Get(context) // ->extension_service() diff --git a/shell/browser/extensions/api/management/electron_management_api_delegate.h b/shell/browser/extensions/api/management/electron_management_api_delegate.h index 553956132713..2a066b0cfc43 100644 --- a/shell/browser/extensions/api/management/electron_management_api_delegate.h +++ b/shell/browser/extensions/api/management/electron_management_api_delegate.h @@ -73,7 +73,7 @@ class ElectronManagementAPIDelegate : public extensions::ManagementAPIDelegate { bool UninstallExtension(content::BrowserContext* context, const std::string& transient_extension_id, extensions::UninstallReason reason, - base::string16* error) const override; + std::u16string* error) const override; void SetLaunchType(content::BrowserContext* context, const std::string& extension_id, extensions::LaunchType launch_type) const override; diff --git a/shell/browser/file_select_helper.cc b/shell/browser/file_select_helper.cc index 72066541e948..1bb02cc7a24a 100644 --- a/shell/browser/file_select_helper.cc +++ b/shell/browser/file_select_helper.cc @@ -125,7 +125,7 @@ void FileSelectHelper::OnListDone(int error) { std::vector file_info; for (const auto& path : lister_paths_) file_info.push_back(FileChooserFileInfo::NewNativeFile( - NativeFileInfo::New(path, base::string16()))); + NativeFileInfo::New(path, std::u16string()))); OnFilesSelected(std::move(file_info), lister_base_dir_); } diff --git a/shell/browser/font_defaults.cc b/shell/browser/font_defaults.cc index 9491af7f0b76..d704eea5e3b0 100644 --- a/shell/browser/font_defaults.cc +++ b/shell/browser/font_defaults.cc @@ -120,7 +120,7 @@ std::string GetDefaultFontForPref(const char* pref_name) { // Map from script to font. // Key comparison uses pointer equality. -using ScriptFontMap = std::unordered_map; +using ScriptFontMap = std::unordered_map; // Map from font family to ScriptFontMap. // Key comparison uses pointer equality. @@ -130,7 +130,7 @@ using FontFamilyMap = std::unordered_map; // e.g. ("sans-serif", "Zyyy") -> "Arial" FontFamilyMap g_font_cache; -base::string16 FetchFont(const char* script, const char* map_name) { +std::u16string FetchFont(const char* script, const char* map_name) { FontFamilyMap::const_iterator it = g_font_cache.find(map_name); if (it != g_font_cache.end()) { ScriptFontMap::const_iterator it2 = it->second.find(script); @@ -140,7 +140,7 @@ base::string16 FetchFont(const char* script, const char* map_name) { std::string pref_name = base::StringPrintf("%s.%s", map_name, script); std::string font = GetDefaultFontForPref(pref_name.c_str()); - base::string16 font16 = base::UTF8ToUTF16(font); + std::u16string font16 = base::UTF8ToUTF16(font); ScriptFontMap& map = g_font_cache[map_name]; map[script] = font16; @@ -151,7 +151,7 @@ void FillFontFamilyMap(const char* map_name, blink::web_pref::ScriptFontFamilyMap* map) { for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; - base::string16 result = FetchFont(script, map_name); + std::u16string result = FetchFont(script, map_name); if (!result.empty()) { (*map)[script] = result; } diff --git a/shell/browser/lib/bluetooth_chooser.cc b/shell/browser/lib/bluetooth_chooser.cc index 3233bb94ed2e..4aad929d9111 100644 --- a/shell/browser/lib/bluetooth_chooser.cc +++ b/shell/browser/lib/bluetooth_chooser.cc @@ -104,7 +104,7 @@ void BluetoothChooser::ShowDiscoveryState(DiscoveryState state) { void BluetoothChooser::AddOrUpdateDevice(const std::string& device_id, bool should_update_name, - const base::string16& device_name, + const std::u16string& device_name, bool is_gatt_connected, bool is_paired, int signal_strength_level) { diff --git a/shell/browser/lib/bluetooth_chooser.h b/shell/browser/lib/bluetooth_chooser.h index 1cff5df0bdb8..e7ada17fc7a3 100644 --- a/shell/browser/lib/bluetooth_chooser.h +++ b/shell/browser/lib/bluetooth_chooser.h @@ -18,7 +18,7 @@ class BluetoothChooser : public content::BluetoothChooser { public: struct DeviceInfo { std::string device_id; - base::string16 device_name; + std::u16string device_name; }; explicit BluetoothChooser(api::WebContents* contents, @@ -30,14 +30,14 @@ class BluetoothChooser : public content::BluetoothChooser { void ShowDiscoveryState(DiscoveryState state) override; void AddOrUpdateDevice(const std::string& device_id, bool should_update_name, - const base::string16& device_name, + const std::u16string& device_name, bool is_gatt_connected, bool is_paired, int signal_strength_level) override; std::vector GetDeviceList(); private: - std::map device_map_; + std::map device_map_; api::WebContents* api_web_contents_; EventHandler event_handler_; int num_retries_ = 0; diff --git a/shell/browser/login_handler.cc b/shell/browser/login_handler.cc index fa1bee995dc6..1c4cc45a562f 100644 --- a/shell/browser/login_handler.cc +++ b/shell/browser/login_handler.cc @@ -83,7 +83,7 @@ LoginHandler::~LoginHandler() = default; void LoginHandler::CallbackFromJS(gin::Arguments* args) { if (auth_required_callback_) { - base::string16 username, password; + std::u16string username, password; if (!args->GetNext(&username) || !args->GetNext(&password)) { std::move(auth_required_callback_).Run(base::nullopt); return; diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 3b1d65b9b3e5..3fa8315cb609 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -604,7 +604,7 @@ const views::Widget* NativeWindow::GetWidget() const { return widget(); } -base::string16 NativeWindow::GetAccessibleWindowTitle() const { +std::u16string NativeWindow::GetAccessibleWindowTitle() const { if (accessible_title_.empty()) { return views::WidgetDelegate::GetAccessibleWindowTitle(); } diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index 2bf22fc72c4e..e98801ef0034 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -325,7 +325,7 @@ class NativeWindow : public base::SupportsUserData, // views::WidgetDelegate: views::Widget* GetWidget() override; const views::Widget* GetWidget() const override; - base::string16 GetAccessibleWindowTitle() const override; + std::u16string GetAccessibleWindowTitle() const override; void set_content_view(views::View* view) { content_view_ = view; } @@ -383,7 +383,7 @@ class NativeWindow : public base::SupportsUserData, base::ObserverList observers_; // Accessible title. - base::string16 accessible_title_; + std::u16string accessible_title_; base::WeakPtrFactory weak_factory_{this}; diff --git a/shell/browser/native_window_observer.h b/shell/browser/native_window_observer.h index edf5c2408e16..32276cbdacfa 100644 --- a/shell/browser/native_window_observer.h +++ b/shell/browser/native_window_observer.h @@ -28,7 +28,7 @@ class NativeWindowObserver : public base::CheckedObserver { ~NativeWindowObserver() override {} // Called when the web page in window wants to create a popup window. - virtual void WillCreatePopupWindow(const base::string16& frame_name, + virtual void WillCreatePopupWindow(const std::u16string& frame_name, const GURL& target_url, const std::string& partition_id, WindowOpenDisposition disposition) {} diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 480445142b31..61fbbc2067d6 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -1476,7 +1476,7 @@ bool NativeWindowViews::CanMinimize() const { #endif } -base::string16 NativeWindowViews::GetWindowTitle() const { +std::u16string NativeWindowViews::GetWindowTitle() const { return base::UTF8ToUTF16(title_); } diff --git a/shell/browser/native_window_views.h b/shell/browser/native_window_views.h index fbde6d0f6be5..3c7aba646bb0 100644 --- a/shell/browser/native_window_views.h +++ b/shell/browser/native_window_views.h @@ -184,7 +184,7 @@ class NativeWindowViews : public NativeWindow, bool CanResize() const override; bool CanMaximize() const override; bool CanMinimize() const override; - base::string16 GetWindowTitle() const override; + std::u16string GetWindowTitle() const override; views::View* GetContentsView() override; bool ShouldDescendIntoChildForEventHandling( gfx::NativeView child, diff --git a/shell/browser/notifications/notification.h b/shell/browser/notifications/notification.h index 28355cb46490..4edcc7b93fb5 100644 --- a/shell/browser/notifications/notification.h +++ b/shell/browser/notifications/notification.h @@ -19,26 +19,26 @@ class NotificationDelegate; class NotificationPresenter; struct NotificationAction { - base::string16 type; - base::string16 text; + std::u16string type; + std::u16string text; }; struct NotificationOptions { - base::string16 title; - base::string16 subtitle; - base::string16 msg; + std::u16string title; + std::u16string subtitle; + std::u16string msg; std::string tag; bool silent; GURL icon_url; SkBitmap icon; bool has_reply; - base::string16 timeout_type; - base::string16 reply_placeholder; - base::string16 sound; - base::string16 urgency; // Linux + std::u16string timeout_type; + std::u16string reply_placeholder; + std::u16string sound; + std::u16string urgency; // Linux std::vector actions; - base::string16 close_button_text; - base::string16 toast_xml; + std::u16string close_button_text; + std::u16string toast_xml; NotificationOptions(); ~NotificationOptions(); diff --git a/shell/browser/notifications/win/notification_presenter_win.cc b/shell/browser/notifications/win/notification_presenter_win.cc index bacf04481f5e..f74a26aef592 100644 --- a/shell/browser/notifications/win/notification_presenter_win.cc +++ b/shell/browser/notifications/win/notification_presenter_win.cc @@ -72,7 +72,7 @@ bool NotificationPresenterWin::Init() { return temp_dir_.CreateUniqueTempDir(); } -base::string16 NotificationPresenterWin::SaveIconToFilesystem( +std::u16string NotificationPresenterWin::SaveIconToFilesystem( const SkBitmap& icon, const GURL& origin) { std::string filename; diff --git a/shell/browser/notifications/win/notification_presenter_win.h b/shell/browser/notifications/win/notification_presenter_win.h index a5006c139b28..7e739ce9be03 100644 --- a/shell/browser/notifications/win/notification_presenter_win.h +++ b/shell/browser/notifications/win/notification_presenter_win.h @@ -39,7 +39,7 @@ class NotificationPresenterWin : public NotificationPresenter { bool Init(); - base::string16 SaveIconToFilesystem(const SkBitmap& icon, const GURL& origin); + std::u16string SaveIconToFilesystem(const SkBitmap& icon, const GURL& origin); private: Notification* CreateNotificationObject( diff --git a/shell/browser/osr/osr_render_widget_host_view.cc b/shell/browser/osr/osr_render_widget_host_view.cc index 59f0568a5aaa..343c62e84a5d 100644 --- a/shell/browser/osr/osr_render_widget_host_view.cc +++ b/shell/browser/osr/osr_render_widget_host_view.cc @@ -456,7 +456,7 @@ void OffScreenRenderWidgetHostView::Destroy() { delete this; } -void OffScreenRenderWidgetHostView::SetTooltipText(const base::string16&) {} +void OffScreenRenderWidgetHostView::SetTooltipText(const std::u16string&) {} uint32_t OffScreenRenderWidgetHostView::GetCaptureSequenceNumber() const { return latest_capture_sequence_number_; diff --git a/shell/browser/osr/osr_render_widget_host_view.h b/shell/browser/osr/osr_render_widget_host_view.h index 8fb46cfaa5a7..cd3b02796006 100644 --- a/shell/browser/osr/osr_render_widget_host_view.h +++ b/shell/browser/osr/osr_render_widget_host_view.h @@ -114,7 +114,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase, void ImeCancelComposition(void) override; void RenderProcessGone() override; void Destroy(void) override; - void SetTooltipText(const base::string16&) override; + void SetTooltipText(const std::u16string&) override; content::CursorManager* GetCursorManager() override; void CopyFromSurface( const gfx::Rect& src_rect, diff --git a/shell/browser/osr/osr_web_contents_view.cc b/shell/browser/osr/osr_web_contents_view.cc index 8c20818f911d..eed0be9cc7e8 100644 --- a/shell/browser/osr/osr_web_contents_view.cc +++ b/shell/browser/osr/osr_web_contents_view.cc @@ -139,7 +139,7 @@ OffScreenWebContentsView::CreateViewForChildWidget( render_widget_host, view, GetSize()); } -void OffScreenWebContentsView::SetPageTitle(const base::string16& title) {} +void OffScreenWebContentsView::SetPageTitle(const std::u16string& title) {} void OffScreenWebContentsView::RenderViewReady() { if (GetView()) diff --git a/shell/browser/osr/osr_web_contents_view.h b/shell/browser/osr/osr_web_contents_view.h index 193080aacdb3..d530ca0627cf 100644 --- a/shell/browser/osr/osr_web_contents_view.h +++ b/shell/browser/osr/osr_web_contents_view.h @@ -57,7 +57,7 @@ class OffScreenWebContentsView : public content::WebContentsView, content::RenderWidgetHost* render_widget_host) override; content::RenderWidgetHostViewBase* CreateViewForChildWidget( content::RenderWidgetHost* render_widget_host) override; - void SetPageTitle(const base::string16& title) override; + void SetPageTitle(const std::u16string& title) override; void RenderViewReady() override; void RenderViewHostChanged(content::RenderViewHost* old_host, content::RenderViewHost* new_host) override; diff --git a/shell/browser/ui/autofill_popup.cc b/shell/browser/ui/autofill_popup.cc index aad02085208f..81d6f1262b7e 100644 --- a/shell/browser/ui/autofill_popup.cc +++ b/shell/browser/ui/autofill_popup.cc @@ -89,8 +89,8 @@ void AutofillPopup::Hide() { } } -void AutofillPopup::SetItems(const std::vector& values, - const std::vector& labels) { +void AutofillPopup::SetItems(const std::vector& values, + const std::vector& labels) { DCHECK(view_); values_ = values; labels_ = labels; @@ -184,11 +184,11 @@ int AutofillPopup::GetLineCount() { return values_.size(); } -base::string16 AutofillPopup::GetValueAt(int i) { +std::u16string AutofillPopup::GetValueAt(int i) { return values_.at(i); } -base::string16 AutofillPopup::GetLabelAt(int i) { +std::u16string AutofillPopup::GetLabelAt(int i) { return labels_.at(i); } diff --git a/shell/browser/ui/autofill_popup.h b/shell/browser/ui/autofill_popup.h index 7ac961a8cfb6..1a7090d9f0d7 100644 --- a/shell/browser/ui/autofill_popup.h +++ b/shell/browser/ui/autofill_popup.h @@ -30,8 +30,8 @@ class AutofillPopup : public views::ViewObserver { const gfx::RectF& bounds); void Hide(); - void SetItems(const std::vector& values, - const std::vector& labels); + void SetItems(const std::vector& values, + const std::vector& labels); void UpdatePopupBounds(); gfx::Rect popup_bounds_in_view(); @@ -53,8 +53,8 @@ class AutofillPopup : public views::ViewObserver { ui::NativeTheme::ColorId GetBackgroundColorIDForRow(int index) const; int GetLineCount(); - base::string16 GetValueAt(int i); - base::string16 GetLabelAt(int i); + std::u16string GetValueAt(int i); + std::u16string GetLabelAt(int i); int LineFromY(int y) const; int selected_index_; @@ -66,8 +66,8 @@ class AutofillPopup : public views::ViewObserver { gfx::Rect element_bounds_; // Datalist suggestions - std::vector values_; - std::vector labels_; + std::vector values_; + std::vector labels_; // Font lists for the suggestions gfx::FontList smaller_font_list_; diff --git a/shell/browser/ui/cocoa/electron_menu_controller.mm b/shell/browser/ui/cocoa/electron_menu_controller.mm index 4de4248a5f6f..d543c27295f7 100644 --- a/shell/browser/ui/cocoa/electron_menu_controller.mm +++ b/shell/browser/ui/cocoa/electron_menu_controller.mm @@ -197,7 +197,7 @@ static base::scoped_nsobject recentDocumentsMenuSwap_; // Locate & retain the recent documents menu item if (!recentDocumentsMenuItem_) { - base::string16 title = base::ASCIIToUTF16("Open Recent"); + std::u16string title = base::ASCIIToUTF16("Open Recent"); NSString* openTitle = l10n_util::FixUpWindowsStyleLabel(title); recentDocumentsMenuItem_.reset([[[[[NSApp mainMenu] @@ -320,7 +320,7 @@ static base::scoped_nsobject recentDocumentsMenuSwap_; - (void)addItemToMenu:(NSMenu*)menu atIndex:(NSInteger)index fromModel:(electron::ElectronMenuModel*)model { - base::string16 label16 = model->GetLabelAt(index); + std::u16string label16 = model->GetLabelAt(index); NSString* label = l10n_util::FixUpWindowsStyleLabel(label16); base::scoped_nsobject item([[NSMenuItem alloc] @@ -333,14 +333,14 @@ static base::scoped_nsobject recentDocumentsMenuSwap_; if (icon.IsImage()) [item setImage:icon.GetImage().ToNSImage()]; - base::string16 toolTip = model->GetToolTipAt(index); + std::u16string toolTip = model->GetToolTipAt(index); [item setToolTip:base::SysUTF16ToNSString(toolTip)]; - base::string16 role = model->GetRoleAt(index); + std::u16string role = model->GetRoleAt(index); electron::ElectronMenuModel::ItemType type = model->GetTypeAt(index); if (role == base::ASCIIToUTF16("services")) { - base::string16 title = base::ASCIIToUTF16("Services"); + std::u16string title = base::ASCIIToUTF16("Services"); NSString* label = l10n_util::FixUpWindowsStyleLabel(title); [item setTarget:nil]; diff --git a/shell/browser/ui/electron_menu_model.cc b/shell/browser/ui/electron_menu_model.cc index b4680e64f92c..7b91850160c0 100644 --- a/shell/browser/ui/electron_menu_model.cc +++ b/shell/browser/ui/electron_menu_model.cc @@ -27,38 +27,38 @@ ElectronMenuModel::ElectronMenuModel(Delegate* delegate) ElectronMenuModel::~ElectronMenuModel() = default; -void ElectronMenuModel::SetToolTip(int index, const base::string16& toolTip) { +void ElectronMenuModel::SetToolTip(int index, const std::u16string& toolTip) { int command_id = GetCommandIdAt(index); toolTips_[command_id] = toolTip; } -base::string16 ElectronMenuModel::GetToolTipAt(int index) { +std::u16string ElectronMenuModel::GetToolTipAt(int index) { const int command_id = GetCommandIdAt(index); const auto iter = toolTips_.find(command_id); - return iter == std::end(toolTips_) ? base::string16() : iter->second; + return iter == std::end(toolTips_) ? std::u16string() : iter->second; } -void ElectronMenuModel::SetRole(int index, const base::string16& role) { +void ElectronMenuModel::SetRole(int index, const std::u16string& role) { int command_id = GetCommandIdAt(index); roles_[command_id] = role; } -base::string16 ElectronMenuModel::GetRoleAt(int index) { +std::u16string ElectronMenuModel::GetRoleAt(int index) { const int command_id = GetCommandIdAt(index); const auto iter = roles_.find(command_id); - return iter == std::end(roles_) ? base::string16() : iter->second; + return iter == std::end(roles_) ? std::u16string() : iter->second; } void ElectronMenuModel::SetSecondaryLabel(int index, - const base::string16& sublabel) { + const std::u16string& sublabel) { int command_id = GetCommandIdAt(index); sublabels_[command_id] = sublabel; } -base::string16 ElectronMenuModel::GetSecondaryLabelAt(int index) const { +std::u16string ElectronMenuModel::GetSecondaryLabelAt(int index) const { int command_id = GetCommandIdAt(index); const auto iter = sublabels_.find(command_id); - return iter == std::end(sublabels_) ? base::string16() : iter->second; + return iter == std::end(sublabels_) ? std::u16string() : iter->second; } bool ElectronMenuModel::GetAcceleratorAtWithParams( diff --git a/shell/browser/ui/electron_menu_model.h b/shell/browser/ui/electron_menu_model.h index de2ebd07899c..bf8dbcb95fef 100644 --- a/shell/browser/ui/electron_menu_model.h +++ b/shell/browser/ui/electron_menu_model.h @@ -77,12 +77,12 @@ class ElectronMenuModel : public ui::SimpleMenuModel { void AddObserver(Observer* obs) { observers_.AddObserver(obs); } void RemoveObserver(Observer* obs) { observers_.RemoveObserver(obs); } - void SetToolTip(int index, const base::string16& toolTip); - base::string16 GetToolTipAt(int index); - void SetRole(int index, const base::string16& role); - base::string16 GetRoleAt(int index); - void SetSecondaryLabel(int index, const base::string16& sublabel); - base::string16 GetSecondaryLabelAt(int index) const override; + void SetToolTip(int index, const std::u16string& toolTip); + std::u16string GetToolTipAt(int index); + void SetRole(int index, const std::u16string& role); + std::u16string GetRoleAt(int index); + void SetSecondaryLabel(int index, const std::u16string& sublabel); + std::u16string GetSecondaryLabelAt(int index) const override; bool GetAcceleratorAtWithParams(int index, bool use_default_accelerator, ui::Accelerator* accelerator) const; @@ -114,9 +114,9 @@ class ElectronMenuModel : public ui::SimpleMenuModel { base::Optional sharing_item_; #endif - std::map toolTips_; // command id -> tooltip - std::map roles_; // command id -> role - std::map sublabels_; // command id -> sublabel + std::map toolTips_; // command id -> tooltip + std::map roles_; // command id -> role + std::map sublabels_; // command id -> sublabel base::ObserverList observers_; base::WeakPtrFactory weak_factory_{this}; diff --git a/shell/browser/ui/gtk/app_indicator_icon.cc b/shell/browser/ui/gtk/app_indicator_icon.cc index f87b752fbef1..6a530857163f 100644 --- a/shell/browser/ui/gtk/app_indicator_icon.cc +++ b/shell/browser/ui/gtk/app_indicator_icon.cc @@ -157,7 +157,7 @@ namespace gtkui { AppIndicatorIcon::AppIndicatorIcon(std::string id, const gfx::ImageSkia& image, - const base::string16& tool_tip) + const std::u16string& tool_tip) : id_(id) { std::unique_ptr env(base::Environment::Create()); desktop_env_ = base::nix::GetDesktopEnvironment(env.get()); @@ -215,7 +215,7 @@ void AppIndicatorIcon::SetIcon(const gfx::ImageSkia& image) { } } -void AppIndicatorIcon::SetToolTip(const base::string16& tool_tip) { +void AppIndicatorIcon::SetToolTip(const std::u16string& tool_tip) { DCHECK(!tool_tip_.empty()); tool_tip_ = base::UTF16ToUTF8(tool_tip); UpdateClickActionReplacementMenuItem(); diff --git a/shell/browser/ui/gtk/app_indicator_icon.h b/shell/browser/ui/gtk/app_indicator_icon.h index 7aa023919342..4174463ca84a 100644 --- a/shell/browser/ui/gtk/app_indicator_icon.h +++ b/shell/browser/ui/gtk/app_indicator_icon.h @@ -41,7 +41,7 @@ class AppIndicatorIcon : public views::StatusIconLinux { // icons. AppIndicatorIcon(std::string id, const gfx::ImageSkia& image, - const base::string16& tool_tip); + const std::u16string& tool_tip); ~AppIndicatorIcon() override; // Indicates whether libappindicator so could be opened. @@ -49,7 +49,7 @@ class AppIndicatorIcon : public views::StatusIconLinux { // Overridden from views::StatusIconLinux: void SetIcon(const gfx::ImageSkia& image) override; - void SetToolTip(const base::string16& tool_tip) override; + void SetToolTip(const std::u16string& tool_tip) override; void UpdatePlatformContextMenu(ui::MenuModel* menu) override; void RefreshPlatformContextMenu() override; diff --git a/shell/browser/ui/gtk/gtk_status_icon.cc b/shell/browser/ui/gtk/gtk_status_icon.cc index 244f3876f869..ecad7d470c5e 100644 --- a/shell/browser/ui/gtk/gtk_status_icon.cc +++ b/shell/browser/ui/gtk/gtk_status_icon.cc @@ -20,7 +20,7 @@ namespace electron { namespace gtkui { GtkStatusIcon::GtkStatusIcon(const gfx::ImageSkia& image, - const base::string16& tool_tip) { + const std::u16string& tool_tip) { GdkPixbuf* pixbuf = gtk_util::GdkPixbufFromSkBitmap(*image.bitmap()); { // GTK has a bug that leaks 384 bytes when creating a GtkStatusIcon. It @@ -50,7 +50,7 @@ void GtkStatusIcon::SetIcon(const gfx::ImageSkia& image) { g_object_unref(pixbuf); } -void GtkStatusIcon::SetToolTip(const base::string16& tool_tip) { +void GtkStatusIcon::SetToolTip(const std::u16string& tool_tip) { gtk_status_icon_set_tooltip_text(gtk_status_icon_, base::UTF16ToUTF8(tool_tip).c_str()); } diff --git a/shell/browser/ui/gtk/gtk_status_icon.h b/shell/browser/ui/gtk/gtk_status_icon.h index 07c49f25f868..fe1454505505 100644 --- a/shell/browser/ui/gtk/gtk_status_icon.h +++ b/shell/browser/ui/gtk/gtk_status_icon.h @@ -32,12 +32,12 @@ class AppIndicatorIconMenu; // GtkStatusIcon). class GtkStatusIcon : public views::StatusIconLinux { public: - GtkStatusIcon(const gfx::ImageSkia& image, const base::string16& tool_tip); + GtkStatusIcon(const gfx::ImageSkia& image, const std::u16string& tool_tip); ~GtkStatusIcon() override; // Overridden from views::StatusIconLinux: void SetIcon(const gfx::ImageSkia& image) override; - void SetToolTip(const base::string16& tool_tip) override; + void SetToolTip(const std::u16string& tool_tip) override; void UpdatePlatformContextMenu(ui::MenuModel* menu) override; void RefreshPlatformContextMenu() override; diff --git a/shell/browser/ui/gtk/status_icon.cc b/shell/browser/ui/gtk/status_icon.cc index 43b91c645eab..6a78f82d0c10 100644 --- a/shell/browser/ui/gtk/status_icon.cc +++ b/shell/browser/ui/gtk/status_icon.cc @@ -37,7 +37,7 @@ bool IsStatusIconSupported() { std::unique_ptr CreateLinuxStatusIcon( const gfx::ImageSkia& image, - const base::string16& tool_tip, + const std::u16string& tool_tip, const char* id_prefix) { #if GTK_CHECK_VERSION(3, 90, 0) NOTIMPLEMENTED(); diff --git a/shell/browser/ui/gtk/status_icon.h b/shell/browser/ui/gtk/status_icon.h index 3fd40dcf2704..384938ef8e85 100644 --- a/shell/browser/ui/gtk/status_icon.h +++ b/shell/browser/ui/gtk/status_icon.h @@ -22,7 +22,7 @@ namespace gtkui { bool IsStatusIconSupported(); std::unique_ptr CreateLinuxStatusIcon( const gfx::ImageSkia& image, - const base::string16& tool_tip, + const std::u16string& tool_tip, const char* id_prefix); } // namespace gtkui diff --git a/shell/browser/ui/inspectable_web_contents.cc b/shell/browser/ui/inspectable_web_contents.cc index 6d804138fa3b..87829e848a05 100644 --- a/shell/browser/ui/inspectable_web_contents.cc +++ b/shell/browser/ui/inspectable_web_contents.cc @@ -567,7 +567,7 @@ void InspectableWebContents::LoadCompleted() { prefs->GetString("currentDockState", ¤t_dock_state); base::RemoveChars(current_dock_state, "\"", &dock_state_); } - base::string16 javascript = base::UTF8ToUTF16( + std::u16string javascript = base::UTF8ToUTF16( "UI.DockController.instance().setDockSide(\"" + dock_state_ + "\");"); GetDevToolsWebContents()->GetMainFrame()->ExecuteJavaScript( javascript, base::NullCallback()); @@ -902,7 +902,7 @@ void InspectableWebContents::DispatchProtocolMessage( if (str_message.size() < kMaxMessageChunkSize) { std::string param; base::EscapeJSONString(str_message, true, ¶m); - base::string16 javascript = + std::u16string javascript = base::UTF8ToUTF16("DevToolsAPI.dispatchMessage(" + param + ");"); GetDevToolsWebContents()->GetMainFrame()->ExecuteJavaScript( javascript, base::NullCallback()); @@ -949,9 +949,9 @@ void InspectableWebContents::WebContentsDestroyed() { bool InspectableWebContents::DidAddMessageToConsole( content::WebContents* source, blink::mojom::ConsoleMessageLevel level, - const base::string16& message, + const std::u16string& message, int32_t line_no, - const base::string16& source_id) { + const std::u16string& source_id) { logging::LogMessage("CONSOLE", line_no, blink::ConsoleMessageLevelToLogSeverity(level)) .stream() diff --git a/shell/browser/ui/inspectable_web_contents.h b/shell/browser/ui/inspectable_web_contents.h index f49179815859..69a000ccf152 100644 --- a/shell/browser/ui/inspectable_web_contents.h +++ b/shell/browser/ui/inspectable_web_contents.h @@ -177,9 +177,9 @@ class InspectableWebContents // content::WebContentsDelegate: bool DidAddMessageToConsole(content::WebContents* source, blink::mojom::ConsoleMessageLevel level, - const base::string16& message, + const std::u16string& message, int32_t line_no, - const base::string16& source_id) override; + const std::u16string& source_id) override; bool HandleKeyboardEvent(content::WebContents*, const content::NativeWebKeyboardEvent&) override; void CloseContents(content::WebContents* source) override; diff --git a/shell/browser/ui/inspectable_web_contents_view.h b/shell/browser/ui/inspectable_web_contents_view.h index 4fbd3d7fd849..233a1276f252 100644 --- a/shell/browser/ui/inspectable_web_contents_view.h +++ b/shell/browser/ui/inspectable_web_contents_view.h @@ -51,7 +51,7 @@ class InspectableWebContentsView { virtual void SetIsDocked(bool docked, bool activate) = 0; virtual void SetContentsResizingStrategy( const DevToolsContentsResizingStrategy& strategy) = 0; - virtual void SetTitle(const base::string16& title) = 0; + virtual void SetTitle(const std::u16string& title) = 0; private: InspectableWebContentsViewDelegate* delegate_ = nullptr; // weak references. diff --git a/shell/browser/ui/inspectable_web_contents_view_mac.h b/shell/browser/ui/inspectable_web_contents_view_mac.h index 3ab732f96f34..8a30bc532917 100644 --- a/shell/browser/ui/inspectable_web_contents_view_mac.h +++ b/shell/browser/ui/inspectable_web_contents_view_mac.h @@ -33,7 +33,7 @@ class InspectableWebContentsViewMac : public InspectableWebContentsView { void SetIsDocked(bool docked, bool activate) override; void SetContentsResizingStrategy( const DevToolsContentsResizingStrategy& strategy) override; - void SetTitle(const base::string16& title) override; + void SetTitle(const std::u16string& title) override; InspectableWebContents* inspectable_web_contents() { return inspectable_web_contents_; diff --git a/shell/browser/ui/inspectable_web_contents_view_mac.mm b/shell/browser/ui/inspectable_web_contents_view_mac.mm index 2523a933e5b2..f9e9011669d0 100644 --- a/shell/browser/ui/inspectable_web_contents_view_mac.mm +++ b/shell/browser/ui/inspectable_web_contents_view_mac.mm @@ -58,7 +58,7 @@ void InspectableWebContentsViewMac::SetContentsResizingStrategy( [view_ setContentsResizingStrategy:strategy]; } -void InspectableWebContentsViewMac::SetTitle(const base::string16& title) { +void InspectableWebContentsViewMac::SetTitle(const std::u16string& title) { [view_ setTitle:base::SysUTF16ToNSString(title)]; } diff --git a/shell/browser/ui/message_box.h b/shell/browser/ui/message_box.h index d2548ffa5366..9126b9940736 100644 --- a/shell/browser/ui/message_box.h +++ b/shell/browser/ui/message_box.h @@ -56,7 +56,7 @@ void ShowMessageBox(const MessageBoxSettings& settings, // Like ShowMessageBox with simplest settings, but safe to call at very early // stage of application. -void ShowErrorBox(const base::string16& title, const base::string16& content); +void ShowErrorBox(const std::u16string& title, const std::u16string& content); } // namespace electron diff --git a/shell/browser/ui/message_box_gtk.cc b/shell/browser/ui/message_box_gtk.cc index 739f4a8de8e2..b1290a6a5783 100644 --- a/shell/browser/ui/message_box_gtk.cc +++ b/shell/browser/ui/message_box_gtk.cc @@ -220,7 +220,7 @@ void ShowMessageBox(const MessageBoxSettings& settings, (new GtkMessageBox(settings))->RunAsynchronous(std::move(callback)); } -void ShowErrorBox(const base::string16& title, const base::string16& content) { +void ShowErrorBox(const std::u16string& title, const std::u16string& content) { if (Browser::Get()->is_ready()) { electron::MessageBoxSettings settings; settings.type = electron::MessageBoxType::kError; diff --git a/shell/browser/ui/message_box_mac.mm b/shell/browser/ui/message_box_mac.mm index fe24fe963ce4..55fbf746e538 100644 --- a/shell/browser/ui/message_box_mac.mm +++ b/shell/browser/ui/message_box_mac.mm @@ -146,7 +146,7 @@ void ShowMessageBox(const MessageBoxSettings& settings, } } -void ShowErrorBox(const base::string16& title, const base::string16& content) { +void ShowErrorBox(const std::u16string& title, const std::u16string& content) { NSAlert* alert = [[NSAlert alloc] init]; [alert setMessageText:base::SysUTF16ToNSString(title)]; [alert setInformativeText:base::SysUTF16ToNSString(content)]; diff --git a/shell/browser/ui/message_box_win.cc b/shell/browser/ui/message_box_win.cc index 19e0190f0501..2e5751e72390 100644 --- a/shell/browser/ui/message_box_win.cc +++ b/shell/browser/ui/message_box_win.cc @@ -39,8 +39,8 @@ struct CommonButtonID { int button; int id; }; -CommonButtonID GetCommonID(const base::string16& button) { - base::string16 lower = base::ToLowerASCII(button); +CommonButtonID GetCommonID(const std::u16string& button) { + std::u16string lower = base::ToLowerASCII(button); if (lower == L"ok") return {TDCBF_OK_BUTTON, IDOK}; else if (lower == L"yes") @@ -58,7 +58,7 @@ CommonButtonID GetCommonID(const base::string16& button) { // Determine whether the buttons are common buttons, if so map common ID // to button ID. -void MapToCommonID(const std::vector& buttons, +void MapToCommonID(const std::vector& buttons, std::map* id_map, TASKDIALOG_COMMON_BUTTON_FLAGS* button_flags, std::vector* dialog_buttons) { @@ -78,14 +78,14 @@ void MapToCommonID(const std::vector& buttons, DialogResult ShowTaskDialogUTF16(NativeWindow* parent, MessageBoxType type, - const std::vector& buttons, + const std::vector& buttons, int default_id, int cancel_id, bool no_link, - const base::string16& title, - const base::string16& message, - const base::string16& detail, - const base::string16& checkbox_label, + const std::u16string& title, + const std::u16string& message, + const std::u16string& detail, + const std::u16string& checkbox_label, bool checkbox_checked, const gfx::ImageSkia& icon) { TASKDIALOG_FLAGS flags = @@ -107,7 +107,7 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent, // TaskDialogIndirect doesn't allow empty name, if we set empty title it // will show "electron.exe" in title. - base::string16 app_name = base::UTF8ToUTF16(Browser::Get()->GetName()); + std::u16string app_name = base::UTF8ToUTF16(Browser::Get()->GetName()); if (title.empty()) config.pszWindowTitle = app_name.c_str(); else @@ -185,14 +185,14 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent, } DialogResult ShowTaskDialogUTF8(const MessageBoxSettings& settings) { - std::vector utf16_buttons; + std::vector utf16_buttons; for (const auto& button : settings.buttons) utf16_buttons.push_back(base::UTF8ToUTF16(button)); - const base::string16 title_16 = base::UTF8ToUTF16(settings.title); - const base::string16 message_16 = base::UTF8ToUTF16(settings.message); - const base::string16 detail_16 = base::UTF8ToUTF16(settings.detail); - const base::string16 checkbox_label_16 = + const std::u16string title_16 = base::UTF8ToUTF16(settings.title); + const std::u16string message_16 = base::UTF8ToUTF16(settings.message); + const std::u16string detail_16 = base::UTF8ToUTF16(settings.detail); + const std::u16string checkbox_label_16 = base::UTF8ToUTF16(settings.checkbox_label); return ShowTaskDialogUTF16( @@ -219,7 +219,7 @@ void ShowMessageBox(const MessageBoxSettings& settings, std::move(callback))); } -void ShowErrorBox(const base::string16& title, const base::string16& content) { +void ShowErrorBox(const std::u16string& title, const std::u16string& content) { electron::UnresponsiveSuppressor suppressor; ShowTaskDialogUTF16(nullptr, MessageBoxType::kError, {}, -1, 0, false, L"Error", title, content, L"", false, gfx::ImageSkia()); diff --git a/shell/browser/ui/tray_icon.h b/shell/browser/ui/tray_icon.h index 307bf49bf89c..16f1ef05135d 100644 --- a/shell/browser/ui/tray_icon.h +++ b/shell/browser/ui/tray_icon.h @@ -64,8 +64,8 @@ class TrayIcon { #else gfx::Image icon; #endif - base::string16 title; - base::string16 content; + std::u16string title; + std::u16string content; bool large_icon = true; bool no_sound = false; bool respect_quiet_time = false; diff --git a/shell/browser/ui/tray_icon_gtk.cc b/shell/browser/ui/tray_icon_gtk.cc index 1c97aa61be74..a1205e27f78d 100644 --- a/shell/browser/ui/tray_icon_gtk.cc +++ b/shell/browser/ui/tray_icon_gtk.cc @@ -47,7 +47,7 @@ const gfx::ImageSkia& TrayIconGtk::GetImage() const { return image_; } -const base::string16& TrayIconGtk::GetToolTip() const { +const std::u16string& TrayIconGtk::GetToolTip() const { return tool_tip_; } diff --git a/shell/browser/ui/tray_icon_gtk.h b/shell/browser/ui/tray_icon_gtk.h index 1580d60bf502..41193af329d7 100644 --- a/shell/browser/ui/tray_icon_gtk.h +++ b/shell/browser/ui/tray_icon_gtk.h @@ -33,14 +33,14 @@ class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate { // The following four methods are only used by StatusIconLinuxDbus, which we // aren't yet using, so they are given stub implementations. const gfx::ImageSkia& GetImage() const override; - const base::string16& GetToolTip() const override; + const std::u16string& GetToolTip() const override; ui::MenuModel* GetMenuModel() const override; void OnImplInitializationFailed() override; private: std::unique_ptr icon_; gfx::ImageSkia image_; - base::string16 tool_tip_; + std::u16string tool_tip_; ui::MenuModel* menu_model_; DISALLOW_COPY_AND_ASSIGN(TrayIconGtk); diff --git a/shell/browser/ui/views/autofill_popup_view.h b/shell/browser/ui/views/autofill_popup_view.h index c6e0da1d457d..1209bdd7a2ab 100644 --- a/shell/browser/ui/views/autofill_popup_view.h +++ b/shell/browser/ui/views/autofill_popup_view.h @@ -37,7 +37,7 @@ class AutofillPopup; // by |AutofillPopupViewViews|. class AutofillPopupChildView : public views::View { public: - explicit AutofillPopupChildView(const base::string16& suggestion) + explicit AutofillPopupChildView(const std::u16string& suggestion) : suggestion_(suggestion) { SetFocusBehavior(FocusBehavior::ALWAYS); } @@ -48,7 +48,7 @@ class AutofillPopupChildView : public views::View { // views::Views implementation void GetAccessibleNodeData(ui::AXNodeData* node_data) override; - base::string16 suggestion_; + std::u16string suggestion_; DISALLOW_COPY_AND_ASSIGN(AutofillPopupChildView); }; diff --git a/shell/browser/ui/views/electron_views_delegate.cc b/shell/browser/ui/views/electron_views_delegate.cc index bdc206f7d40c..faf123fc09d7 100644 --- a/shell/browser/ui/views/electron_views_delegate.cc +++ b/shell/browser/ui/views/electron_views_delegate.cc @@ -47,8 +47,8 @@ bool ViewsDelegate::GetSavedWindowPlacement( return false; } -void ViewsDelegate::NotifyMenuItemFocused(const base::string16& menu_name, - const base::string16& menu_item_name, +void ViewsDelegate::NotifyMenuItemFocused(const std::u16string& menu_name, + const std::u16string& menu_item_name, int item_index, int item_count, bool has_submenu) {} diff --git a/shell/browser/ui/views/electron_views_delegate.h b/shell/browser/ui/views/electron_views_delegate.h index 58c4e33cb850..6c06a7ff18e3 100644 --- a/shell/browser/ui/views/electron_views_delegate.h +++ b/shell/browser/ui/views/electron_views_delegate.h @@ -29,8 +29,8 @@ class ViewsDelegate : public views::ViewsDelegate { const std::string& window_name, gfx::Rect* bounds, ui::WindowShowState* show_state) const override; - void NotifyMenuItemFocused(const base::string16& menu_name, - const base::string16& menu_item_name, + void NotifyMenuItemFocused(const std::u16string& menu_name, + const std::u16string& menu_item_name, int item_index, int item_count, bool has_submenu) override; diff --git a/shell/browser/ui/views/global_menu_bar_x11.cc b/shell/browser/ui/views/global_menu_bar_x11.cc index d96fad6e0e35..387cc1b0f6ef 100644 --- a/shell/browser/ui/views/global_menu_bar_x11.cc +++ b/shell/browser/ui/views/global_menu_bar_x11.cc @@ -297,7 +297,7 @@ void GlobalMenuBarX11::RegisterAccelerator(DbusmenuMenuitem* item, NOTIMPLEMENTED(); return; } - std::string name = base::UTF16ToUTF8(base::string16(1, keysym)); + std::string name = base::UTF16ToUTF8(std::u16string(1, keysym)); g_variant_builder_add(&builder, "s", name.c_str()); GVariant* inside_array = g_variant_builder_end(&builder); diff --git a/shell/browser/ui/views/inspectable_web_contents_view_views.cc b/shell/browser/ui/views/inspectable_web_contents_view_views.cc index cbeab44decf7..74b1f706cf42 100644 --- a/shell/browser/ui/views/inspectable_web_contents_view_views.cc +++ b/shell/browser/ui/views/inspectable_web_contents_view_views.cc @@ -46,7 +46,7 @@ class DevToolsWindowDelegate : public views::ClientView, bool CanResize() const override { return true; } bool CanMaximize() const override { return true; } bool CanMinimize() const override { return true; } - base::string16 GetWindowTitle() const override { return shell_->GetTitle(); } + std::u16string GetWindowTitle() const override { return shell_->GetTitle(); } gfx::ImageSkia GetWindowAppIcon() override { return GetWindowIcon(); } gfx::ImageSkia GetWindowIcon() override { return icon_; } views::Widget* GetWidget() override { return widget_; } @@ -202,7 +202,7 @@ void InspectableWebContentsViewViews::SetContentsResizingStrategy( Layout(); } -void InspectableWebContentsViewViews::SetTitle(const base::string16& title) { +void InspectableWebContentsViewViews::SetTitle(const std::u16string& title) { if (devtools_window_) { title_ = title; devtools_window_->UpdateWindowTitle(); diff --git a/shell/browser/ui/views/inspectable_web_contents_view_views.h b/shell/browser/ui/views/inspectable_web_contents_view_views.h index 69864f96bb1c..3b209152889d 100644 --- a/shell/browser/ui/views/inspectable_web_contents_view_views.h +++ b/shell/browser/ui/views/inspectable_web_contents_view_views.h @@ -39,13 +39,13 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView, void SetIsDocked(bool docked, bool activate) override; void SetContentsResizingStrategy( const DevToolsContentsResizingStrategy& strategy) override; - void SetTitle(const base::string16& title) override; + void SetTitle(const std::u16string& title) override; InspectableWebContents* inspectable_web_contents() { return inspectable_web_contents_; } - const base::string16& GetTitle() const { return title_; } + const std::u16string& GetTitle() const { return title_; } private: // views::View: @@ -62,7 +62,7 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView, DevToolsContentsResizingStrategy strategy_; bool devtools_visible_ = false; views::WidgetDelegate* devtools_window_delegate_ = nullptr; - base::string16 title_; + std::u16string title_; DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewViews); }; diff --git a/shell/browser/ui/views/menu_delegate.cc b/shell/browser/ui/views/menu_delegate.cc index e2988ec6f77a..435242c2a2c6 100644 --- a/shell/browser/ui/views/menu_delegate.cc +++ b/shell/browser/ui/views/menu_delegate.cc @@ -70,7 +70,7 @@ bool MenuDelegate::GetAccelerator(int id, ui::Accelerator* accelerator) const { return adapter_->GetAccelerator(id, accelerator); } -base::string16 MenuDelegate::GetLabel(int id) const { +std::u16string MenuDelegate::GetLabel(int id) const { return adapter_->GetLabel(id); } diff --git a/shell/browser/ui/views/menu_delegate.h b/shell/browser/ui/views/menu_delegate.h index d961dbb68a42..1156d45a9228 100644 --- a/shell/browser/ui/views/menu_delegate.h +++ b/shell/browser/ui/views/menu_delegate.h @@ -46,7 +46,7 @@ class MenuDelegate : public views::MenuDelegate { bool IsTriggerableEvent(views::MenuItemView* source, const ui::Event& e) override; bool GetAccelerator(int id, ui::Accelerator* accelerator) const override; - base::string16 GetLabel(int id) const override; + std::u16string GetLabel(int id) const override; void GetLabelStyle(int id, LabelStyle* style) const override; bool IsCommandEnabled(int id) const override; bool IsCommandVisible(int id) const override; diff --git a/shell/browser/ui/views/submenu_button.cc b/shell/browser/ui/views/submenu_button.cc index 89a51c8ed656..a6027e8d8bca 100644 --- a/shell/browser/ui/views/submenu_button.cc +++ b/shell/browser/ui/views/submenu_button.cc @@ -21,7 +21,7 @@ namespace electron { SubmenuButton::SubmenuButton(PressedCallback callback, - const base::string16& title, + const std::u16string& title, const SkColor& background_color) : views::MenuButton(callback, gfx::RemoveAccelerator(title)), background_color_(background_color) { @@ -89,12 +89,12 @@ void SubmenuButton::PaintButtonContents(gfx::Canvas* canvas) { } } -bool SubmenuButton::GetUnderlinePosition(const base::string16& text, +bool SubmenuButton::GetUnderlinePosition(const std::u16string& text, char16_t* accelerator, int* start, int* end) const { int pos, span; - base::string16 trimmed = + std::u16string trimmed = gfx::LocateAndRemoveAcceleratorChar(text, &pos, &span); if (pos > -1 && span != 0) { *accelerator = base::ToUpperASCII(trimmed[pos]); @@ -106,7 +106,7 @@ bool SubmenuButton::GetUnderlinePosition(const base::string16& text, return false; } -void SubmenuButton::GetCharacterPosition(const base::string16& text, +void SubmenuButton::GetCharacterPosition(const std::u16string& text, int index, int* pos) const { int height = 0; diff --git a/shell/browser/ui/views/submenu_button.h b/shell/browser/ui/views/submenu_button.h index 10344cd6842d..2a4d5cae8ad5 100644 --- a/shell/browser/ui/views/submenu_button.h +++ b/shell/browser/ui/views/submenu_button.h @@ -17,7 +17,7 @@ namespace electron { class SubmenuButton : public views::MenuButton { public: SubmenuButton(PressedCallback callback, - const base::string16& title, + const std::u16string& title, const SkColor& background_color); ~SubmenuButton() override; @@ -36,11 +36,11 @@ class SubmenuButton : public views::MenuButton { std::unique_ptr CreateInkDrop() override; private: - bool GetUnderlinePosition(const base::string16& text, + bool GetUnderlinePosition(const std::u16string& text, char16_t* accelerator, int* start, int* end) const; - void GetCharacterPosition(const base::string16& text, + void GetCharacterPosition(const std::u16string& text, int index, int* pos) const; diff --git a/shell/browser/ui/win/jump_list.cc b/shell/browser/ui/win/jump_list.cc index 310887ca4210..22d72b6e9bc1 100644 --- a/shell/browser/ui/win/jump_list.cc +++ b/shell/browser/ui/win/jump_list.cc @@ -158,7 +158,7 @@ JumpListCategory::JumpListCategory() = default; JumpListCategory::JumpListCategory(const JumpListCategory&) = default; JumpListCategory::~JumpListCategory() = default; -JumpList::JumpList(const base::string16& app_id) : app_id_(app_id) { +JumpList::JumpList(const std::u16string& app_id) : app_id_(app_id) { destinations_.CoCreateInstance(CLSID_DestinationList); } diff --git a/shell/browser/ui/win/jump_list.h b/shell/browser/ui/win/jump_list.h index 39dc118ec4f0..ae202dbc3548 100644 --- a/shell/browser/ui/win/jump_list.h +++ b/shell/browser/ui/win/jump_list.h @@ -46,9 +46,9 @@ struct JumpListItem { // For tasks this is the path to the program executable, for file links this // is the full filename. base::FilePath path; - base::string16 arguments; - base::string16 title; - base::string16 description; + std::u16string arguments; + std::u16string title; + std::u16string description; base::FilePath working_dir; base::FilePath icon_path; int icon_index = 0; @@ -73,7 +73,7 @@ struct JumpListCategory { }; Type type = Type::kTasks; - base::string16 name; + std::u16string name; std::vector items; JumpListCategory(); @@ -88,7 +88,7 @@ class JumpList { // |app_id| must be the Application User Model ID of the app for which the // custom Jump List should be created/removed, it's usually obtained by // calling GetCurrentProcessExplicitAppUserModelID(). - explicit JumpList(const base::string16& app_id); + explicit JumpList(const std::u16string& app_id); ~JumpList(); // Starts a new transaction, must be called before appending any categories, @@ -111,7 +111,7 @@ class JumpList { const std::vector& categories); private: - base::string16 app_id_; + std::u16string app_id_; CComPtr destinations_; DISALLOW_COPY_AND_ASSIGN(JumpList); diff --git a/shell/browser/web_contents_preferences.cc b/shell/browser/web_contents_preferences.cc index 8cab86df11f9..20317bfd6d8a 100644 --- a/shell/browser/web_contents_preferences.cc +++ b/shell/browser/web_contents_preferences.cc @@ -50,7 +50,7 @@ bool GetAsString(const base::Value* val, bool GetAsString(const base::Value* val, base::StringPiece path, - base::string16* out) { + std::u16string* out) { if (val) { auto* found = val->FindKeyOfType(path, base::Value::Type::STRING); if (found) { @@ -380,7 +380,7 @@ void WebContentsPreferences::OverrideWebkitPrefs( auto* fonts_dict = preference_.FindKeyOfType("defaultFontFamily", base::Value::Type::DICTIONARY); if (fonts_dict) { - base::string16 font; + std::u16string font; if (GetAsString(fonts_dict, "standard", &font)) prefs->standard_font_family_map[blink::web_pref::kCommonScript] = font; if (GetAsString(fonts_dict, "serif", &font)) diff --git a/shell/browser/web_dialog_helper.cc b/shell/browser/web_dialog_helper.cc index 47993cd4a482..976eaedeb9c8 100644 --- a/shell/browser/web_dialog_helper.cc +++ b/shell/browser/web_dialog_helper.cc @@ -35,7 +35,7 @@ using blink::mojom::NativeFileInfo; namespace { file_dialog::Filters GetFileTypesFromAcceptType( - const std::vector& accept_types) { + const std::vector& accept_types) { file_dialog::Filters filters; if (accept_types.empty()) return filters; @@ -163,7 +163,7 @@ void WebDialogHelper::EnumerateDirectory( std::vector file_info; while (!(path = file_enum.Next()).empty()) { file_info.push_back(FileChooserFileInfo::NewNativeFile( - NativeFileInfo::New(path, base::string16()))); + NativeFileInfo::New(path, std::u16string()))); } listener->FileSelected(std::move(file_info), dir, diff --git a/shell/common/api/electron_api_clipboard.cc b/shell/common/api/electron_api_clipboard.cc index 50db8a1c59ae..e67e846912e2 100644 --- a/shell/common/api/electron_api_clipboard.cc +++ b/shell/common/api/electron_api_clipboard.cc @@ -26,9 +26,9 @@ ui::ClipboardBuffer Clipboard::GetClipboardBuffer(gin_helper::Arguments* args) { return ui::ClipboardBuffer::kCopyPaste; } -std::vector Clipboard::AvailableFormats( +std::vector Clipboard::AvailableFormats( gin_helper::Arguments* args) { - std::vector format_types; + std::vector format_types; ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); clipboard->ReadAvailableTypes(GetClipboardBuffer(args), /* data_dst = */ nullptr, &format_types); @@ -80,7 +80,7 @@ void Clipboard::WriteBuffer(const std::string& format, void Clipboard::Write(const gin_helper::Dictionary& data, gin_helper::Arguments* args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); - base::string16 text, html, bookmark; + std::u16string text, html, bookmark; gfx::Image image; if (data.Get("text", &text)) { @@ -102,8 +102,8 @@ void Clipboard::Write(const gin_helper::Dictionary& data, writer.WriteImage(image.AsBitmap()); } -base::string16 Clipboard::ReadText(gin_helper::Arguments* args) { - base::string16 data; +std::u16string Clipboard::ReadText(gin_helper::Arguments* args) { + std::u16string data; ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); auto type = GetClipboardBuffer(args); if (clipboard->IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), @@ -123,13 +123,13 @@ base::string16 Clipboard::ReadText(gin_helper::Arguments* args) { return data; } -void Clipboard::WriteText(const base::string16& text, +void Clipboard::WriteText(const std::u16string& text, gin_helper::Arguments* args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); writer.WriteText(text); } -base::string16 Clipboard::ReadRTF(gin_helper::Arguments* args) { +std::u16string Clipboard::ReadRTF(gin_helper::Arguments* args) { std::string data; ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); clipboard->ReadRTF(GetClipboardBuffer(args), /* data_dst = */ nullptr, &data); @@ -141,9 +141,9 @@ void Clipboard::WriteRTF(const std::string& text, gin_helper::Arguments* args) { writer.WriteRTF(text); } -base::string16 Clipboard::ReadHTML(gin_helper::Arguments* args) { - base::string16 data; - base::string16 html; +std::u16string Clipboard::ReadHTML(gin_helper::Arguments* args) { + std::u16string data; + std::u16string html; std::string url; uint32_t start; uint32_t end; @@ -154,14 +154,14 @@ base::string16 Clipboard::ReadHTML(gin_helper::Arguments* args) { return data; } -void Clipboard::WriteHTML(const base::string16& html, +void Clipboard::WriteHTML(const std::u16string& html, gin_helper::Arguments* args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); writer.WriteHTML(html, std::string()); } v8::Local Clipboard::ReadBookmark(gin_helper::Arguments* args) { - base::string16 title; + std::u16string title; std::string url; gin_helper::Dictionary dict = gin_helper::Dictionary::CreateEmpty(args->isolate()); @@ -172,7 +172,7 @@ v8::Local Clipboard::ReadBookmark(gin_helper::Arguments* args) { return dict.GetHandle(); } -void Clipboard::WriteBookmark(const base::string16& title, +void Clipboard::WriteBookmark(const std::u16string& title, const std::string& url, gin_helper::Arguments* args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); @@ -207,9 +207,9 @@ void Clipboard::WriteImage(const gfx::Image& image, } #if !defined(OS_MAC) -void Clipboard::WriteFindText(const base::string16& text) {} -base::string16 Clipboard::ReadFindText() { - return base::string16(); +void Clipboard::WriteFindText(const std::u16string& text) {} +std::u16string Clipboard::ReadFindText() { + return std::u16string(); } #endif diff --git a/shell/common/api/electron_api_clipboard.h b/shell/common/api/electron_api_clipboard.h index 815d588281d0..7c5bdac805a4 100644 --- a/shell/common/api/electron_api_clipboard.h +++ b/shell/common/api/electron_api_clipboard.h @@ -24,7 +24,7 @@ namespace api { class Clipboard { public: static ui::ClipboardBuffer GetClipboardBuffer(gin_helper::Arguments* args); - static std::vector AvailableFormats( + static std::vector AvailableFormats( gin_helper::Arguments* args); static bool Has(const std::string& format_string, gin_helper::Arguments* args); @@ -34,27 +34,27 @@ class Clipboard { static void Write(const gin_helper::Dictionary& data, gin_helper::Arguments* args); - static base::string16 ReadText(gin_helper::Arguments* args); - static void WriteText(const base::string16& text, + static std::u16string ReadText(gin_helper::Arguments* args); + static void WriteText(const std::u16string& text, gin_helper::Arguments* args); - static base::string16 ReadRTF(gin_helper::Arguments* args); + static std::u16string ReadRTF(gin_helper::Arguments* args); static void WriteRTF(const std::string& text, gin_helper::Arguments* args); - static base::string16 ReadHTML(gin_helper::Arguments* args); - static void WriteHTML(const base::string16& html, + static std::u16string ReadHTML(gin_helper::Arguments* args); + static void WriteHTML(const std::u16string& html, gin_helper::Arguments* args); static v8::Local ReadBookmark(gin_helper::Arguments* args); - static void WriteBookmark(const base::string16& title, + static void WriteBookmark(const std::u16string& title, const std::string& url, gin_helper::Arguments* args); static gfx::Image ReadImage(gin_helper::Arguments* args); static void WriteImage(const gfx::Image& image, gin_helper::Arguments* args); - static base::string16 ReadFindText(); - static void WriteFindText(const base::string16& text); + static std::u16string ReadFindText(); + static void WriteFindText(const std::u16string& text); static v8::Local ReadBuffer(const std::string& format_string, gin_helper::Arguments* args); diff --git a/shell/common/api/electron_api_clipboard_mac.mm b/shell/common/api/electron_api_clipboard_mac.mm index aa47bab85dd3..7f101c259bd2 100644 --- a/shell/common/api/electron_api_clipboard_mac.mm +++ b/shell/common/api/electron_api_clipboard_mac.mm @@ -10,12 +10,12 @@ namespace electron { namespace api { -void Clipboard::WriteFindText(const base::string16& text) { +void Clipboard::WriteFindText(const std::u16string& text) { NSString* text_ns = base::SysUTF16ToNSString(text); [[FindPasteboard sharedInstance] setFindText:text_ns]; } -base::string16 Clipboard::ReadFindText() { +std::u16string Clipboard::ReadFindText() { return GetFindPboardText(); } diff --git a/shell/common/api/electron_api_shell.cc b/shell/common/api/electron_api_shell.cc index 9f341ac61dcc..1679afe5ecc4 100644 --- a/shell/common/api/electron_api_shell.cc +++ b/shell/common/api/electron_api_shell.cc @@ -117,7 +117,7 @@ bool WriteShortcutLink(const base::FilePath& shortcut_path, base::win::ShortcutProperties properties; base::FilePath path; - base::string16 str; + std::u16string str; UUID toastActivatorClsid; int index; if (options.Get("target", &path)) diff --git a/shell/common/application_info.h b/shell/common/application_info.h index cee9156702d9..63062c09f84e 100644 --- a/shell/common/application_info.h +++ b/shell/common/application_info.h @@ -28,7 +28,7 @@ std::string GetApplicationUserAgent(); #if defined(OS_WIN) PCWSTR GetRawAppUserModelID(); bool GetAppUserModelID(ScopedHString* app_id); -void SetAppUserModelID(const base::string16& name); +void SetAppUserModelID(const std::u16string& name); bool IsRunningInDesktopBridge(); #endif diff --git a/shell/common/application_info_win.cc b/shell/common/application_info_win.cc index e34f88d4b06c..f900a193a221 100644 --- a/shell/common/application_info_win.cc +++ b/shell/common/application_info_win.cc @@ -23,7 +23,7 @@ namespace electron { namespace { -base::string16 g_app_user_model_id; +std::u16string g_app_user_model_id; } const wchar_t kAppUserModelIDFormat[] = L"electron.app.$1"; @@ -42,7 +42,7 @@ std::string GetApplicationVersion() { return base::UTF16ToUTF8(info->product_version()); } -void SetAppUserModelID(const base::string16& name) { +void SetAppUserModelID(const std::u16string& name) { g_app_user_model_id = name; SetCurrentProcessExplicitAppUserModelID(g_app_user_model_id.c_str()); } @@ -54,7 +54,7 @@ PCWSTR GetRawAppUserModelID() { g_app_user_model_id = current_app_id; } else { std::string name = GetApplicationName(); - base::string16 generated_app_id = base::ReplaceStringPlaceholders( + std::u16string generated_app_id = base::ReplaceStringPlaceholders( kAppUserModelIDFormat, base::UTF8ToUTF16(name), nullptr); SetAppUserModelID(generated_app_id); } diff --git a/shell/common/gin_converters/blink_converter.cc b/shell/common/gin_converters/blink_converter.cc index 490e08def209..f653f7f8eba6 100644 --- a/shell/common/gin_converters/blink_converter.cc +++ b/shell/common/gin_converters/blink_converter.cc @@ -47,7 +47,7 @@ struct Converter { static bool FromV8(v8::Isolate* isolate, v8::Handle val, char16_t* out) { - base::string16 code = base::UTF8ToUTF16(gin::V8ToString(isolate, val)); + std::u16string code = base::UTF8ToUTF16(gin::V8ToString(isolate, val)); if (code.length() != 1) return false; *out = code[0]; @@ -206,7 +206,7 @@ bool Converter::FromV8(v8::Isolate* isolate, // Make sure to not read beyond the buffer in case some bad code doesn't // NULL-terminate it (this is called from plugins). size_t text_length_cap = blink::WebKeyboardEvent::kTextLengthCap; - base::string16 text16 = base::UTF8ToUTF16(str); + std::u16string text16 = base::UTF8ToUTF16(str); std::fill_n(out->text, text_length_cap, 0); std::fill_n(out->unmodified_text, text_length_cap, 0); @@ -365,7 +365,7 @@ v8::Local EditFlagsToV8(v8::Isolate* isolate, int editFlags) { bool pasteFlag = false; if (editFlags & blink::ContextMenuDataEditFlags::kCanPaste) { - std::vector types; + std::vector types; ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes( ui::ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr, &types); pasteFlag = !types.empty(); diff --git a/shell/common/language_util.h b/shell/common/language_util.h index 3e35073c142c..fcb61fe4a48e 100644 --- a/shell/common/language_util.h +++ b/shell/common/language_util.h @@ -18,7 +18,7 @@ std::vector GetPreferredLanguages(); #if defined(OS_WIN) bool GetPreferredLanguagesUsingGlobalization( - std::vector* languages); + std::vector* languages); #endif } // namespace electron diff --git a/shell/common/language_util_win.cc b/shell/common/language_util_win.cc index d6717b31aec2..708802c1ab02 100644 --- a/shell/common/language_util_win.cc +++ b/shell/common/language_util_win.cc @@ -17,7 +17,7 @@ namespace electron { std::vector GetPreferredLanguages() { - std::vector languages16; + std::vector languages16; // Attempt to use API available on Windows 10 or later, which // returns the full list of language preferences. @@ -33,7 +33,7 @@ std::vector GetPreferredLanguages() { } bool GetPreferredLanguagesUsingGlobalization( - std::vector* languages) { + std::vector* languages) { if (base::win::GetVersion() < base::win::Version::WIN10) return false; if (!base::win::ResolveCoreWinRTDelayload() || diff --git a/shell/common/platform_util_win.cc b/shell/common/platform_util_win.cc index dae1e8772058..90505ae27b05 100644 --- a/shell/common/platform_util_win.cc +++ b/shell/common/platform_util_win.cc @@ -241,8 +241,8 @@ std::string OpenExternalOnWorkerThread( // Quote the input scheme to be sure that the command does not have // parameters unexpected by the external program. This url should already // have been escaped. - base::string16 escaped_url = L"\"" + base::UTF8ToUTF16(url.spec()) + L"\""; - base::string16 working_dir = options.working_dir.value(); + std::u16string escaped_url = L"\"" + base::UTF8ToUTF16(url.spec()) + L"\""; + std::u16string working_dir = options.working_dir.value(); if (reinterpret_cast( ShellExecuteW(nullptr, L"open", escaped_url.c_str(), nullptr, diff --git a/shell/renderer/api/electron_api_spell_check_client.cc b/shell/renderer/api/electron_api_spell_check_client.cc index 24221be890d9..51379aecbd92 100644 --- a/shell/renderer/api/electron_api_spell_check_client.cc +++ b/shell/renderer/api/electron_api_spell_check_client.cc @@ -28,7 +28,7 @@ namespace api { namespace { -bool HasWordCharacters(const base::string16& text, int index) { +bool HasWordCharacters(const std::u16string& text, int index) { const char16_t* data = text.data(); int length = text.length(); while (index < length) { @@ -43,8 +43,8 @@ bool HasWordCharacters(const base::string16& text, int index) { struct Word { blink::WebTextCheckingResult result; - base::string16 text; - std::vector contraction_words; + std::u16string text; + std::vector contraction_words; }; } // namespace @@ -52,19 +52,19 @@ struct Word { class SpellCheckClient::SpellcheckRequest { public: SpellcheckRequest( - const base::string16& text, + const std::u16string& text, std::unique_ptr completion) : text_(text), completion_(std::move(completion)) {} SpellcheckRequest(const SpellcheckRequest&) = delete; SpellcheckRequest& operator=(const SpellcheckRequest&) = delete; ~SpellcheckRequest() = default; - const base::string16& text() const { return text_; } + const std::u16string& text() const { return text_; } blink::WebTextCheckingCompletion* completion() { return completion_.get(); } std::vector& wordlist() { return word_list_; } private: - base::string16 text_; // Text to be checked in this task. + std::u16string text_; // Text to be checked in this task. std::vector word_list_; // List of Words found in text // The interface to send the misspelled ranges to WebKit. std::unique_ptr completion_; @@ -93,7 +93,7 @@ SpellCheckClient::~SpellCheckClient() { void SpellCheckClient::RequestCheckingOfText( const blink::WebString& textToCheck, std::unique_ptr completionCallback) { - base::string16 text(textToCheck.Utf16()); + std::u16string text(textToCheck.Utf16()); // Ignore invalid requests. if (text.empty() || !HasWordCharacters(text, 0)) { completionCallback->DidCancelCheckingText(); @@ -151,10 +151,10 @@ void SpellCheckClient::SpellCheckText() { text_iterator_.SetText(text.c_str(), text.size()); SpellCheckScope scope(*this); - base::string16 word; + std::u16string word; size_t word_start; size_t word_length; - std::set words; + std::set words; auto& word_list = pending_request_param_->wordlist(); Word word_entry; for (;;) { // Run until end of text @@ -186,9 +186,9 @@ void SpellCheckClient::SpellCheckText() { } void SpellCheckClient::OnSpellCheckDone( - const std::vector& misspelled_words) { + const std::vector& misspelled_words) { std::vector results; - std::unordered_set misspelled(misspelled_words.begin(), + std::unordered_set misspelled(misspelled_words.begin(), misspelled_words.end()); auto& word_list = pending_request_param_->wordlist(); @@ -216,7 +216,7 @@ void SpellCheckClient::OnSpellCheckDone( } void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope, - const std::set& words) { + const std::set& words) { DCHECK(!scope.spell_check_.IsEmpty()); v8::Local templ = gin_helper::CreateFunctionTemplate( @@ -238,13 +238,13 @@ void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope, // words in the contraction. bool SpellCheckClient::IsContraction( const SpellCheckScope& scope, - const base::string16& contraction, - std::vector* contraction_words) { + const std::u16string& contraction, + std::vector* contraction_words) { DCHECK(contraction_iterator_.IsInitialized()); contraction_iterator_.SetText(contraction.c_str(), contraction.length()); - base::string16 word; + std::u16string word; size_t word_start; size_t word_length; for (auto status = diff --git a/shell/renderer/api/electron_api_spell_check_client.h b/shell/renderer/api/electron_api_spell_check_client.h index 1e32be9c0039..72b5572fbcb8 100644 --- a/shell/renderer/api/electron_api_spell_check_client.h +++ b/shell/renderer/api/electron_api_spell_check_client.h @@ -69,18 +69,18 @@ class SpellCheckClient : public blink::WebSpellCheckPanelHostClient, // The javascript function will callback OnSpellCheckDone // with the results of all the misspelled words. void SpellCheckWords(const SpellCheckScope& scope, - const std::set& words); + const std::set& words); // Returns whether or not the given word is a contraction of valid words // (e.g. "word:word"). // Output variable contraction_words will contain individual // words in the contraction. bool IsContraction(const SpellCheckScope& scope, - const base::string16& word, - std::vector* contraction_words); + const std::u16string& word, + std::vector* contraction_words); // Callback for the JS API which returns the list of misspelled words. - void OnSpellCheckDone(const std::vector& misspelled_words); + void OnSpellCheckDone(const std::vector& misspelled_words); // Represents character attributes used for filtering out characters which // are not supported by this SpellCheck object. diff --git a/shell/renderer/api/electron_api_web_frame.cc b/shell/renderer/api/electron_api_web_frame.cc index af814a9916dc..a5ba2e000f6f 100644 --- a/shell/renderer/api/electron_api_web_frame.cc +++ b/shell/renderer/api/electron_api_web_frame.cc @@ -114,7 +114,7 @@ content::RenderFrame* GetRenderFrame(v8::Local value) { bool SpellCheckWord(v8::Isolate* isolate, v8::Local window, const std::string& word, - std::vector* optional_suggestions) { + std::vector* optional_suggestions) { size_t start; size_t length; @@ -123,7 +123,7 @@ bool SpellCheckWord(v8::Isolate* isolate, if (!render_frame) return true; - base::string16 w = base::UTF8ToUTF16(word); + std::u16string w = base::UTF8ToUTF16(word); int id = render_frame->GetRoutingID(); return client->GetSpellCheck()->SpellCheckWord( w.c_str(), 0, word.size(), id, &start, &length, optional_suggestions); @@ -576,7 +576,7 @@ void InsertText(gin_helper::ErrorThrower thrower, } } -base::string16 InsertCSS(v8::Local window, +std::u16string InsertCSS(v8::Local window, const std::string& css, gin_helper::Arguments* args) { blink::WebDocument::CSSOrigin css_origin = @@ -591,7 +591,7 @@ base::string16 InsertCSS(v8::Local window, args->ThrowError( "Render frame was torn down before webFrame.insertCSS could be " "executed"); - return base::string16(); + return std::u16string(); } blink::WebFrame* web_frame = render_frame->GetWebFrame(); @@ -601,12 +601,12 @@ base::string16 InsertCSS(v8::Local window, .InsertStyleSheet(blink::WebString::FromUTF8(css), nullptr, css_origin) .Utf16(); } - return base::string16(); + return std::u16string(); } void RemoveInsertedCSS(gin_helper::ErrorThrower thrower, v8::Local window, - const base::string16& key) { + const std::u16string& key) { auto* render_frame = GetRenderFrame(window); if (!render_frame) { thrower.ThrowError( @@ -624,7 +624,7 @@ void RemoveInsertedCSS(gin_helper::ErrorThrower thrower, v8::Local ExecuteJavaScript(gin_helper::Arguments* args, v8::Local window, - const base::string16& code) { + const std::u16string& code) { v8::Isolate* isolate = args->isolate(); gin_helper::Promise> promise(isolate); v8::Local handle = promise.GetHandle(); @@ -685,8 +685,8 @@ v8::Local ExecuteJavaScriptInIsolatedWorld( std::vector sources; for (const auto& script : scripts) { - base::string16 code; - base::string16 url; + std::u16string code; + std::u16string url; int start_line = 1; script.Get("url", &url); script.Get("startLine", &start_line); @@ -766,10 +766,10 @@ bool IsWordMisspelled(v8::Isolate* isolate, return !SpellCheckWord(isolate, window, word, nullptr); } -std::vector GetWordSuggestions(v8::Isolate* isolate, +std::vector GetWordSuggestions(v8::Isolate* isolate, v8::Local window, const std::string& word) { - std::vector suggestions; + std::vector suggestions; SpellCheckWord(isolate, window, word, &suggestions); return suggestions; } diff --git a/shell/renderer/electron_autofill_agent.cc b/shell/renderer/electron_autofill_agent.cc index 8d060571aa53..9d8282079a41 100644 --- a/shell/renderer/electron_autofill_agent.cc +++ b/shell/renderer/electron_autofill_agent.cc @@ -25,18 +25,18 @@ const size_t kMaxDataLength = 1024; const size_t kMaxListSize = 512; void GetDataListSuggestions(const blink::WebInputElement& element, - std::vector* values, - std::vector* labels) { + std::vector* values, + std::vector* labels) { for (const auto& option : element.FilteredDataListOptions()) { values->push_back(option.Value().Utf16()); if (option.Value() != option.Label()) labels->push_back(option.Label().Utf16()); else - labels->push_back(base::string16()); + labels->push_back(std::u16string()); } } -void TrimStringVectorForIPC(std::vector* strings) { +void TrimStringVectorForIPC(std::vector* strings) { // Limit the size of the vector. if (strings->size() > kMaxListSize) strings->resize(kMaxListSize); @@ -152,8 +152,8 @@ void AutofillAgent::ShowSuggestions(const blink::WebFormControlElement& element, return; } - std::vector data_list_values; - std::vector data_list_labels; + std::vector data_list_values; + std::vector data_list_labels; if (input_element) { GetDataListSuggestions(*input_element, &data_list_values, &data_list_labels); @@ -182,13 +182,13 @@ void AutofillAgent::HidePopup() { } void AutofillAgent::ShowPopup(const blink::WebFormControlElement& element, - const std::vector& values, - const std::vector& labels) { + const std::vector& values, + const std::vector& labels) { gfx::RectF bounds = render_frame()->ElementBoundsInWindow(element); GetAutofillDriver()->ShowAutofillPopup(bounds, values, labels); } -void AutofillAgent::AcceptDataListSuggestion(const base::string16& suggestion) { +void AutofillAgent::AcceptDataListSuggestion(const std::u16string& suggestion) { auto element = render_frame()->GetWebFrame()->GetDocument().FocusedElement(); if (element.IsFormControlElement()) { ToWebInputElement(&element)->SetAutofillValue( diff --git a/shell/renderer/electron_autofill_agent.h b/shell/renderer/electron_autofill_agent.h index 91a0c8e0ff83..d9fa0640da35 100644 --- a/shell/renderer/electron_autofill_agent.h +++ b/shell/renderer/electron_autofill_agent.h @@ -58,13 +58,13 @@ class AutofillAgent : public content::RenderFrameObserver, void DataListOptionsChanged(const blink::WebInputElement&) override; // mojom::ElectronAutofillAgent - void AcceptDataListSuggestion(const base::string16& suggestion) override; + void AcceptDataListSuggestion(const std::u16string& suggestion) override; bool IsUserGesture() const; void HidePopup(); void ShowPopup(const blink::WebFormControlElement&, - const std::vector&, - const std::vector&); + const std::vector&, + const std::vector&); void ShowSuggestions(const blink::WebFormControlElement& element, const ShowSuggestionsOptions& options); diff --git a/shell/renderer/renderer_client_base.cc b/shell/renderer/renderer_client_base.cc index e1fde902b1d6..126401675ea4 100644 --- a/shell/renderer/renderer_client_base.cc +++ b/shell/renderer/renderer_client_base.cc @@ -218,7 +218,7 @@ void RendererClientBase::RenderThreadStarted() { #if defined(OS_WIN) // Set ApplicationUserModelID in renderer process. - base::string16 app_id = + std::u16string app_id = command_line->GetSwitchValueNative(switches::kAppUserModelId); if (!app_id.empty()) { SetCurrentProcessExplicitAppUserModelID(app_id.c_str());