2757472: Reland "Reland "[LSC] Remove base::string16 alias""

2757472
This commit is contained in:
John Kleinschmidt 2021-03-16 12:18:45 -04:00
parent 86d23cee40
commit 22d8f22cfb
100 changed files with 417 additions and 417 deletions

View file

@ -90,7 +90,7 @@ CertificateManagerModel::~CertificateManagerModel() = default;
int CertificateManagerModel::ImportFromPKCS12( int CertificateManagerModel::ImportFromPKCS12(
PK11SlotInfo* slot_info, PK11SlotInfo* slot_info,
const std::string& data, const std::string& data,
const base::string16& password, const std::u16string& password,
bool is_extractable, bool is_extractable,
net::ScopedCERTCertificateList* imported_certs) { net::ScopedCERTCertificateList* imported_certs) {
return cert_db_->ImportFromPKCS12(slot_info, data, password, is_extractable, return cert_db_->ImportFromPKCS12(slot_info, data, password, is_extractable,

View file

@ -46,7 +46,7 @@ class CertificateManagerModel {
// Returns a net error code on failure. // Returns a net error code on failure.
int ImportFromPKCS12(PK11SlotInfo* slot_info, int ImportFromPKCS12(PK11SlotInfo* slot_info,
const std::string& data, const std::string& data,
const base::string16& password, const std::u16string& password,
bool is_extractable, bool is_extractable,
net::ScopedCERTCertificateList* imported_certs); net::ScopedCERTCertificateList* imported_certs);

View file

@ -161,7 +161,7 @@ ElectronContentClient::ElectronContentClient() = default;
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); return l10n_util::GetStringUTF16(message_id);
} }

View file

@ -21,7 +21,7 @@ class ElectronContentClient : public content::ContentClient {
protected: protected:
// content::ContentClient: // 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; base::StringPiece GetDataResource(int resource_id, ui::ScaleFactor) override;
gfx::Image& GetNativeImageNamed(int resource_id) override; gfx::Image& GetNativeImageNamed(int resource_id) override;
base::RefCountedMemory* GetDataResourceBytes(int resource_id) override; base::RefCountedMemory* GetDataResourceBytes(int resource_id) override;

View file

@ -549,7 +549,7 @@ void OnClientCertificateSelected(
#if defined(USE_NSS_CERTS) #if defined(USE_NSS_CERTS)
int ImportIntoCertStore(CertificateManagerModel* model, base::Value options) { int ImportIntoCertStore(CertificateManagerModel* model, base::Value options) {
std::string file_data, cert_path; std::string file_data, cert_path;
base::string16 password; std::u16string password;
net::ScopedCERTCertificateList imported_certs; net::ScopedCERTCertificateList imported_certs;
int rv = -1; int rv = -1;

View file

@ -1089,11 +1089,11 @@ bool BaseWindow::SetThumbnailToolTip(const std::string& tooltip) {
} }
void BaseWindow::SetAppDetails(const gin_helper::Dictionary& options) { void BaseWindow::SetAppDetails(const gin_helper::Dictionary& options) {
base::string16 app_id; std::u16string app_id;
base::FilePath app_icon_path; base::FilePath app_icon_path;
int app_icon_index = 0; int app_icon_index = 0;
base::string16 relaunch_command; std::u16string relaunch_command;
base::string16 relaunch_display_name; std::u16string relaunch_display_name;
options.Get("appId", &app_id); options.Get("appId", &app_id);
options.Get("appIconPath", &app_icon_path); options.Get("appIconPath", &app_icon_path);

View file

@ -210,7 +210,7 @@ void BrowserWindow::OnActivateContents() {
#endif #endif
} }
void BrowserWindow::OnPageTitleUpdated(const base::string16& title, void BrowserWindow::OnPageTitleUpdated(const std::u16string& title,
bool explicit_set) { bool explicit_set) {
// Change window title to page title. // Change window title to page title.
auto self = GetWeakPtr(); auto self = GetWeakPtr();

View file

@ -62,7 +62,7 @@ class BrowserWindow : public BaseWindow,
const std::vector<mojom::DraggableRegionPtr>& regions) override; const std::vector<mojom::DraggableRegionPtr>& regions) override;
void OnSetContentBounds(const gfx::Rect& rect) override; void OnSetContentBounds(const gfx::Rect& rect) override;
void OnActivateContents() override; void OnActivateContents() override;
void OnPageTitleUpdated(const base::string16& title, void OnPageTitleUpdated(const std::u16string& title,
bool explicit_set) override; bool explicit_set) override;
#if defined(OS_MAC) #if defined(OS_MAC)
void OnDevToolsResized() override; void OnDevToolsResized() override;

View file

@ -163,7 +163,7 @@ base::OnceClosure Menu::BindSelfToClosure(base::OnceClosure callback) {
void Menu::InsertItemAt(int index, void Menu::InsertItemAt(int index,
int command_id, int command_id,
const base::string16& label) { const std::u16string& label) {
model_->InsertItemAt(index, command_id, label); model_->InsertItemAt(index, command_id, label);
} }
@ -173,20 +173,20 @@ void Menu::InsertSeparatorAt(int index) {
void Menu::InsertCheckItemAt(int index, void Menu::InsertCheckItemAt(int index,
int command_id, int command_id,
const base::string16& label) { const std::u16string& label) {
model_->InsertCheckItemAt(index, command_id, label); model_->InsertCheckItemAt(index, command_id, label);
} }
void Menu::InsertRadioItemAt(int index, void Menu::InsertRadioItemAt(int index,
int command_id, int command_id,
const base::string16& label, const std::u16string& label,
int group_id) { int group_id) {
model_->InsertRadioItemAt(index, command_id, label, group_id); model_->InsertRadioItemAt(index, command_id, label, group_id);
} }
void Menu::InsertSubMenuAt(int index, void Menu::InsertSubMenuAt(int index,
int command_id, int command_id,
const base::string16& label, const std::u16string& label,
Menu* menu) { Menu* menu) {
menu->parent_ = this; menu->parent_ = this;
model_->InsertSubMenuAt(index, command_id, label, menu->model_.get()); 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)); 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); 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); 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); model_->SetRole(index, role);
} }
@ -224,19 +224,19 @@ int Menu::GetCommandIdAt(int index) const {
return model_->GetCommandIdAt(index); return model_->GetCommandIdAt(index);
} }
base::string16 Menu::GetLabelAt(int index) const { std::u16string Menu::GetLabelAt(int index) const {
return model_->GetLabelAt(index); return model_->GetLabelAt(index);
} }
base::string16 Menu::GetSublabelAt(int index) const { std::u16string Menu::GetSublabelAt(int index) const {
return model_->GetSecondaryLabelAt(index); return model_->GetSecondaryLabelAt(index);
} }
base::string16 Menu::GetToolTipAt(int index) const { std::u16string Menu::GetToolTipAt(int index) const {
return model_->GetToolTipAt(index); return model_->GetToolTipAt(index);
} }
base::string16 Menu::GetAcceleratorTextAt(int index) const { std::u16string Menu::GetAcceleratorTextAt(int index) const {
ui::Accelerator accelerator; ui::Accelerator accelerator;
model_->GetAcceleratorAtWithParams(index, true, &accelerator); model_->GetAcceleratorAtWithParams(index, true, &accelerator);
return accelerator.GetShortcutText(); return accelerator.GetShortcutText();

View file

@ -87,31 +87,31 @@ class Menu : public gin::Wrappable<Menu>,
void OnMenuWillShow() override; void OnMenuWillShow() override;
private: 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 InsertSeparatorAt(int index);
void InsertCheckItemAt(int index, void InsertCheckItemAt(int index,
int command_id, int command_id,
const base::string16& label); const std::u16string& label);
void InsertRadioItemAt(int index, void InsertRadioItemAt(int index,
int command_id, int command_id,
const base::string16& label, const std::u16string& label,
int group_id); int group_id);
void InsertSubMenuAt(int index, void InsertSubMenuAt(int index,
int command_id, int command_id,
const base::string16& label, const std::u16string& label,
Menu* menu); Menu* menu);
void SetIcon(int index, const gfx::Image& image); void SetIcon(int index, const gfx::Image& image);
void SetSublabel(int index, const base::string16& sublabel); void SetSublabel(int index, const std::u16string& sublabel);
void SetToolTip(int index, const base::string16& toolTip); void SetToolTip(int index, const std::u16string& toolTip);
void SetRole(int index, const base::string16& role); void SetRole(int index, const std::u16string& role);
void Clear(); void Clear();
int GetIndexOfCommandId(int command_id); int GetIndexOfCommandId(int command_id);
int GetItemCount() const; int GetItemCount() const;
int GetCommandIdAt(int index) const; int GetCommandIdAt(int index) const;
base::string16 GetLabelAt(int index) const; std::u16string GetLabelAt(int index) const;
base::string16 GetSublabelAt(int index) const; std::u16string GetSublabelAt(int index) const;
base::string16 GetToolTipAt(int index) const; std::u16string GetToolTipAt(int index) const;
base::string16 GetAcceleratorTextAt(int index) const; std::u16string GetAcceleratorTextAt(int index) const;
bool IsItemCheckedAt(int index) const; bool IsItemCheckedAt(int index) const;
bool IsEnabledAt(int index) const; bool IsEnabledAt(int index) const;
bool IsVisibleAt(int index) const; bool IsVisibleAt(int index) const;

View file

@ -92,15 +92,15 @@ gin::Handle<Notification> Notification::New(gin_helper::ErrorThrower thrower,
} }
// Getters // Getters
base::string16 Notification::GetTitle() const { std::u16string Notification::GetTitle() const {
return title_; return title_;
} }
base::string16 Notification::GetSubtitle() const { std::u16string Notification::GetSubtitle() const {
return subtitle_; return subtitle_;
} }
base::string16 Notification::GetBody() const { std::u16string Notification::GetBody() const {
return body_; return body_;
} }
@ -112,19 +112,19 @@ bool Notification::GetHasReply() const {
return has_reply_; return has_reply_;
} }
base::string16 Notification::GetTimeoutType() const { std::u16string Notification::GetTimeoutType() const {
return timeout_type_; return timeout_type_;
} }
base::string16 Notification::GetReplyPlaceholder() const { std::u16string Notification::GetReplyPlaceholder() const {
return reply_placeholder_; return reply_placeholder_;
} }
base::string16 Notification::GetSound() const { std::u16string Notification::GetSound() const {
return sound_; return sound_;
} }
base::string16 Notification::GetUrgency() const { std::u16string Notification::GetUrgency() const {
return urgency_; return urgency_;
} }
@ -132,24 +132,24 @@ std::vector<electron::NotificationAction> Notification::GetActions() const {
return actions_; return actions_;
} }
base::string16 Notification::GetCloseButtonText() const { std::u16string Notification::GetCloseButtonText() const {
return close_button_text_; return close_button_text_;
} }
base::string16 Notification::GetToastXml() const { std::u16string Notification::GetToastXml() const {
return toast_xml_; return toast_xml_;
} }
// Setters // Setters
void Notification::SetTitle(const base::string16& new_title) { void Notification::SetTitle(const std::u16string& new_title) {
title_ = new_title; title_ = new_title;
} }
void Notification::SetSubtitle(const base::string16& new_subtitle) { void Notification::SetSubtitle(const std::u16string& new_subtitle) {
subtitle_ = new_subtitle; subtitle_ = new_subtitle;
} }
void Notification::SetBody(const base::string16& new_body) { void Notification::SetBody(const std::u16string& new_body) {
body_ = new_body; body_ = new_body;
} }
@ -161,19 +161,19 @@ void Notification::SetHasReply(bool new_has_reply) {
has_reply_ = 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; 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; reply_placeholder_ = new_placeholder;
} }
void Notification::SetSound(const base::string16& new_sound) { void Notification::SetSound(const std::u16string& new_sound) {
sound_ = new_sound; sound_ = new_sound;
} }
void Notification::SetUrgency(const base::string16& new_urgency) { void Notification::SetUrgency(const std::u16string& new_urgency) {
urgency_ = new_urgency; urgency_ = new_urgency;
} }
@ -182,11 +182,11 @@ void Notification::SetActions(
actions_ = actions; actions_ = actions;
} }
void Notification::SetCloseButtonText(const base::string16& text) { void Notification::SetCloseButtonText(const std::u16string& text) {
close_button_text_ = 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; toast_xml_ = new_toast_xml;
} }

View file

@ -65,49 +65,49 @@ class Notification : public gin::Wrappable<Notification>,
void Close(); void Close();
// Prop Getters // Prop Getters
base::string16 GetTitle() const; std::u16string GetTitle() const;
base::string16 GetSubtitle() const; std::u16string GetSubtitle() const;
base::string16 GetBody() const; std::u16string GetBody() const;
bool GetSilent() const; bool GetSilent() const;
bool GetHasReply() const; bool GetHasReply() const;
base::string16 GetTimeoutType() const; std::u16string GetTimeoutType() const;
base::string16 GetReplyPlaceholder() const; std::u16string GetReplyPlaceholder() const;
base::string16 GetUrgency() const; std::u16string GetUrgency() const;
base::string16 GetSound() const; std::u16string GetSound() const;
std::vector<electron::NotificationAction> GetActions() const; std::vector<electron::NotificationAction> GetActions() const;
base::string16 GetCloseButtonText() const; std::u16string GetCloseButtonText() const;
base::string16 GetToastXml() const; std::u16string GetToastXml() const;
// Prop Setters // Prop Setters
void SetTitle(const base::string16& new_title); void SetTitle(const std::u16string& new_title);
void SetSubtitle(const base::string16& new_subtitle); void SetSubtitle(const std::u16string& new_subtitle);
void SetBody(const base::string16& new_body); void SetBody(const std::u16string& new_body);
void SetSilent(bool new_silent); void SetSilent(bool new_silent);
void SetHasReply(bool new_has_reply); void SetHasReply(bool new_has_reply);
void SetUrgency(const base::string16& new_urgency); void SetUrgency(const std::u16string& new_urgency);
void SetTimeoutType(const base::string16& new_timeout_type); void SetTimeoutType(const std::u16string& new_timeout_type);
void SetReplyPlaceholder(const base::string16& new_reply_placeholder); void SetReplyPlaceholder(const std::u16string& new_reply_placeholder);
void SetSound(const base::string16& sound); void SetSound(const std::u16string& sound);
void SetActions(const std::vector<electron::NotificationAction>& actions); void SetActions(const std::vector<electron::NotificationAction>& actions);
void SetCloseButtonText(const base::string16& text); void SetCloseButtonText(const std::u16string& text);
void SetToastXml(const base::string16& new_toast_xml); void SetToastXml(const std::u16string& new_toast_xml);
private: private:
base::string16 title_; std::u16string title_;
base::string16 subtitle_; std::u16string subtitle_;
base::string16 body_; std::u16string body_;
gfx::Image icon_; gfx::Image icon_;
base::string16 icon_path_; std::u16string icon_path_;
bool has_icon_ = false; bool has_icon_ = false;
bool silent_ = false; bool silent_ = false;
bool has_reply_ = false; bool has_reply_ = false;
base::string16 timeout_type_; std::u16string timeout_type_;
base::string16 reply_placeholder_; std::u16string reply_placeholder_;
base::string16 sound_; std::u16string sound_;
base::string16 urgency_; std::u16string urgency_;
std::vector<electron::NotificationAction> actions_; std::vector<electron::NotificationAction> actions_;
base::string16 close_button_text_; std::u16string close_button_text_;
base::string16 toast_xml_; std::u16string toast_xml_;
electron::NotificationPresenter* presenter_; electron::NotificationPresenter* presenter_;

View file

@ -343,7 +343,7 @@ void SimpleURLLoaderWrapper::OnAuthRequired(
auto cb = base::BindOnce( auto cb = base::BindOnce(
[](mojo::Remote<network::mojom::AuthChallengeResponder> auth_responder, [](mojo::Remote<network::mojom::AuthChallengeResponder> auth_responder,
gin::Arguments* args) { gin::Arguments* args) {
base::string16 username_str, password_str; std::u16string username_str, password_str;
if (!args->GetNext(&username_str) || !args->GetNext(&password_str)) { if (!args->GetNext(&username_str) || !args->GetNext(&password_str)) {
auth_responder->OnAuthCredentials(base::nullopt); auth_responder->OnAuthCredentials(base::nullopt);
return; return;

View file

@ -408,7 +408,7 @@ base::Optional<base::TimeDelta> GetCursorBlinkInterval() {
// This will return false if no printer with the provided device_name can be // 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 // 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. // 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) #if defined(OS_MAC)
base::ScopedCFTypeRef<CFStringRef> new_printer_id( base::ScopedCFTypeRef<CFStringRef> new_printer_id(
base::SysUTF16ToCFStringRef(device_name)); base::SysUTF16ToCFStringRef(device_name));
@ -423,7 +423,7 @@ bool IsDeviceNameValid(const base::string16& device_name) {
return true; return true;
} }
base::string16 GetDefaultPrinterAsync() { std::u16string GetDefaultPrinterAsync() {
#if defined(OS_WIN) #if defined(OS_WIN)
// Blocking is needed here because Windows printer drivers are oftentimes // Blocking is needed here because Windows printer drivers are oftentimes
// not thread-safe and have to be accessed on the UI thread. // not thread-safe and have to be accessed on the UI thread.
@ -958,9 +958,9 @@ void WebContents::Destroy() {
bool WebContents::DidAddMessageToConsole( bool WebContents::DidAddMessageToConsole(
content::WebContents* source, content::WebContents* source,
blink::mojom::ConsoleMessageLevel level, blink::mojom::ConsoleMessageLevel level,
const base::string16& message, const std::u16string& message,
int32_t line_no, int32_t line_no,
const base::string16& source_id) { const std::u16string& source_id) {
return Emit("console-message", static_cast<int32_t>(level), message, line_no, return Emit("console-message", static_cast<int32_t>(level), message, line_no,
source_id); source_id);
} }
@ -1717,7 +1717,7 @@ void WebContents::DidFinishNavigation(
} }
void WebContents::TitleWasSet(content::NavigationEntry* entry) { void WebContents::TitleWasSet(content::NavigationEntry* entry) {
base::string16 final_title; std::u16string final_title;
bool explicit_set = true; bool explicit_set = true;
if (entry) { if (entry) {
auto title = entry->GetTitle(); auto title = entry->GetTitle();
@ -1983,7 +1983,7 @@ GURL WebContents::GetURL() const {
return web_contents()->GetURL(); return web_contents()->GetURL();
} }
base::string16 WebContents::GetTitle() const { std::u16string WebContents::GetTitle() const {
return web_contents()->GetTitle(); return web_contents()->GetTitle();
} }
@ -2292,9 +2292,9 @@ bool WebContents::IsCurrentlyAudible() {
void WebContents::OnGetDefaultPrinter( void WebContents::OnGetDefaultPrinter(
base::Value print_settings, base::Value print_settings,
printing::CompletionCallback print_callback, printing::CompletionCallback print_callback,
base::string16 device_name, std::u16string device_name,
bool silent, bool silent,
base::string16 default_printer) { std::u16string default_printer) {
// The content::WebContents might be already deleted at this point, and the // The content::WebContents might be already deleted at this point, and the
// PrintViewManagerBasic class does not do null check. // PrintViewManagerBasic class does not do null check.
if (!web_contents()) { if (!web_contents()) {
@ -2303,7 +2303,7 @@ void WebContents::OnGetDefaultPrinter(
return; return;
} }
base::string16 printer_name = std::u16string printer_name =
device_name.empty() ? default_printer : device_name; device_name.empty() ? default_printer : device_name;
// If there are no valid printers available on the network, we bail. // 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 // We set the default to the system's default printer and only update
// if at the Chromium level if the user overrides. // if at the Chromium level if the user overrides.
// Printer device name as opened by the OS. // Printer device name as opened by the OS.
base::string16 device_name; std::u16string device_name;
options.Get("deviceName", &device_name); options.Get("deviceName", &device_name);
if (!device_name.empty() && !IsDeviceNameValid(device_name)) { if (!device_name.empty() && !IsDeviceNameValid(device_name)) {
gin_helper::ErrorThrower(args->isolate()) gin_helper::ErrorThrower(args->isolate())
@ -2570,16 +2570,16 @@ void WebContents::Unselect() {
web_contents()->CollapseSelection(); web_contents()->CollapseSelection();
} }
void WebContents::Replace(const base::string16& word) { void WebContents::Replace(const std::u16string& word) {
web_contents()->Replace(word); web_contents()->Replace(word);
} }
void WebContents::ReplaceMisspelling(const base::string16& word) { void WebContents::ReplaceMisspelling(const std::u16string& word) {
web_contents()->ReplaceMisspelling(word); web_contents()->ReplaceMisspelling(word);
} }
uint32_t WebContents::FindInPage(gin::Arguments* args) { uint32_t WebContents::FindInPage(gin::Arguments* args) {
base::string16 search_text; std::u16string search_text;
if (!args->GetNext(&search_text) || search_text.empty()) { if (!args->GetNext(&search_text) || search_text.empty()) {
gin_helper::ErrorThrower(args->isolate()) gin_helper::ErrorThrower(args->isolate())
.ThrowError("Must provide a non-empty search content"); .ThrowError("Must provide a non-empty search content");

View file

@ -156,7 +156,7 @@ class WebContents : public gin::Wrappable<WebContents>,
void LoadURL(const GURL& url, const gin_helper::Dictionary& options); void LoadURL(const GURL& url, const gin_helper::Dictionary& options);
void DownloadURL(const GURL& url); void DownloadURL(const GURL& url);
GURL GetURL() const; GURL GetURL() const;
base::string16 GetTitle() const; std::u16string GetTitle() const;
bool IsLoading() const; bool IsLoading() const;
bool IsLoadingMainFrame() const; bool IsLoadingMainFrame() const;
bool IsWaitingForResponse() const; bool IsWaitingForResponse() const;
@ -201,9 +201,9 @@ class WebContents : public gin::Wrappable<WebContents>,
#if BUILDFLAG(ENABLE_PRINTING) #if BUILDFLAG(ENABLE_PRINTING)
void OnGetDefaultPrinter(base::Value print_settings, void OnGetDefaultPrinter(base::Value print_settings,
printing::CompletionCallback print_callback, printing::CompletionCallback print_callback,
base::string16 device_name, std::u16string device_name,
bool silent, bool silent,
base::string16 default_printer); std::u16string default_printer);
void Print(gin::Arguments* args); void Print(gin::Arguments* args);
// Print current page as PDF. // Print current page as PDF.
v8::Local<v8::Promise> PrintToPDF(base::DictionaryValue settings); v8::Local<v8::Promise> PrintToPDF(base::DictionaryValue settings);
@ -225,8 +225,8 @@ class WebContents : public gin::Wrappable<WebContents>,
void Delete(); void Delete();
void SelectAll(); void SelectAll();
void Unselect(); void Unselect();
void Replace(const base::string16& word); void Replace(const std::u16string& word);
void ReplaceMisspelling(const base::string16& word); void ReplaceMisspelling(const std::u16string& word);
uint32_t FindInPage(gin::Arguments* args); uint32_t FindInPage(gin::Arguments* args);
void StopFindInPage(content::StopFindAction action); void StopFindInPage(content::StopFindAction action);
void ShowDefinitionForSelection(); void ShowDefinitionForSelection();
@ -444,9 +444,9 @@ class WebContents : public gin::Wrappable<WebContents>,
// content::WebContentsDelegate: // content::WebContentsDelegate:
bool DidAddMessageToConsole(content::WebContents* source, bool DidAddMessageToConsole(content::WebContents* source,
blink::mojom::ConsoleMessageLevel level, blink::mojom::ConsoleMessageLevel level,
const base::string16& message, const std::u16string& message,
int32_t line_no, int32_t line_no,
const base::string16& source_id) override; const std::u16string& source_id) override;
bool IsWebContentsCreationOverridden( bool IsWebContentsCreationOverridden(
content::SiteInstance* source_site_instance, content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type, content::mojom::WindowContainerType window_container_type,

View file

@ -78,7 +78,7 @@ bool WebFrameMain::CheckRenderFrame() const {
v8::Local<v8::Promise> WebFrameMain::ExecuteJavaScript( v8::Local<v8::Promise> WebFrameMain::ExecuteJavaScript(
gin::Arguments* args, gin::Arguments* args,
const base::string16& code) { const std::u16string& code) {
gin_helper::Promise<base::Value> promise(args->isolate()); gin_helper::Promise<base::Value> promise(args->isolate());
v8::Local<v8::Promise> handle = promise.GetHandle(); v8::Local<v8::Promise> handle = promise.GetHandle();

View file

@ -78,7 +78,7 @@ class WebFrameMain : public gin::Wrappable<WebFrameMain>,
void Connect(); void Connect();
v8::Local<v8::Promise> ExecuteJavaScript(gin::Arguments* args, v8::Local<v8::Promise> ExecuteJavaScript(gin::Arguments* args,
const base::string16& code); const std::u16string& code);
bool Reload(); bool Reload();
void Send(v8::Isolate* isolate, void Send(v8::Isolate* isolate,
bool internal, bool internal,

View file

@ -85,7 +85,7 @@ class Browser : public WindowListObserver {
void ClearRecentDocuments(); void ClearRecentDocuments();
// Set the application user model ID. // 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 // Remove the default protocol handler registry key
bool RemoveAsDefaultProtocolClient(const std::string& protocol, bool RemoveAsDefaultProtocolClient(const std::string& protocol,
@ -99,7 +99,7 @@ class Browser : public WindowListObserver {
bool IsDefaultProtocolClient(const std::string& protocol, bool IsDefaultProtocolClient(const std::string& protocol,
gin::Arguments* args); gin::Arguments* args);
base::string16 GetApplicationNameForProtocol(const GURL& url); std::u16string GetApplicationNameForProtocol(const GURL& url);
#if !defined(OS_LINUX) #if !defined(OS_LINUX)
// get the name, icon and path for an application // get the name, icon and path for an application
@ -113,10 +113,10 @@ class Browser : public WindowListObserver {
#if defined(OS_WIN) #if defined(OS_WIN)
struct LaunchItem { struct LaunchItem {
base::string16 name; std::u16string name;
base::string16 path; std::u16string path;
base::string16 scope; std::u16string scope;
std::vector<base::string16> args; std::vector<std::u16string> args;
bool enabled = true; bool enabled = true;
LaunchItem(); LaunchItem();
@ -132,13 +132,13 @@ class Browser : public WindowListObserver {
bool restore_state = false; bool restore_state = false;
bool opened_at_login = false; bool opened_at_login = false;
bool opened_as_hidden = false; bool opened_as_hidden = false;
base::string16 path; std::u16string path;
std::vector<base::string16> args; std::vector<std::u16string> args;
#if defined(OS_WIN) #if defined(OS_WIN)
// used in browser::setLoginItemSettings // used in browser::setLoginItemSettings
bool enabled = true; bool enabled = true;
base::string16 name = base::string16(); std::u16string name = std::u16string();
// used in browser::getLoginItemSettings // used in browser::getLoginItemSettings
bool executable_will_launch_at_login = false; bool executable_will_launch_at_login = false;
@ -238,9 +238,9 @@ class Browser : public WindowListObserver {
#if defined(OS_WIN) #if defined(OS_WIN)
struct UserTask { struct UserTask {
base::FilePath program; base::FilePath program;
base::string16 arguments; std::u16string arguments;
base::string16 title; std::u16string title;
base::string16 description; std::u16string description;
base::FilePath working_dir; base::FilePath working_dir;
base::FilePath icon_path; base::FilePath icon_path;
int icon_index; int icon_index;

View file

@ -88,7 +88,7 @@ void Browser::AddRecentDocument(const base::FilePath& path) {}
void Browser::ClearRecentDocuments() {} void Browser::ClearRecentDocuments() {}
void Browser::SetAppUserModelID(const base::string16& name) {} void Browser::SetAppUserModelID(const std::u16string& name) {}
bool Browser::SetAsDefaultProtocolClient(const std::string& protocol, bool Browser::SetAsDefaultProtocolClient(const std::string& protocol,
gin::Arguments* args) { gin::Arguments* args) {
@ -122,7 +122,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol,
return false; return false;
} }
base::string16 Browser::GetApplicationNameForProtocol(const GURL& url) { std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) {
const std::vector<std::string> argv = { const std::vector<std::string> argv = {
"xdg-mime", "query", "default", "xdg-mime", "query", "default",
std::string("x-scheme-handler/") + url.scheme()}; std::string("x-scheme-handler/") + url.scheme()};

View file

@ -58,7 +58,7 @@ gfx::Image GetApplicationIconForProtocol(NSString* _Nonnull app_path) {
return icon; return icon;
} }
base::string16 GetAppDisplayNameForProtocol(NSString* app_path) { std::u16string GetAppDisplayNameForProtocol(NSString* app_path) {
NSString* app_display_name = NSString* app_display_name =
[[NSFileManager defaultManager] displayNameAtPath:app_path]; [[NSFileManager defaultManager] displayNameAtPath:app_path];
return base::SysNSStringToUTF16(app_display_name); return base::SysNSStringToUTF16(app_display_name);
@ -81,8 +81,8 @@ v8::Local<v8::Promise> Browser::GetApplicationInfoForProtocol(
return handle; return handle;
} }
base::string16 app_path = base::SysNSStringToUTF16(ns_app_path); std::u16string app_path = base::SysNSStringToUTF16(ns_app_path);
base::string16 app_display_name = GetAppDisplayNameForProtocol(ns_app_path); std::u16string app_display_name = GetAppDisplayNameForProtocol(ns_app_path);
gfx::Image app_icon = GetApplicationIconForProtocol(ns_app_path); gfx::Image app_icon = GetApplicationIconForProtocol(ns_app_path);
dict.Set("name", app_display_name); dict.Set("name", app_display_name);
@ -209,16 +209,16 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol,
return result == NSOrderedSame; return result == NSOrderedSame;
} }
base::string16 Browser::GetApplicationNameForProtocol(const GURL& url) { std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) {
NSString* app_path = GetAppPathForProtocol(url); NSString* app_path = GetAppPathForProtocol(url);
if (!app_path) { 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; return app_display_name;
} }
void Browser::SetAppUserModelID(const base::string16& name) {} void Browser::SetAppUserModelID(const std::u16string& name) {}
bool Browser::SetBadgeCount(base::Optional<int> count) { bool Browser::SetBadgeCount(base::Optional<int> count) {
DockSetBadgeText(!count.has_value() || count.value() != 0 DockSetBadgeText(!count.has_value() || count.value() != 0

View file

@ -48,7 +48,7 @@ namespace electron {
namespace { namespace {
bool GetProcessExecPath(base::string16* exe) { bool GetProcessExecPath(std::u16string* exe) {
base::FilePath path; base::FilePath path;
if (!base::PathService::Get(base::FILE_EXE, &path)) { if (!base::PathService::Get(base::FILE_EXE, &path)) {
return false; return false;
@ -57,13 +57,13 @@ bool GetProcessExecPath(base::string16* exe) {
return true; return true;
} }
bool GetProtocolLaunchPath(gin::Arguments* args, base::string16* exe) { bool GetProtocolLaunchPath(gin::Arguments* args, std::u16string* exe) {
if (!args->GetNext(exe) && !GetProcessExecPath(exe)) { if (!args->GetNext(exe) && !GetProcessExecPath(exe)) {
return false; return false;
} }
// Read in optional args arg // Read in optional args arg
std::vector<base::string16> launch_args; std::vector<std::u16string> launch_args;
if (args->GetNext(&launch_args) && !launch_args.empty()) if (args->GetNext(&launch_args) && !launch_args.empty())
*exe = base::StringPrintf(L"\"%ls\" %ls \"%%1\"", exe->c_str(), *exe = base::StringPrintf(L"\"%ls\" %ls \"%%1\"", exe->c_str(),
base::JoinString(launch_args, L" ").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 // 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 // entry has a "URL Protocol" key. Check this, otherwise we allow ProgIDs to be
// used as custom protocols which leads to security bugs. // used as custom protocols which leads to security bugs.
bool IsValidCustomProtocol(const base::string16& scheme) { bool IsValidCustomProtocol(const std::u16string& scheme) {
if (scheme.empty()) if (scheme.empty())
return false; return false;
base::win::RegKey cmd_key(HKEY_CLASSES_ROOT, scheme.c_str(), KEY_QUERY_VALUE); 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 // Windows 8 introduced a new protocol->executable binding system which cannot
// be retrieved in the HKCR registry subkey method implemented below. We call // be retrieved in the HKCR registry subkey method implemented below. We call
// AssocQueryString with the new Win8-only flag ASSOCF_IS_PROTOCOL instead. // 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 GURL& url) {
const base::string16 url_scheme = base::ASCIIToUTF16(url.scheme()); const std::u16string url_scheme = base::ASCIIToUTF16(url.scheme());
if (!IsValidCustomProtocol(url_scheme)) if (!IsValidCustomProtocol(url_scheme))
return base::string16(); return std::u16string();
wchar_t out_buffer[1024]; wchar_t out_buffer[1024];
DWORD buffer_size = base::size(out_buffer); DWORD buffer_size = base::size(out_buffer);
@ -103,13 +103,13 @@ base::string16 GetAppInfoHelperForProtocol(ASSOCSTR assoc_str,
out_buffer, &buffer_size); out_buffer, &buffer_size);
if (FAILED(hr)) { if (FAILED(hr)) {
DLOG(WARNING) << "AssocQueryString failed!"; 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, void OnIconDataAvailable(const base::FilePath& app_path,
const base::string16& app_display_name, const std::u16string& app_display_name,
gin_helper::Promise<gin_helper::Dictionary> promise, gin_helper::Promise<gin_helper::Dictionary> promise,
gfx::Image icon) { gfx::Image icon) {
if (!icon.IsEmpty()) { 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); return GetAppInfoHelperForProtocol(ASSOCSTR_FRIENDLYAPPNAME, url);
} }
base::string16 GetAppPathForProtocol(const GURL& url) { std::u16string GetAppPathForProtocol(const GURL& url) {
return GetAppInfoHelperForProtocol(ASSOCSTR_EXECUTABLE, url); return GetAppInfoHelperForProtocol(ASSOCSTR_EXECUTABLE, url);
} }
base::string16 GetAppForProtocolUsingRegistry(const GURL& url) { std::u16string GetAppForProtocolUsingRegistry(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)) if (!IsValidCustomProtocol(url_scheme))
return base::string16(); return std::u16string();
// First, try and extract the application's display name. // 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(), base::win::RegKey cmd_key_name(HKEY_CLASSES_ROOT, url_scheme.c_str(),
KEY_READ); KEY_READ);
if (cmd_key_name.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS && 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 // Otherwise, parse the command line in the registry, and return the basename
// of the program path if it exists. // 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(), base::win::RegKey cmd_key_exe(HKEY_CLASSES_ROOT, cmd_key_path.c_str(),
KEY_READ); KEY_READ);
if (cmd_key_exe.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS) { 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 command_line.GetProgram().BaseName().value();
} }
return base::string16(); return std::u16string();
} }
bool FormatCommandLineString(base::string16* exe, bool FormatCommandLineString(std::u16string* exe,
const std::vector<base::string16>& launch_args) { const std::vector<std::u16string>& launch_args) {
if (exe->empty() && !GetProcessExecPath(exe)) { if (exe->empty() && !GetProcessExecPath(exe)) {
return false; return false;
} }
@ -184,13 +184,13 @@ bool FormatCommandLineString(base::string16* exe,
std::vector<Browser::LaunchItem> GetLoginItemSettingsHelper( std::vector<Browser::LaunchItem> GetLoginItemSettingsHelper(
base::win::RegistryValueIterator* it, base::win::RegistryValueIterator* it,
boolean* executable_will_launch_at_login, boolean* executable_will_launch_at_login,
base::string16 scope, std::u16string scope,
const Browser::LoginItemSettings& options) { const Browser::LoginItemSettings& options) {
std::vector<Browser::LaunchItem> launch_items; std::vector<Browser::LaunchItem> launch_items;
base::FilePath lookup_exe_path; base::FilePath lookup_exe_path;
if (options.path.empty()) { if (options.path.empty()) {
base::string16 process_exe_path; std::u16string process_exe_path;
GetProcessExecPath(&process_exe_path); GetProcessExecPath(&process_exe_path);
lookup_exe_path = lookup_exe_path =
base::CommandLine::FromString(process_exe_path).GetProgram(); base::CommandLine::FromString(process_exe_path).GetProgram();
@ -287,7 +287,7 @@ Browser::UserTask::~UserTask() = default;
void GetFileIcon(const base::FilePath& path, void GetFileIcon(const base::FilePath& path,
v8::Isolate* isolate, v8::Isolate* isolate,
base::CancelableTaskTracker* cancelable_task_tracker_, base::CancelableTaskTracker* cancelable_task_tracker_,
const base::string16 app_display_name, const std::u16string app_display_name,
gin_helper::Promise<gin_helper::Dictionary> promise) { gin_helper::Promise<gin_helper::Dictionary> promise) {
base::FilePath normalized_path = path.NormalizePathSeparators(); base::FilePath normalized_path = path.NormalizePathSeparators();
IconLoader::IconSize icon_size = IconLoader::IconSize::LARGE; IconLoader::IconSize icon_size = IconLoader::IconSize::LARGE;
@ -316,13 +316,13 @@ void GetApplicationInfoForProtocolUsingRegistry(
base::CancelableTaskTracker* cancelable_task_tracker_) { base::CancelableTaskTracker* cancelable_task_tracker_) {
base::FilePath app_path; 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)) { if (!IsValidCustomProtocol(url_scheme)) {
promise.RejectWithErrorMessage("invalid url_scheme"); promise.RejectWithErrorMessage("invalid url_scheme");
return; return;
} }
base::string16 command_to_launch; std::u16string command_to_launch;
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(), base::win::RegKey cmd_key_exe(HKEY_CLASSES_ROOT, cmd_key_path.c_str(),
KEY_READ); KEY_READ);
if (cmd_key_exe.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS) { if (cmd_key_exe.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS) {
@ -334,7 +334,7 @@ void GetApplicationInfoForProtocolUsingRegistry(
"Unable to retrieve installation path to app"); "Unable to retrieve installation path to app");
return; return;
} }
const base::string16 app_display_name = GetAppForProtocolUsingRegistry(url); const std::u16string app_display_name = GetAppForProtocolUsingRegistry(url);
if (app_display_name.empty()) { if (app_display_name.empty()) {
promise.RejectWithErrorMessage( promise.RejectWithErrorMessage(
@ -354,7 +354,7 @@ void GetApplicationInfoForProtocolUsingAssocQuery(
const GURL& url, const GURL& url,
gin_helper::Promise<gin_helper::Dictionary> promise, gin_helper::Promise<gin_helper::Dictionary> promise,
base::CancelableTaskTracker* cancelable_task_tracker_) { base::CancelableTaskTracker* cancelable_task_tracker_) {
base::string16 app_path = GetAppPathForProtocol(url); std::u16string app_path = GetAppPathForProtocol(url);
if (app_path.empty()) { if (app_path.empty()) {
promise.RejectWithErrorMessage( promise.RejectWithErrorMessage(
@ -362,7 +362,7 @@ void GetApplicationInfoForProtocolUsingAssocQuery(
return; return;
} }
base::string16 app_display_name = GetAppDisplayNameForProtocol(url); std::u16string app_display_name = GetAppDisplayNameForProtocol(url);
if (app_display_name.empty()) { if (app_display_name.empty()) {
promise.RejectWithErrorMessage("Unable to retrieve display name of app"); promise.RejectWithErrorMessage("Unable to retrieve display name of app");
@ -390,7 +390,7 @@ void Browser::ClearRecentDocuments() {
SHAddToRecentDocs(SHARD_APPIDINFO, nullptr); SHAddToRecentDocs(SHARD_APPIDINFO, nullptr);
} }
void Browser::SetAppUserModelID(const base::string16& name) { void Browser::SetAppUserModelID(const std::u16string& name) {
electron::SetAppUserModelID(name); electron::SetAppUserModelID(name);
} }
@ -426,12 +426,12 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol,
// Main Registry Key // Main Registry Key
HKEY root = HKEY_CURRENT_USER; HKEY root = HKEY_CURRENT_USER;
base::string16 keyPath = L"Software\\Classes\\"; std::u16string keyPath = L"Software\\Classes\\";
// Command Key // Command Key
base::string16 wprotocol = base::UTF8ToUTF16(protocol); std::u16string wprotocol = base::UTF8ToUTF16(protocol);
base::string16 shellPath = wprotocol + L"\\shell"; std::u16string shellPath = wprotocol + L"\\shell";
base::string16 cmdPath = keyPath + shellPath + L"\\open\\command"; std::u16string cmdPath = keyPath + shellPath + L"\\open\\command";
base::win::RegKey classesKey; base::win::RegKey classesKey;
base::win::RegKey commandKey; 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 // Key doesn't even exist, we can confirm that it is not set
return true; return true;
base::string16 keyVal; std::u16string keyVal;
if (FAILED(commandKey.ReadValue(L"", &keyVal))) if (FAILED(commandKey.ReadValue(L"", &keyVal)))
// Default value not set, we can confirm that it is not set // Default value not set, we can confirm that it is not set
return true; return true;
base::string16 exe; std::u16string exe;
if (!GetProtocolLaunchPath(args, &exe)) if (!GetProtocolLaunchPath(args, &exe))
return false; return false;
@ -461,7 +461,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol,
// Let's clean up after ourselves // Let's clean up after ourselves
base::win::RegKey protocolKey; base::win::RegKey protocolKey;
base::string16 protocolPath = keyPath + wprotocol; std::u16string protocolPath = keyPath + wprotocol;
if (SUCCEEDED( if (SUCCEEDED(
protocolKey.Open(root, protocolPath.c_str(), KEY_ALL_ACCESS))) { protocolKey.Open(root, protocolPath.c_str(), KEY_ALL_ACCESS))) {
@ -500,17 +500,17 @@ bool Browser::SetAsDefaultProtocolClient(const std::string& protocol,
if (protocol.empty()) if (protocol.empty())
return false; return false;
base::string16 exe; std::u16string exe;
if (!GetProtocolLaunchPath(args, &exe)) if (!GetProtocolLaunchPath(args, &exe))
return false; return false;
// Main Registry Key // Main Registry Key
HKEY root = HKEY_CURRENT_USER; HKEY root = HKEY_CURRENT_USER;
base::string16 keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); std::u16string keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol);
base::string16 urlDecl = base::UTF8ToUTF16("URL:" + protocol); std::u16string urlDecl = base::UTF8ToUTF16("URL:" + protocol);
// Command Key // Command Key
base::string16 cmdPath = keyPath + L"\\shell\\open\\command"; std::u16string cmdPath = keyPath + L"\\shell\\open\\command";
// Write information to registry // Write information to registry
base::win::RegKey key(root, keyPath.c_str(), KEY_ALL_ACCESS); 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()) if (protocol.empty())
return false; return false;
base::string16 exe; std::u16string exe;
if (!GetProtocolLaunchPath(args, &exe)) if (!GetProtocolLaunchPath(args, &exe))
return false; return false;
// Main Registry Key // Main Registry Key
HKEY root = HKEY_CURRENT_USER; HKEY root = HKEY_CURRENT_USER;
base::string16 keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); std::u16string keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol);
// Command Key // 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 key;
base::win::RegKey commandKey; 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 // Key doesn't exist, we can confirm that it is not set
return false; return false;
base::string16 keyVal; std::u16string keyVal;
if (FAILED(commandKey.ReadValue(L"", &keyVal))) if (FAILED(commandKey.ReadValue(L"", &keyVal)))
// Default value not set, we can confirm that it is not set // Default value not set, we can confirm that it is not set
return false; return false;
@ -560,10 +560,10 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol,
return keyVal == exe; 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. // Windows 8 or above has a new protocol association query.
if (base::win::GetVersion() >= base::win::Version::WIN8) { if (base::win::GetVersion() >= base::win::Version::WIN8) {
base::string16 application_name = GetAppDisplayNameForProtocol(url); std::u16string application_name = GetAppDisplayNameForProtocol(url);
if (!application_name.empty()) if (!application_name.empty())
return application_name; return application_name;
} }
@ -686,11 +686,11 @@ void Browser::UpdateBadgeContents(
} }
void Browser::SetLoginItemSettings(LoginItemSettings settings) { void Browser::SetLoginItemSettings(LoginItemSettings settings) {
base::string16 key_path = std::u16string key_path =
L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
base::win::RegKey key(HKEY_CURRENT_USER, key_path.c_str(), KEY_ALL_ACCESS); 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"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApproved"
L"\\Run"; L"\\Run";
base::win::RegKey startup_approved_key( base::win::RegKey startup_approved_key(
@ -699,7 +699,7 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) {
!settings.name.empty() ? settings.name.c_str() : GetAppUserModelID(); !settings.name.empty() ? settings.name.c_str() : GetAppUserModelID();
if (settings.open_at_login) { if (settings.open_at_login) {
base::string16 exe = settings.path; std::u16string exe = settings.path;
if (FormatCommandLineString(&exe, settings.args)) { if (FormatCommandLineString(&exe, settings.args)) {
key.WriteValue(key_name, exe.c_str()); key.WriteValue(key_name, exe.c_str());
@ -732,13 +732,13 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) {
Browser::LoginItemSettings Browser::GetLoginItemSettings( Browser::LoginItemSettings Browser::GetLoginItemSettings(
const LoginItemSettings& options) { const LoginItemSettings& options) {
LoginItemSettings settings; 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::win::RegKey key(HKEY_CURRENT_USER, keyPath.c_str(), KEY_ALL_ACCESS);
base::string16 keyVal; std::u16string keyVal;
// keep old openAtLogin behaviour // keep old openAtLogin behaviour
if (!FAILED(key.ReadValue(GetAppUserModelID(), &keyVal))) { if (!FAILED(key.ReadValue(GetAppUserModelID(), &keyVal))) {
base::string16 exe = options.path; std::u16string exe = options.path;
if (FormatCommandLineString(&exe, options.args)) { if (FormatCommandLineString(&exe, options.args)) {
settings.open_at_login = keyVal == exe; settings.open_at_login = keyVal == exe;
} }

View file

@ -27,8 +27,8 @@ AutofillDriver::~AutofillDriver() = default;
void AutofillDriver::ShowAutofillPopup( void AutofillDriver::ShowAutofillPopup(
const gfx::RectF& bounds, const gfx::RectF& bounds,
const std::vector<base::string16>& values, const std::vector<std::u16string>& values,
const std::vector<base::string16>& labels) { const std::vector<std::u16string>& labels) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
auto* web_contents = api::WebContents::From( auto* web_contents = api::WebContents::From(

View file

@ -27,8 +27,8 @@ class AutofillDriver : public mojom::ElectronAutofillDriver {
~AutofillDriver() override; ~AutofillDriver() override;
void ShowAutofillPopup(const gfx::RectF& bounds, void ShowAutofillPopup(const gfx::RectF& bounds,
const std::vector<base::string16>& values, const std::vector<std::u16string>& values,
const std::vector<base::string16>& labels) override; const std::vector<std::u16string>& labels) override;
void HideAutofillPopup() override; void HideAutofillPopup() override;
private: private:

View file

@ -920,7 +920,7 @@ ElectronBrowserClient::CreateWindowForPictureInPicture(
content::PictureInPictureWindowController* controller) { content::PictureInPictureWindowController* controller) {
auto overlay_window = content::OverlayWindow::Create(controller); auto overlay_window = content::OverlayWindow::Create(controller);
#if defined(OS_WIN) #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()) { if (!app_user_model_id.empty()) {
auto* overlay_window_view = auto* overlay_window_view =
static_cast<OverlayWindowViews*>(overlay_window.get()); static_cast<OverlayWindowViews*>(overlay_window.get());

View file

@ -142,7 +142,7 @@ int GetMinimumFontSize() {
} }
#endif #endif
base::string16 MediaStringProvider(media::MessageId id) { std::u16string MediaStringProvider(media::MessageId id) {
switch (id) { switch (id) {
case media::DEFAULT_AUDIO_DEVICE_NAME: case media::DEFAULT_AUDIO_DEVICE_NAME:
return base::ASCIIToUTF16("Default"); return base::ASCIIToUTF16("Default");
@ -151,7 +151,7 @@ base::string16 MediaStringProvider(media::MessageId id) {
return base::ASCIIToUTF16("Communications"); return base::ASCIIToUTF16("Communications");
#endif #endif
default: default:
return base::string16(); return std::u16string();
} }
} }

View file

@ -34,8 +34,8 @@ void ElectronJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents, content::WebContents* web_contents,
content::RenderFrameHost* rfh, content::RenderFrameHost* rfh,
JavaScriptDialogType dialog_type, JavaScriptDialogType dialog_type,
const base::string16& message_text, const std::u16string& message_text,
const base::string16& default_prompt_text, const std::u16string& default_prompt_text,
DialogClosedCallback callback, DialogClosedCallback callback,
bool* did_suppress_message) { bool* did_suppress_message) {
auto origin_url = rfh->GetLastCommittedURL(); auto origin_url = rfh->GetLastCommittedURL();
@ -50,19 +50,19 @@ void ElectronJavaScriptDialogManager::RunJavaScriptDialog(
} }
if (origin_counts_[origin] == kUserWantsNoMoreDialogs) { 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 && if (dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_ALERT &&
dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_CONFIRM) { dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_CONFIRM) {
std::move(callback).Run(false, base::string16()); std::move(callback).Run(false, std::u16string());
return; return;
} }
auto* web_preferences = WebContentsPreferences::From(web_contents); auto* web_preferences = WebContentsPreferences::From(web_contents);
if (web_preferences && web_preferences->IsEnabled("disableDialogs")) { 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 // No default button
@ -116,7 +116,7 @@ void ElectronJavaScriptDialogManager::RunBeforeUnloadDialog(
auto* api_web_contents = api::WebContents::From(web_contents); auto* api_web_contents = api::WebContents::From(web_contents);
if (api_web_contents) { if (api_web_contents) {
bool default_prevented = api_web_contents->Emit("will-prevent-unload"); 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) { bool checkbox_checked) {
if (checkbox_checked) if (checkbox_checked)
origin_counts_[origin] = kUserWantsNoMoreDialogs; origin_counts_[origin] = kUserWantsNoMoreDialogs;
std::move(callback).Run(code == 0, base::string16()); std::move(callback).Run(code == 0, std::u16string());
} }
} // namespace electron } // namespace electron

View file

@ -26,8 +26,8 @@ class ElectronJavaScriptDialogManager
void RunJavaScriptDialog(content::WebContents* web_contents, void RunJavaScriptDialog(content::WebContents* web_contents,
content::RenderFrameHost* rfh, content::RenderFrameHost* rfh,
content::JavaScriptDialogType dialog_type, content::JavaScriptDialogType dialog_type,
const base::string16& message_text, const std::u16string& message_text,
const base::string16& default_prompt_text, const std::u16string& default_prompt_text,
DialogClosedCallback callback, DialogClosedCallback callback,
bool* did_suppress_message) override; bool* did_suppress_message) override;
void RunBeforeUnloadDialog(content::WebContents* web_contents, void RunBeforeUnloadDialog(content::WebContents* web_contents,

View file

@ -23,7 +23,7 @@ class ExtendedWebContentsObserver : public base::CheckedObserver {
const std::vector<mojom::DraggableRegionPtr>& regions) {} const std::vector<mojom::DraggableRegionPtr>& regions) {}
virtual void OnSetContentBounds(const gfx::Rect& rect) {} virtual void OnSetContentBounds(const gfx::Rect& rect) {}
virtual void OnActivateContents() {} virtual void OnActivateContents() {}
virtual void OnPageTitleUpdated(const base::string16& title, virtual void OnPageTitleUpdated(const std::u16string& title,
bool explicit_set) {} bool explicit_set) {}
virtual void OnDevToolsResized() {} virtual void OnDevToolsResized() {}

View file

@ -204,7 +204,7 @@ bool ElectronManagementAPIDelegate::UninstallExtension(
content::BrowserContext* context, content::BrowserContext* context,
const std::string& transient_extension_id, const std::string& transient_extension_id,
extensions::UninstallReason reason, extensions::UninstallReason reason,
base::string16* error) const { std::u16string* error) const {
// TODO(sentialx): we don't have ExtensionService // TODO(sentialx): we don't have ExtensionService
// return extensions::ExtensionSystem::Get(context) // return extensions::ExtensionSystem::Get(context)
// ->extension_service() // ->extension_service()

View file

@ -73,7 +73,7 @@ class ElectronManagementAPIDelegate : public extensions::ManagementAPIDelegate {
bool UninstallExtension(content::BrowserContext* context, bool UninstallExtension(content::BrowserContext* context,
const std::string& transient_extension_id, const std::string& transient_extension_id,
extensions::UninstallReason reason, extensions::UninstallReason reason,
base::string16* error) const override; std::u16string* error) const override;
void SetLaunchType(content::BrowserContext* context, void SetLaunchType(content::BrowserContext* context,
const std::string& extension_id, const std::string& extension_id,
extensions::LaunchType launch_type) const override; extensions::LaunchType launch_type) const override;

View file

@ -125,7 +125,7 @@ void FileSelectHelper::OnListDone(int error) {
std::vector<FileChooserFileInfoPtr> file_info; std::vector<FileChooserFileInfoPtr> file_info;
for (const auto& path : lister_paths_) for (const auto& path : lister_paths_)
file_info.push_back(FileChooserFileInfo::NewNativeFile( file_info.push_back(FileChooserFileInfo::NewNativeFile(
NativeFileInfo::New(path, base::string16()))); NativeFileInfo::New(path, std::u16string())));
OnFilesSelected(std::move(file_info), lister_base_dir_); OnFilesSelected(std::move(file_info), lister_base_dir_);
} }

View file

@ -120,7 +120,7 @@ std::string GetDefaultFontForPref(const char* pref_name) {
// Map from script to font. // Map from script to font.
// Key comparison uses pointer equality. // Key comparison uses pointer equality.
using ScriptFontMap = std::unordered_map<const char*, base::string16>; using ScriptFontMap = std::unordered_map<const char*, std::u16string>;
// Map from font family to ScriptFontMap. // Map from font family to ScriptFontMap.
// Key comparison uses pointer equality. // Key comparison uses pointer equality.
@ -130,7 +130,7 @@ using FontFamilyMap = std::unordered_map<const char*, ScriptFontMap>;
// e.g. ("sans-serif", "Zyyy") -> "Arial" // e.g. ("sans-serif", "Zyyy") -> "Arial"
FontFamilyMap g_font_cache; 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); FontFamilyMap::const_iterator it = g_font_cache.find(map_name);
if (it != g_font_cache.end()) { if (it != g_font_cache.end()) {
ScriptFontMap::const_iterator it2 = it->second.find(script); 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 pref_name = base::StringPrintf("%s.%s", map_name, script);
std::string font = GetDefaultFontForPref(pref_name.c_str()); 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]; ScriptFontMap& map = g_font_cache[map_name];
map[script] = font16; map[script] = font16;
@ -151,7 +151,7 @@ void FillFontFamilyMap(const char* map_name,
blink::web_pref::ScriptFontFamilyMap* map) { blink::web_pref::ScriptFontFamilyMap* map) {
for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) {
const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i];
base::string16 result = FetchFont(script, map_name); std::u16string result = FetchFont(script, map_name);
if (!result.empty()) { if (!result.empty()) {
(*map)[script] = result; (*map)[script] = result;
} }

View file

@ -104,7 +104,7 @@ void BluetoothChooser::ShowDiscoveryState(DiscoveryState state) {
void BluetoothChooser::AddOrUpdateDevice(const std::string& device_id, void BluetoothChooser::AddOrUpdateDevice(const std::string& device_id,
bool should_update_name, bool should_update_name,
const base::string16& device_name, const std::u16string& device_name,
bool is_gatt_connected, bool is_gatt_connected,
bool is_paired, bool is_paired,
int signal_strength_level) { int signal_strength_level) {

View file

@ -18,7 +18,7 @@ class BluetoothChooser : public content::BluetoothChooser {
public: public:
struct DeviceInfo { struct DeviceInfo {
std::string device_id; std::string device_id;
base::string16 device_name; std::u16string device_name;
}; };
explicit BluetoothChooser(api::WebContents* contents, explicit BluetoothChooser(api::WebContents* contents,
@ -30,14 +30,14 @@ class BluetoothChooser : public content::BluetoothChooser {
void ShowDiscoveryState(DiscoveryState state) override; void ShowDiscoveryState(DiscoveryState state) override;
void AddOrUpdateDevice(const std::string& device_id, void AddOrUpdateDevice(const std::string& device_id,
bool should_update_name, bool should_update_name,
const base::string16& device_name, const std::u16string& device_name,
bool is_gatt_connected, bool is_gatt_connected,
bool is_paired, bool is_paired,
int signal_strength_level) override; int signal_strength_level) override;
std::vector<DeviceInfo> GetDeviceList(); std::vector<DeviceInfo> GetDeviceList();
private: private:
std::map<std::string, base::string16> device_map_; std::map<std::string, std::u16string> device_map_;
api::WebContents* api_web_contents_; api::WebContents* api_web_contents_;
EventHandler event_handler_; EventHandler event_handler_;
int num_retries_ = 0; int num_retries_ = 0;

View file

@ -83,7 +83,7 @@ LoginHandler::~LoginHandler() = default;
void LoginHandler::CallbackFromJS(gin::Arguments* args) { void LoginHandler::CallbackFromJS(gin::Arguments* args) {
if (auth_required_callback_) { if (auth_required_callback_) {
base::string16 username, password; std::u16string username, password;
if (!args->GetNext(&username) || !args->GetNext(&password)) { if (!args->GetNext(&username) || !args->GetNext(&password)) {
std::move(auth_required_callback_).Run(base::nullopt); std::move(auth_required_callback_).Run(base::nullopt);
return; return;

View file

@ -604,7 +604,7 @@ const views::Widget* NativeWindow::GetWidget() const {
return widget(); return widget();
} }
base::string16 NativeWindow::GetAccessibleWindowTitle() const { std::u16string NativeWindow::GetAccessibleWindowTitle() const {
if (accessible_title_.empty()) { if (accessible_title_.empty()) {
return views::WidgetDelegate::GetAccessibleWindowTitle(); return views::WidgetDelegate::GetAccessibleWindowTitle();
} }

View file

@ -325,7 +325,7 @@ class NativeWindow : public base::SupportsUserData,
// views::WidgetDelegate: // views::WidgetDelegate:
views::Widget* GetWidget() override; views::Widget* GetWidget() override;
const views::Widget* GetWidget() const 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; } void set_content_view(views::View* view) { content_view_ = view; }
@ -383,7 +383,7 @@ class NativeWindow : public base::SupportsUserData,
base::ObserverList<NativeWindowObserver> observers_; base::ObserverList<NativeWindowObserver> observers_;
// Accessible title. // Accessible title.
base::string16 accessible_title_; std::u16string accessible_title_;
base::WeakPtrFactory<NativeWindow> weak_factory_{this}; base::WeakPtrFactory<NativeWindow> weak_factory_{this};

View file

@ -28,7 +28,7 @@ class NativeWindowObserver : public base::CheckedObserver {
~NativeWindowObserver() override {} ~NativeWindowObserver() override {}
// Called when the web page in window wants to create a popup window. // 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 GURL& target_url,
const std::string& partition_id, const std::string& partition_id,
WindowOpenDisposition disposition) {} WindowOpenDisposition disposition) {}

View file

@ -1476,7 +1476,7 @@ bool NativeWindowViews::CanMinimize() const {
#endif #endif
} }
base::string16 NativeWindowViews::GetWindowTitle() const { std::u16string NativeWindowViews::GetWindowTitle() const {
return base::UTF8ToUTF16(title_); return base::UTF8ToUTF16(title_);
} }

View file

@ -184,7 +184,7 @@ class NativeWindowViews : public NativeWindow,
bool CanResize() const override; bool CanResize() const override;
bool CanMaximize() const override; bool CanMaximize() const override;
bool CanMinimize() const override; bool CanMinimize() const override;
base::string16 GetWindowTitle() const override; std::u16string GetWindowTitle() const override;
views::View* GetContentsView() override; views::View* GetContentsView() override;
bool ShouldDescendIntoChildForEventHandling( bool ShouldDescendIntoChildForEventHandling(
gfx::NativeView child, gfx::NativeView child,

View file

@ -19,26 +19,26 @@ class NotificationDelegate;
class NotificationPresenter; class NotificationPresenter;
struct NotificationAction { struct NotificationAction {
base::string16 type; std::u16string type;
base::string16 text; std::u16string text;
}; };
struct NotificationOptions { struct NotificationOptions {
base::string16 title; std::u16string title;
base::string16 subtitle; std::u16string subtitle;
base::string16 msg; std::u16string msg;
std::string tag; std::string tag;
bool silent; bool silent;
GURL icon_url; GURL icon_url;
SkBitmap icon; SkBitmap icon;
bool has_reply; bool has_reply;
base::string16 timeout_type; std::u16string timeout_type;
base::string16 reply_placeholder; std::u16string reply_placeholder;
base::string16 sound; std::u16string sound;
base::string16 urgency; // Linux std::u16string urgency; // Linux
std::vector<NotificationAction> actions; std::vector<NotificationAction> actions;
base::string16 close_button_text; std::u16string close_button_text;
base::string16 toast_xml; std::u16string toast_xml;
NotificationOptions(); NotificationOptions();
~NotificationOptions(); ~NotificationOptions();

View file

@ -72,7 +72,7 @@ bool NotificationPresenterWin::Init() {
return temp_dir_.CreateUniqueTempDir(); return temp_dir_.CreateUniqueTempDir();
} }
base::string16 NotificationPresenterWin::SaveIconToFilesystem( std::u16string NotificationPresenterWin::SaveIconToFilesystem(
const SkBitmap& icon, const SkBitmap& icon,
const GURL& origin) { const GURL& origin) {
std::string filename; std::string filename;

View file

@ -39,7 +39,7 @@ class NotificationPresenterWin : public NotificationPresenter {
bool Init(); bool Init();
base::string16 SaveIconToFilesystem(const SkBitmap& icon, const GURL& origin); std::u16string SaveIconToFilesystem(const SkBitmap& icon, const GURL& origin);
private: private:
Notification* CreateNotificationObject( Notification* CreateNotificationObject(

View file

@ -456,7 +456,7 @@ void OffScreenRenderWidgetHostView::Destroy() {
delete this; delete this;
} }
void OffScreenRenderWidgetHostView::SetTooltipText(const base::string16&) {} void OffScreenRenderWidgetHostView::SetTooltipText(const std::u16string&) {}
uint32_t OffScreenRenderWidgetHostView::GetCaptureSequenceNumber() const { uint32_t OffScreenRenderWidgetHostView::GetCaptureSequenceNumber() const {
return latest_capture_sequence_number_; return latest_capture_sequence_number_;

View file

@ -114,7 +114,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
void ImeCancelComposition(void) override; void ImeCancelComposition(void) override;
void RenderProcessGone() override; void RenderProcessGone() override;
void Destroy(void) override; void Destroy(void) override;
void SetTooltipText(const base::string16&) override; void SetTooltipText(const std::u16string&) override;
content::CursorManager* GetCursorManager() override; content::CursorManager* GetCursorManager() override;
void CopyFromSurface( void CopyFromSurface(
const gfx::Rect& src_rect, const gfx::Rect& src_rect,

View file

@ -139,7 +139,7 @@ OffScreenWebContentsView::CreateViewForChildWidget(
render_widget_host, view, GetSize()); render_widget_host, view, GetSize());
} }
void OffScreenWebContentsView::SetPageTitle(const base::string16& title) {} void OffScreenWebContentsView::SetPageTitle(const std::u16string& title) {}
void OffScreenWebContentsView::RenderViewReady() { void OffScreenWebContentsView::RenderViewReady() {
if (GetView()) if (GetView())

View file

@ -57,7 +57,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
content::RenderWidgetHost* render_widget_host) override; content::RenderWidgetHost* render_widget_host) override;
content::RenderWidgetHostViewBase* CreateViewForChildWidget( content::RenderWidgetHostViewBase* CreateViewForChildWidget(
content::RenderWidgetHost* render_widget_host) override; content::RenderWidgetHost* render_widget_host) override;
void SetPageTitle(const base::string16& title) override; void SetPageTitle(const std::u16string& title) override;
void RenderViewReady() override; void RenderViewReady() override;
void RenderViewHostChanged(content::RenderViewHost* old_host, void RenderViewHostChanged(content::RenderViewHost* old_host,
content::RenderViewHost* new_host) override; content::RenderViewHost* new_host) override;

View file

@ -89,8 +89,8 @@ void AutofillPopup::Hide() {
} }
} }
void AutofillPopup::SetItems(const std::vector<base::string16>& values, void AutofillPopup::SetItems(const std::vector<std::u16string>& values,
const std::vector<base::string16>& labels) { const std::vector<std::u16string>& labels) {
DCHECK(view_); DCHECK(view_);
values_ = values; values_ = values;
labels_ = labels; labels_ = labels;
@ -184,11 +184,11 @@ int AutofillPopup::GetLineCount() {
return values_.size(); return values_.size();
} }
base::string16 AutofillPopup::GetValueAt(int i) { std::u16string AutofillPopup::GetValueAt(int i) {
return values_.at(i); return values_.at(i);
} }
base::string16 AutofillPopup::GetLabelAt(int i) { std::u16string AutofillPopup::GetLabelAt(int i) {
return labels_.at(i); return labels_.at(i);
} }

View file

@ -30,8 +30,8 @@ class AutofillPopup : public views::ViewObserver {
const gfx::RectF& bounds); const gfx::RectF& bounds);
void Hide(); void Hide();
void SetItems(const std::vector<base::string16>& values, void SetItems(const std::vector<std::u16string>& values,
const std::vector<base::string16>& labels); const std::vector<std::u16string>& labels);
void UpdatePopupBounds(); void UpdatePopupBounds();
gfx::Rect popup_bounds_in_view(); gfx::Rect popup_bounds_in_view();
@ -53,8 +53,8 @@ class AutofillPopup : public views::ViewObserver {
ui::NativeTheme::ColorId GetBackgroundColorIDForRow(int index) const; ui::NativeTheme::ColorId GetBackgroundColorIDForRow(int index) const;
int GetLineCount(); int GetLineCount();
base::string16 GetValueAt(int i); std::u16string GetValueAt(int i);
base::string16 GetLabelAt(int i); std::u16string GetLabelAt(int i);
int LineFromY(int y) const; int LineFromY(int y) const;
int selected_index_; int selected_index_;
@ -66,8 +66,8 @@ class AutofillPopup : public views::ViewObserver {
gfx::Rect element_bounds_; gfx::Rect element_bounds_;
// Datalist suggestions // Datalist suggestions
std::vector<base::string16> values_; std::vector<std::u16string> values_;
std::vector<base::string16> labels_; std::vector<std::u16string> labels_;
// Font lists for the suggestions // Font lists for the suggestions
gfx::FontList smaller_font_list_; gfx::FontList smaller_font_list_;

View file

@ -197,7 +197,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
// Locate & retain the recent documents menu item // Locate & retain the recent documents menu item
if (!recentDocumentsMenuItem_) { if (!recentDocumentsMenuItem_) {
base::string16 title = base::ASCIIToUTF16("Open Recent"); std::u16string title = base::ASCIIToUTF16("Open Recent");
NSString* openTitle = l10n_util::FixUpWindowsStyleLabel(title); NSString* openTitle = l10n_util::FixUpWindowsStyleLabel(title);
recentDocumentsMenuItem_.reset([[[[[NSApp mainMenu] recentDocumentsMenuItem_.reset([[[[[NSApp mainMenu]
@ -320,7 +320,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
- (void)addItemToMenu:(NSMenu*)menu - (void)addItemToMenu:(NSMenu*)menu
atIndex:(NSInteger)index atIndex:(NSInteger)index
fromModel:(electron::ElectronMenuModel*)model { fromModel:(electron::ElectronMenuModel*)model {
base::string16 label16 = model->GetLabelAt(index); std::u16string label16 = model->GetLabelAt(index);
NSString* label = l10n_util::FixUpWindowsStyleLabel(label16); NSString* label = l10n_util::FixUpWindowsStyleLabel(label16);
base::scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc] base::scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc]
@ -333,14 +333,14 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
if (icon.IsImage()) if (icon.IsImage())
[item setImage:icon.GetImage().ToNSImage()]; [item setImage:icon.GetImage().ToNSImage()];
base::string16 toolTip = model->GetToolTipAt(index); std::u16string toolTip = model->GetToolTipAt(index);
[item setToolTip:base::SysUTF16ToNSString(toolTip)]; [item setToolTip:base::SysUTF16ToNSString(toolTip)];
base::string16 role = model->GetRoleAt(index); std::u16string role = model->GetRoleAt(index);
electron::ElectronMenuModel::ItemType type = model->GetTypeAt(index); electron::ElectronMenuModel::ItemType type = model->GetTypeAt(index);
if (role == base::ASCIIToUTF16("services")) { if (role == base::ASCIIToUTF16("services")) {
base::string16 title = base::ASCIIToUTF16("Services"); std::u16string title = base::ASCIIToUTF16("Services");
NSString* label = l10n_util::FixUpWindowsStyleLabel(title); NSString* label = l10n_util::FixUpWindowsStyleLabel(title);
[item setTarget:nil]; [item setTarget:nil];

View file

@ -27,38 +27,38 @@ ElectronMenuModel::ElectronMenuModel(Delegate* delegate)
ElectronMenuModel::~ElectronMenuModel() = default; 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); int command_id = GetCommandIdAt(index);
toolTips_[command_id] = toolTip; toolTips_[command_id] = toolTip;
} }
base::string16 ElectronMenuModel::GetToolTipAt(int index) { std::u16string ElectronMenuModel::GetToolTipAt(int index) {
const int command_id = GetCommandIdAt(index); const int command_id = GetCommandIdAt(index);
const auto iter = toolTips_.find(command_id); 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); int command_id = GetCommandIdAt(index);
roles_[command_id] = role; roles_[command_id] = role;
} }
base::string16 ElectronMenuModel::GetRoleAt(int index) { std::u16string ElectronMenuModel::GetRoleAt(int index) {
const int command_id = GetCommandIdAt(index); const int command_id = GetCommandIdAt(index);
const auto iter = roles_.find(command_id); 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, void ElectronMenuModel::SetSecondaryLabel(int index,
const base::string16& sublabel) { const std::u16string& sublabel) {
int command_id = GetCommandIdAt(index); int command_id = GetCommandIdAt(index);
sublabels_[command_id] = sublabel; sublabels_[command_id] = sublabel;
} }
base::string16 ElectronMenuModel::GetSecondaryLabelAt(int index) const { std::u16string ElectronMenuModel::GetSecondaryLabelAt(int index) const {
int command_id = GetCommandIdAt(index); int command_id = GetCommandIdAt(index);
const auto iter = sublabels_.find(command_id); 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( bool ElectronMenuModel::GetAcceleratorAtWithParams(

View file

@ -77,12 +77,12 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
void AddObserver(Observer* obs) { observers_.AddObserver(obs); } void AddObserver(Observer* obs) { observers_.AddObserver(obs); }
void RemoveObserver(Observer* obs) { observers_.RemoveObserver(obs); } void RemoveObserver(Observer* obs) { observers_.RemoveObserver(obs); }
void SetToolTip(int index, const base::string16& toolTip); void SetToolTip(int index, const std::u16string& toolTip);
base::string16 GetToolTipAt(int index); std::u16string GetToolTipAt(int index);
void SetRole(int index, const base::string16& role); void SetRole(int index, const std::u16string& role);
base::string16 GetRoleAt(int index); std::u16string GetRoleAt(int index);
void SetSecondaryLabel(int index, const base::string16& sublabel); void SetSecondaryLabel(int index, const std::u16string& sublabel);
base::string16 GetSecondaryLabelAt(int index) const override; std::u16string GetSecondaryLabelAt(int index) const override;
bool GetAcceleratorAtWithParams(int index, bool GetAcceleratorAtWithParams(int index,
bool use_default_accelerator, bool use_default_accelerator,
ui::Accelerator* accelerator) const; ui::Accelerator* accelerator) const;
@ -114,9 +114,9 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
base::Optional<SharingItem> sharing_item_; base::Optional<SharingItem> sharing_item_;
#endif #endif
std::map<int, base::string16> toolTips_; // command id -> tooltip std::map<int, std::u16string> toolTips_; // command id -> tooltip
std::map<int, base::string16> roles_; // command id -> role std::map<int, std::u16string> roles_; // command id -> role
std::map<int, base::string16> sublabels_; // command id -> sublabel std::map<int, std::u16string> sublabels_; // command id -> sublabel
base::ObserverList<Observer> observers_; base::ObserverList<Observer> observers_;
base::WeakPtrFactory<ElectronMenuModel> weak_factory_{this}; base::WeakPtrFactory<ElectronMenuModel> weak_factory_{this};

View file

@ -157,7 +157,7 @@ namespace gtkui {
AppIndicatorIcon::AppIndicatorIcon(std::string id, AppIndicatorIcon::AppIndicatorIcon(std::string id,
const gfx::ImageSkia& image, const gfx::ImageSkia& image,
const base::string16& tool_tip) const std::u16string& tool_tip)
: id_(id) { : id_(id) {
std::unique_ptr<base::Environment> env(base::Environment::Create()); std::unique_ptr<base::Environment> env(base::Environment::Create());
desktop_env_ = base::nix::GetDesktopEnvironment(env.get()); 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()); DCHECK(!tool_tip_.empty());
tool_tip_ = base::UTF16ToUTF8(tool_tip); tool_tip_ = base::UTF16ToUTF8(tool_tip);
UpdateClickActionReplacementMenuItem(); UpdateClickActionReplacementMenuItem();

View file

@ -41,7 +41,7 @@ class AppIndicatorIcon : public views::StatusIconLinux {
// icons. // icons.
AppIndicatorIcon(std::string id, AppIndicatorIcon(std::string id,
const gfx::ImageSkia& image, const gfx::ImageSkia& image,
const base::string16& tool_tip); const std::u16string& tool_tip);
~AppIndicatorIcon() override; ~AppIndicatorIcon() override;
// Indicates whether libappindicator so could be opened. // Indicates whether libappindicator so could be opened.
@ -49,7 +49,7 @@ class AppIndicatorIcon : public views::StatusIconLinux {
// Overridden from views::StatusIconLinux: // Overridden from views::StatusIconLinux:
void SetIcon(const gfx::ImageSkia& image) override; 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 UpdatePlatformContextMenu(ui::MenuModel* menu) override;
void RefreshPlatformContextMenu() override; void RefreshPlatformContextMenu() override;

View file

@ -20,7 +20,7 @@ namespace electron {
namespace gtkui { namespace gtkui {
GtkStatusIcon::GtkStatusIcon(const gfx::ImageSkia& image, GtkStatusIcon::GtkStatusIcon(const gfx::ImageSkia& image,
const base::string16& tool_tip) { const std::u16string& tool_tip) {
GdkPixbuf* pixbuf = gtk_util::GdkPixbufFromSkBitmap(*image.bitmap()); GdkPixbuf* pixbuf = gtk_util::GdkPixbufFromSkBitmap(*image.bitmap());
{ {
// GTK has a bug that leaks 384 bytes when creating a GtkStatusIcon. It // 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); 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_, gtk_status_icon_set_tooltip_text(gtk_status_icon_,
base::UTF16ToUTF8(tool_tip).c_str()); base::UTF16ToUTF8(tool_tip).c_str());
} }

View file

@ -32,12 +32,12 @@ class AppIndicatorIconMenu;
// GtkStatusIcon). // GtkStatusIcon).
class GtkStatusIcon : public views::StatusIconLinux { class GtkStatusIcon : public views::StatusIconLinux {
public: public:
GtkStatusIcon(const gfx::ImageSkia& image, const base::string16& tool_tip); GtkStatusIcon(const gfx::ImageSkia& image, const std::u16string& tool_tip);
~GtkStatusIcon() override; ~GtkStatusIcon() override;
// Overridden from views::StatusIconLinux: // Overridden from views::StatusIconLinux:
void SetIcon(const gfx::ImageSkia& image) override; 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 UpdatePlatformContextMenu(ui::MenuModel* menu) override;
void RefreshPlatformContextMenu() override; void RefreshPlatformContextMenu() override;

View file

@ -37,7 +37,7 @@ bool IsStatusIconSupported() {
std::unique_ptr<views::StatusIconLinux> CreateLinuxStatusIcon( std::unique_ptr<views::StatusIconLinux> CreateLinuxStatusIcon(
const gfx::ImageSkia& image, const gfx::ImageSkia& image,
const base::string16& tool_tip, const std::u16string& tool_tip,
const char* id_prefix) { const char* id_prefix) {
#if GTK_CHECK_VERSION(3, 90, 0) #if GTK_CHECK_VERSION(3, 90, 0)
NOTIMPLEMENTED(); NOTIMPLEMENTED();

View file

@ -22,7 +22,7 @@ namespace gtkui {
bool IsStatusIconSupported(); bool IsStatusIconSupported();
std::unique_ptr<views::StatusIconLinux> CreateLinuxStatusIcon( std::unique_ptr<views::StatusIconLinux> CreateLinuxStatusIcon(
const gfx::ImageSkia& image, const gfx::ImageSkia& image,
const base::string16& tool_tip, const std::u16string& tool_tip,
const char* id_prefix); const char* id_prefix);
} // namespace gtkui } // namespace gtkui

View file

@ -567,7 +567,7 @@ void InspectableWebContents::LoadCompleted() {
prefs->GetString("currentDockState", &current_dock_state); prefs->GetString("currentDockState", &current_dock_state);
base::RemoveChars(current_dock_state, "\"", &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_ + "\");"); "UI.DockController.instance().setDockSide(\"" + dock_state_ + "\");");
GetDevToolsWebContents()->GetMainFrame()->ExecuteJavaScript( GetDevToolsWebContents()->GetMainFrame()->ExecuteJavaScript(
javascript, base::NullCallback()); javascript, base::NullCallback());
@ -902,7 +902,7 @@ void InspectableWebContents::DispatchProtocolMessage(
if (str_message.size() < kMaxMessageChunkSize) { if (str_message.size() < kMaxMessageChunkSize) {
std::string param; std::string param;
base::EscapeJSONString(str_message, true, &param); base::EscapeJSONString(str_message, true, &param);
base::string16 javascript = std::u16string javascript =
base::UTF8ToUTF16("DevToolsAPI.dispatchMessage(" + param + ");"); base::UTF8ToUTF16("DevToolsAPI.dispatchMessage(" + param + ");");
GetDevToolsWebContents()->GetMainFrame()->ExecuteJavaScript( GetDevToolsWebContents()->GetMainFrame()->ExecuteJavaScript(
javascript, base::NullCallback()); javascript, base::NullCallback());
@ -949,9 +949,9 @@ void InspectableWebContents::WebContentsDestroyed() {
bool InspectableWebContents::DidAddMessageToConsole( bool InspectableWebContents::DidAddMessageToConsole(
content::WebContents* source, content::WebContents* source,
blink::mojom::ConsoleMessageLevel level, blink::mojom::ConsoleMessageLevel level,
const base::string16& message, const std::u16string& message,
int32_t line_no, int32_t line_no,
const base::string16& source_id) { const std::u16string& source_id) {
logging::LogMessage("CONSOLE", line_no, logging::LogMessage("CONSOLE", line_no,
blink::ConsoleMessageLevelToLogSeverity(level)) blink::ConsoleMessageLevelToLogSeverity(level))
.stream() .stream()

View file

@ -177,9 +177,9 @@ class InspectableWebContents
// content::WebContentsDelegate: // content::WebContentsDelegate:
bool DidAddMessageToConsole(content::WebContents* source, bool DidAddMessageToConsole(content::WebContents* source,
blink::mojom::ConsoleMessageLevel level, blink::mojom::ConsoleMessageLevel level,
const base::string16& message, const std::u16string& message,
int32_t line_no, int32_t line_no,
const base::string16& source_id) override; const std::u16string& source_id) override;
bool HandleKeyboardEvent(content::WebContents*, bool HandleKeyboardEvent(content::WebContents*,
const content::NativeWebKeyboardEvent&) override; const content::NativeWebKeyboardEvent&) override;
void CloseContents(content::WebContents* source) override; void CloseContents(content::WebContents* source) override;

View file

@ -51,7 +51,7 @@ class InspectableWebContentsView {
virtual void SetIsDocked(bool docked, bool activate) = 0; virtual void SetIsDocked(bool docked, bool activate) = 0;
virtual void SetContentsResizingStrategy( virtual void SetContentsResizingStrategy(
const DevToolsContentsResizingStrategy& strategy) = 0; const DevToolsContentsResizingStrategy& strategy) = 0;
virtual void SetTitle(const base::string16& title) = 0; virtual void SetTitle(const std::u16string& title) = 0;
private: private:
InspectableWebContentsViewDelegate* delegate_ = nullptr; // weak references. InspectableWebContentsViewDelegate* delegate_ = nullptr; // weak references.

View file

@ -33,7 +33,7 @@ class InspectableWebContentsViewMac : public InspectableWebContentsView {
void SetIsDocked(bool docked, bool activate) override; void SetIsDocked(bool docked, bool activate) override;
void SetContentsResizingStrategy( void SetContentsResizingStrategy(
const DevToolsContentsResizingStrategy& strategy) override; const DevToolsContentsResizingStrategy& strategy) override;
void SetTitle(const base::string16& title) override; void SetTitle(const std::u16string& title) override;
InspectableWebContents* inspectable_web_contents() { InspectableWebContents* inspectable_web_contents() {
return inspectable_web_contents_; return inspectable_web_contents_;

View file

@ -58,7 +58,7 @@ void InspectableWebContentsViewMac::SetContentsResizingStrategy(
[view_ setContentsResizingStrategy:strategy]; [view_ setContentsResizingStrategy:strategy];
} }
void InspectableWebContentsViewMac::SetTitle(const base::string16& title) { void InspectableWebContentsViewMac::SetTitle(const std::u16string& title) {
[view_ setTitle:base::SysUTF16ToNSString(title)]; [view_ setTitle:base::SysUTF16ToNSString(title)];
} }

View file

@ -56,7 +56,7 @@ void ShowMessageBox(const MessageBoxSettings& settings,
// Like ShowMessageBox with simplest settings, but safe to call at very early // Like ShowMessageBox with simplest settings, but safe to call at very early
// stage of application. // 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 } // namespace electron

View file

@ -220,7 +220,7 @@ void ShowMessageBox(const MessageBoxSettings& settings,
(new GtkMessageBox(settings))->RunAsynchronous(std::move(callback)); (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()) { if (Browser::Get()->is_ready()) {
electron::MessageBoxSettings settings; electron::MessageBoxSettings settings;
settings.type = electron::MessageBoxType::kError; settings.type = electron::MessageBoxType::kError;

View file

@ -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]; NSAlert* alert = [[NSAlert alloc] init];
[alert setMessageText:base::SysUTF16ToNSString(title)]; [alert setMessageText:base::SysUTF16ToNSString(title)];
[alert setInformativeText:base::SysUTF16ToNSString(content)]; [alert setInformativeText:base::SysUTF16ToNSString(content)];

View file

@ -39,8 +39,8 @@ struct CommonButtonID {
int button; int button;
int id; int id;
}; };
CommonButtonID GetCommonID(const base::string16& button) { CommonButtonID GetCommonID(const std::u16string& button) {
base::string16 lower = base::ToLowerASCII(button); std::u16string lower = base::ToLowerASCII(button);
if (lower == L"ok") if (lower == L"ok")
return {TDCBF_OK_BUTTON, IDOK}; return {TDCBF_OK_BUTTON, IDOK};
else if (lower == L"yes") 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 // Determine whether the buttons are common buttons, if so map common ID
// to button ID. // to button ID.
void MapToCommonID(const std::vector<base::string16>& buttons, void MapToCommonID(const std::vector<std::u16string>& buttons,
std::map<int, int>* id_map, std::map<int, int>* id_map,
TASKDIALOG_COMMON_BUTTON_FLAGS* button_flags, TASKDIALOG_COMMON_BUTTON_FLAGS* button_flags,
std::vector<TASKDIALOG_BUTTON>* dialog_buttons) { std::vector<TASKDIALOG_BUTTON>* dialog_buttons) {
@ -78,14 +78,14 @@ void MapToCommonID(const std::vector<base::string16>& buttons,
DialogResult ShowTaskDialogUTF16(NativeWindow* parent, DialogResult ShowTaskDialogUTF16(NativeWindow* parent,
MessageBoxType type, MessageBoxType type,
const std::vector<base::string16>& buttons, const std::vector<std::u16string>& buttons,
int default_id, int default_id,
int cancel_id, int cancel_id,
bool no_link, bool no_link,
const base::string16& title, const std::u16string& title,
const base::string16& message, const std::u16string& message,
const base::string16& detail, const std::u16string& detail,
const base::string16& checkbox_label, const std::u16string& checkbox_label,
bool checkbox_checked, bool checkbox_checked,
const gfx::ImageSkia& icon) { const gfx::ImageSkia& icon) {
TASKDIALOG_FLAGS flags = TASKDIALOG_FLAGS flags =
@ -107,7 +107,7 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent,
// TaskDialogIndirect doesn't allow empty name, if we set empty title it // TaskDialogIndirect doesn't allow empty name, if we set empty title it
// will show "electron.exe" in title. // 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()) if (title.empty())
config.pszWindowTitle = app_name.c_str(); config.pszWindowTitle = app_name.c_str();
else else
@ -185,14 +185,14 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent,
} }
DialogResult ShowTaskDialogUTF8(const MessageBoxSettings& settings) { DialogResult ShowTaskDialogUTF8(const MessageBoxSettings& settings) {
std::vector<base::string16> utf16_buttons; std::vector<std::u16string> utf16_buttons;
for (const auto& button : settings.buttons) for (const auto& button : settings.buttons)
utf16_buttons.push_back(base::UTF8ToUTF16(button)); utf16_buttons.push_back(base::UTF8ToUTF16(button));
const base::string16 title_16 = base::UTF8ToUTF16(settings.title); const std::u16string title_16 = base::UTF8ToUTF16(settings.title);
const base::string16 message_16 = base::UTF8ToUTF16(settings.message); const std::u16string message_16 = base::UTF8ToUTF16(settings.message);
const base::string16 detail_16 = base::UTF8ToUTF16(settings.detail); const std::u16string detail_16 = base::UTF8ToUTF16(settings.detail);
const base::string16 checkbox_label_16 = const std::u16string checkbox_label_16 =
base::UTF8ToUTF16(settings.checkbox_label); base::UTF8ToUTF16(settings.checkbox_label);
return ShowTaskDialogUTF16( return ShowTaskDialogUTF16(
@ -219,7 +219,7 @@ void ShowMessageBox(const MessageBoxSettings& settings,
std::move(callback))); 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; electron::UnresponsiveSuppressor suppressor;
ShowTaskDialogUTF16(nullptr, MessageBoxType::kError, {}, -1, 0, false, ShowTaskDialogUTF16(nullptr, MessageBoxType::kError, {}, -1, 0, false,
L"Error", title, content, L"", false, gfx::ImageSkia()); L"Error", title, content, L"", false, gfx::ImageSkia());

View file

@ -64,8 +64,8 @@ class TrayIcon {
#else #else
gfx::Image icon; gfx::Image icon;
#endif #endif
base::string16 title; std::u16string title;
base::string16 content; std::u16string content;
bool large_icon = true; bool large_icon = true;
bool no_sound = false; bool no_sound = false;
bool respect_quiet_time = false; bool respect_quiet_time = false;

View file

@ -47,7 +47,7 @@ const gfx::ImageSkia& TrayIconGtk::GetImage() const {
return image_; return image_;
} }
const base::string16& TrayIconGtk::GetToolTip() const { const std::u16string& TrayIconGtk::GetToolTip() const {
return tool_tip_; return tool_tip_;
} }

View file

@ -33,14 +33,14 @@ class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate {
// The following four methods are only used by StatusIconLinuxDbus, which we // The following four methods are only used by StatusIconLinuxDbus, which we
// aren't yet using, so they are given stub implementations. // aren't yet using, so they are given stub implementations.
const gfx::ImageSkia& GetImage() const override; const gfx::ImageSkia& GetImage() const override;
const base::string16& GetToolTip() const override; const std::u16string& GetToolTip() const override;
ui::MenuModel* GetMenuModel() const override; ui::MenuModel* GetMenuModel() const override;
void OnImplInitializationFailed() override; void OnImplInitializationFailed() override;
private: private:
std::unique_ptr<views::StatusIconLinux> icon_; std::unique_ptr<views::StatusIconLinux> icon_;
gfx::ImageSkia image_; gfx::ImageSkia image_;
base::string16 tool_tip_; std::u16string tool_tip_;
ui::MenuModel* menu_model_; ui::MenuModel* menu_model_;
DISALLOW_COPY_AND_ASSIGN(TrayIconGtk); DISALLOW_COPY_AND_ASSIGN(TrayIconGtk);

View file

@ -37,7 +37,7 @@ class AutofillPopup;
// by |AutofillPopupViewViews|. // by |AutofillPopupViewViews|.
class AutofillPopupChildView : public views::View { class AutofillPopupChildView : public views::View {
public: public:
explicit AutofillPopupChildView(const base::string16& suggestion) explicit AutofillPopupChildView(const std::u16string& suggestion)
: suggestion_(suggestion) { : suggestion_(suggestion) {
SetFocusBehavior(FocusBehavior::ALWAYS); SetFocusBehavior(FocusBehavior::ALWAYS);
} }
@ -48,7 +48,7 @@ class AutofillPopupChildView : public views::View {
// views::Views implementation // views::Views implementation
void GetAccessibleNodeData(ui::AXNodeData* node_data) override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
base::string16 suggestion_; std::u16string suggestion_;
DISALLOW_COPY_AND_ASSIGN(AutofillPopupChildView); DISALLOW_COPY_AND_ASSIGN(AutofillPopupChildView);
}; };

View file

@ -47,8 +47,8 @@ bool ViewsDelegate::GetSavedWindowPlacement(
return false; return false;
} }
void ViewsDelegate::NotifyMenuItemFocused(const base::string16& menu_name, void ViewsDelegate::NotifyMenuItemFocused(const std::u16string& menu_name,
const base::string16& menu_item_name, const std::u16string& menu_item_name,
int item_index, int item_index,
int item_count, int item_count,
bool has_submenu) {} bool has_submenu) {}

View file

@ -29,8 +29,8 @@ class ViewsDelegate : public views::ViewsDelegate {
const std::string& window_name, const std::string& window_name,
gfx::Rect* bounds, gfx::Rect* bounds,
ui::WindowShowState* show_state) const override; ui::WindowShowState* show_state) const override;
void NotifyMenuItemFocused(const base::string16& menu_name, void NotifyMenuItemFocused(const std::u16string& menu_name,
const base::string16& menu_item_name, const std::u16string& menu_item_name,
int item_index, int item_index,
int item_count, int item_count,
bool has_submenu) override; bool has_submenu) override;

View file

@ -297,7 +297,7 @@ void GlobalMenuBarX11::RegisterAccelerator(DbusmenuMenuitem* item,
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return; 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()); g_variant_builder_add(&builder, "s", name.c_str());
GVariant* inside_array = g_variant_builder_end(&builder); GVariant* inside_array = g_variant_builder_end(&builder);

View file

@ -46,7 +46,7 @@ class DevToolsWindowDelegate : public views::ClientView,
bool CanResize() const override { return true; } bool CanResize() const override { return true; }
bool CanMaximize() const override { return true; } bool CanMaximize() const override { return true; }
bool CanMinimize() 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 GetWindowAppIcon() override { return GetWindowIcon(); }
gfx::ImageSkia GetWindowIcon() override { return icon_; } gfx::ImageSkia GetWindowIcon() override { return icon_; }
views::Widget* GetWidget() override { return widget_; } views::Widget* GetWidget() override { return widget_; }
@ -202,7 +202,7 @@ void InspectableWebContentsViewViews::SetContentsResizingStrategy(
Layout(); Layout();
} }
void InspectableWebContentsViewViews::SetTitle(const base::string16& title) { void InspectableWebContentsViewViews::SetTitle(const std::u16string& title) {
if (devtools_window_) { if (devtools_window_) {
title_ = title; title_ = title;
devtools_window_->UpdateWindowTitle(); devtools_window_->UpdateWindowTitle();

View file

@ -39,13 +39,13 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
void SetIsDocked(bool docked, bool activate) override; void SetIsDocked(bool docked, bool activate) override;
void SetContentsResizingStrategy( void SetContentsResizingStrategy(
const DevToolsContentsResizingStrategy& strategy) override; const DevToolsContentsResizingStrategy& strategy) override;
void SetTitle(const base::string16& title) override; void SetTitle(const std::u16string& title) override;
InspectableWebContents* inspectable_web_contents() { InspectableWebContents* inspectable_web_contents() {
return inspectable_web_contents_; return inspectable_web_contents_;
} }
const base::string16& GetTitle() const { return title_; } const std::u16string& GetTitle() const { return title_; }
private: private:
// views::View: // views::View:
@ -62,7 +62,7 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
DevToolsContentsResizingStrategy strategy_; DevToolsContentsResizingStrategy strategy_;
bool devtools_visible_ = false; bool devtools_visible_ = false;
views::WidgetDelegate* devtools_window_delegate_ = nullptr; views::WidgetDelegate* devtools_window_delegate_ = nullptr;
base::string16 title_; std::u16string title_;
DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewViews); DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewViews);
}; };

View file

@ -70,7 +70,7 @@ bool MenuDelegate::GetAccelerator(int id, ui::Accelerator* accelerator) const {
return adapter_->GetAccelerator(id, accelerator); return adapter_->GetAccelerator(id, accelerator);
} }
base::string16 MenuDelegate::GetLabel(int id) const { std::u16string MenuDelegate::GetLabel(int id) const {
return adapter_->GetLabel(id); return adapter_->GetLabel(id);
} }

View file

@ -46,7 +46,7 @@ class MenuDelegate : public views::MenuDelegate {
bool IsTriggerableEvent(views::MenuItemView* source, bool IsTriggerableEvent(views::MenuItemView* source,
const ui::Event& e) override; const ui::Event& e) override;
bool GetAccelerator(int id, ui::Accelerator* accelerator) const 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; void GetLabelStyle(int id, LabelStyle* style) const override;
bool IsCommandEnabled(int id) const override; bool IsCommandEnabled(int id) const override;
bool IsCommandVisible(int id) const override; bool IsCommandVisible(int id) const override;

View file

@ -21,7 +21,7 @@
namespace electron { namespace electron {
SubmenuButton::SubmenuButton(PressedCallback callback, SubmenuButton::SubmenuButton(PressedCallback callback,
const base::string16& title, const std::u16string& title,
const SkColor& background_color) const SkColor& background_color)
: views::MenuButton(callback, gfx::RemoveAccelerator(title)), : views::MenuButton(callback, gfx::RemoveAccelerator(title)),
background_color_(background_color) { 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, char16_t* accelerator,
int* start, int* start,
int* end) const { int* end) const {
int pos, span; int pos, span;
base::string16 trimmed = std::u16string trimmed =
gfx::LocateAndRemoveAcceleratorChar(text, &pos, &span); gfx::LocateAndRemoveAcceleratorChar(text, &pos, &span);
if (pos > -1 && span != 0) { if (pos > -1 && span != 0) {
*accelerator = base::ToUpperASCII(trimmed[pos]); *accelerator = base::ToUpperASCII(trimmed[pos]);
@ -106,7 +106,7 @@ bool SubmenuButton::GetUnderlinePosition(const base::string16& text,
return false; return false;
} }
void SubmenuButton::GetCharacterPosition(const base::string16& text, void SubmenuButton::GetCharacterPosition(const std::u16string& text,
int index, int index,
int* pos) const { int* pos) const {
int height = 0; int height = 0;

View file

@ -17,7 +17,7 @@ namespace electron {
class SubmenuButton : public views::MenuButton { class SubmenuButton : public views::MenuButton {
public: public:
SubmenuButton(PressedCallback callback, SubmenuButton(PressedCallback callback,
const base::string16& title, const std::u16string& title,
const SkColor& background_color); const SkColor& background_color);
~SubmenuButton() override; ~SubmenuButton() override;
@ -36,11 +36,11 @@ class SubmenuButton : public views::MenuButton {
std::unique_ptr<views::InkDrop> CreateInkDrop() override; std::unique_ptr<views::InkDrop> CreateInkDrop() override;
private: private:
bool GetUnderlinePosition(const base::string16& text, bool GetUnderlinePosition(const std::u16string& text,
char16_t* accelerator, char16_t* accelerator,
int* start, int* start,
int* end) const; int* end) const;
void GetCharacterPosition(const base::string16& text, void GetCharacterPosition(const std::u16string& text,
int index, int index,
int* pos) const; int* pos) const;

View file

@ -158,7 +158,7 @@ JumpListCategory::JumpListCategory() = default;
JumpListCategory::JumpListCategory(const JumpListCategory&) = default; JumpListCategory::JumpListCategory(const JumpListCategory&) = default;
JumpListCategory::~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); destinations_.CoCreateInstance(CLSID_DestinationList);
} }

View file

@ -46,9 +46,9 @@ struct JumpListItem {
// For tasks this is the path to the program executable, for file links this // For tasks this is the path to the program executable, for file links this
// is the full filename. // is the full filename.
base::FilePath path; base::FilePath path;
base::string16 arguments; std::u16string arguments;
base::string16 title; std::u16string title;
base::string16 description; std::u16string description;
base::FilePath working_dir; base::FilePath working_dir;
base::FilePath icon_path; base::FilePath icon_path;
int icon_index = 0; int icon_index = 0;
@ -73,7 +73,7 @@ struct JumpListCategory {
}; };
Type type = Type::kTasks; Type type = Type::kTasks;
base::string16 name; std::u16string name;
std::vector<JumpListItem> items; std::vector<JumpListItem> items;
JumpListCategory(); JumpListCategory();
@ -88,7 +88,7 @@ class JumpList {
// |app_id| must be the Application User Model ID of the app for which the // |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 // custom Jump List should be created/removed, it's usually obtained by
// calling GetCurrentProcessExplicitAppUserModelID(). // calling GetCurrentProcessExplicitAppUserModelID().
explicit JumpList(const base::string16& app_id); explicit JumpList(const std::u16string& app_id);
~JumpList(); ~JumpList();
// Starts a new transaction, must be called before appending any categories, // Starts a new transaction, must be called before appending any categories,
@ -111,7 +111,7 @@ class JumpList {
const std::vector<JumpListCategory>& categories); const std::vector<JumpListCategory>& categories);
private: private:
base::string16 app_id_; std::u16string app_id_;
CComPtr<ICustomDestinationList> destinations_; CComPtr<ICustomDestinationList> destinations_;
DISALLOW_COPY_AND_ASSIGN(JumpList); DISALLOW_COPY_AND_ASSIGN(JumpList);

View file

@ -50,7 +50,7 @@ bool GetAsString(const base::Value* val,
bool GetAsString(const base::Value* val, bool GetAsString(const base::Value* val,
base::StringPiece path, base::StringPiece path,
base::string16* out) { std::u16string* out) {
if (val) { if (val) {
auto* found = val->FindKeyOfType(path, base::Value::Type::STRING); auto* found = val->FindKeyOfType(path, base::Value::Type::STRING);
if (found) { if (found) {
@ -380,7 +380,7 @@ void WebContentsPreferences::OverrideWebkitPrefs(
auto* fonts_dict = preference_.FindKeyOfType("defaultFontFamily", auto* fonts_dict = preference_.FindKeyOfType("defaultFontFamily",
base::Value::Type::DICTIONARY); base::Value::Type::DICTIONARY);
if (fonts_dict) { if (fonts_dict) {
base::string16 font; std::u16string font;
if (GetAsString(fonts_dict, "standard", &font)) if (GetAsString(fonts_dict, "standard", &font))
prefs->standard_font_family_map[blink::web_pref::kCommonScript] = font; prefs->standard_font_family_map[blink::web_pref::kCommonScript] = font;
if (GetAsString(fonts_dict, "serif", &font)) if (GetAsString(fonts_dict, "serif", &font))

View file

@ -35,7 +35,7 @@ using blink::mojom::NativeFileInfo;
namespace { namespace {
file_dialog::Filters GetFileTypesFromAcceptType( file_dialog::Filters GetFileTypesFromAcceptType(
const std::vector<base::string16>& accept_types) { const std::vector<std::u16string>& accept_types) {
file_dialog::Filters filters; file_dialog::Filters filters;
if (accept_types.empty()) if (accept_types.empty())
return filters; return filters;
@ -163,7 +163,7 @@ void WebDialogHelper::EnumerateDirectory(
std::vector<FileChooserFileInfoPtr> file_info; std::vector<FileChooserFileInfoPtr> file_info;
while (!(path = file_enum.Next()).empty()) { while (!(path = file_enum.Next()).empty()) {
file_info.push_back(FileChooserFileInfo::NewNativeFile( file_info.push_back(FileChooserFileInfo::NewNativeFile(
NativeFileInfo::New(path, base::string16()))); NativeFileInfo::New(path, std::u16string())));
} }
listener->FileSelected(std::move(file_info), dir, listener->FileSelected(std::move(file_info), dir,

View file

@ -26,9 +26,9 @@ ui::ClipboardBuffer Clipboard::GetClipboardBuffer(gin_helper::Arguments* args) {
return ui::ClipboardBuffer::kCopyPaste; return ui::ClipboardBuffer::kCopyPaste;
} }
std::vector<base::string16> Clipboard::AvailableFormats( std::vector<std::u16string> Clipboard::AvailableFormats(
gin_helper::Arguments* args) { gin_helper::Arguments* args) {
std::vector<base::string16> format_types; std::vector<std::u16string> format_types;
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
clipboard->ReadAvailableTypes(GetClipboardBuffer(args), clipboard->ReadAvailableTypes(GetClipboardBuffer(args),
/* data_dst = */ nullptr, &format_types); /* data_dst = */ nullptr, &format_types);
@ -80,7 +80,7 @@ void Clipboard::WriteBuffer(const std::string& format,
void Clipboard::Write(const gin_helper::Dictionary& data, void Clipboard::Write(const gin_helper::Dictionary& data,
gin_helper::Arguments* args) { gin_helper::Arguments* args) {
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
base::string16 text, html, bookmark; std::u16string text, html, bookmark;
gfx::Image image; gfx::Image image;
if (data.Get("text", &text)) { if (data.Get("text", &text)) {
@ -102,8 +102,8 @@ void Clipboard::Write(const gin_helper::Dictionary& data,
writer.WriteImage(image.AsBitmap()); writer.WriteImage(image.AsBitmap());
} }
base::string16 Clipboard::ReadText(gin_helper::Arguments* args) { std::u16string Clipboard::ReadText(gin_helper::Arguments* args) {
base::string16 data; std::u16string data;
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
auto type = GetClipboardBuffer(args); auto type = GetClipboardBuffer(args);
if (clipboard->IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), if (clipboard->IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(),
@ -123,13 +123,13 @@ base::string16 Clipboard::ReadText(gin_helper::Arguments* args) {
return data; return data;
} }
void Clipboard::WriteText(const base::string16& text, void Clipboard::WriteText(const std::u16string& text,
gin_helper::Arguments* args) { gin_helper::Arguments* args) {
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
writer.WriteText(text); writer.WriteText(text);
} }
base::string16 Clipboard::ReadRTF(gin_helper::Arguments* args) { std::u16string Clipboard::ReadRTF(gin_helper::Arguments* args) {
std::string data; std::string data;
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
clipboard->ReadRTF(GetClipboardBuffer(args), /* data_dst = */ nullptr, &data); 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); writer.WriteRTF(text);
} }
base::string16 Clipboard::ReadHTML(gin_helper::Arguments* args) { std::u16string Clipboard::ReadHTML(gin_helper::Arguments* args) {
base::string16 data; std::u16string data;
base::string16 html; std::u16string html;
std::string url; std::string url;
uint32_t start; uint32_t start;
uint32_t end; uint32_t end;
@ -154,14 +154,14 @@ base::string16 Clipboard::ReadHTML(gin_helper::Arguments* args) {
return data; return data;
} }
void Clipboard::WriteHTML(const base::string16& html, void Clipboard::WriteHTML(const std::u16string& html,
gin_helper::Arguments* args) { gin_helper::Arguments* args) {
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
writer.WriteHTML(html, std::string()); writer.WriteHTML(html, std::string());
} }
v8::Local<v8::Value> Clipboard::ReadBookmark(gin_helper::Arguments* args) { v8::Local<v8::Value> Clipboard::ReadBookmark(gin_helper::Arguments* args) {
base::string16 title; std::u16string title;
std::string url; std::string url;
gin_helper::Dictionary dict = gin_helper::Dictionary dict =
gin_helper::Dictionary::CreateEmpty(args->isolate()); gin_helper::Dictionary::CreateEmpty(args->isolate());
@ -172,7 +172,7 @@ v8::Local<v8::Value> Clipboard::ReadBookmark(gin_helper::Arguments* args) {
return dict.GetHandle(); return dict.GetHandle();
} }
void Clipboard::WriteBookmark(const base::string16& title, void Clipboard::WriteBookmark(const std::u16string& title,
const std::string& url, const std::string& url,
gin_helper::Arguments* args) { gin_helper::Arguments* args) {
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
@ -207,9 +207,9 @@ void Clipboard::WriteImage(const gfx::Image& image,
} }
#if !defined(OS_MAC) #if !defined(OS_MAC)
void Clipboard::WriteFindText(const base::string16& text) {} void Clipboard::WriteFindText(const std::u16string& text) {}
base::string16 Clipboard::ReadFindText() { std::u16string Clipboard::ReadFindText() {
return base::string16(); return std::u16string();
} }
#endif #endif

View file

@ -24,7 +24,7 @@ namespace api {
class Clipboard { class Clipboard {
public: public:
static ui::ClipboardBuffer GetClipboardBuffer(gin_helper::Arguments* args); static ui::ClipboardBuffer GetClipboardBuffer(gin_helper::Arguments* args);
static std::vector<base::string16> AvailableFormats( static std::vector<std::u16string> AvailableFormats(
gin_helper::Arguments* args); gin_helper::Arguments* args);
static bool Has(const std::string& format_string, static bool Has(const std::string& format_string,
gin_helper::Arguments* args); gin_helper::Arguments* args);
@ -34,27 +34,27 @@ class Clipboard {
static void Write(const gin_helper::Dictionary& data, static void Write(const gin_helper::Dictionary& data,
gin_helper::Arguments* args); gin_helper::Arguments* args);
static base::string16 ReadText(gin_helper::Arguments* args); static std::u16string ReadText(gin_helper::Arguments* args);
static void WriteText(const base::string16& text, static void WriteText(const std::u16string& text,
gin_helper::Arguments* args); 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 void WriteRTF(const std::string& text, gin_helper::Arguments* args);
static base::string16 ReadHTML(gin_helper::Arguments* args); static std::u16string ReadHTML(gin_helper::Arguments* args);
static void WriteHTML(const base::string16& html, static void WriteHTML(const std::u16string& html,
gin_helper::Arguments* args); gin_helper::Arguments* args);
static v8::Local<v8::Value> ReadBookmark(gin_helper::Arguments* args); static v8::Local<v8::Value> ReadBookmark(gin_helper::Arguments* args);
static void WriteBookmark(const base::string16& title, static void WriteBookmark(const std::u16string& title,
const std::string& url, const std::string& url,
gin_helper::Arguments* args); gin_helper::Arguments* args);
static gfx::Image ReadImage(gin_helper::Arguments* args); static gfx::Image ReadImage(gin_helper::Arguments* args);
static void WriteImage(const gfx::Image& image, gin_helper::Arguments* args); static void WriteImage(const gfx::Image& image, gin_helper::Arguments* args);
static base::string16 ReadFindText(); static std::u16string ReadFindText();
static void WriteFindText(const base::string16& text); static void WriteFindText(const std::u16string& text);
static v8::Local<v8::Value> ReadBuffer(const std::string& format_string, static v8::Local<v8::Value> ReadBuffer(const std::string& format_string,
gin_helper::Arguments* args); gin_helper::Arguments* args);

View file

@ -10,12 +10,12 @@ namespace electron {
namespace api { namespace api {
void Clipboard::WriteFindText(const base::string16& text) { void Clipboard::WriteFindText(const std::u16string& text) {
NSString* text_ns = base::SysUTF16ToNSString(text); NSString* text_ns = base::SysUTF16ToNSString(text);
[[FindPasteboard sharedInstance] setFindText:text_ns]; [[FindPasteboard sharedInstance] setFindText:text_ns];
} }
base::string16 Clipboard::ReadFindText() { std::u16string Clipboard::ReadFindText() {
return GetFindPboardText(); return GetFindPboardText();
} }

View file

@ -117,7 +117,7 @@ bool WriteShortcutLink(const base::FilePath& shortcut_path,
base::win::ShortcutProperties properties; base::win::ShortcutProperties properties;
base::FilePath path; base::FilePath path;
base::string16 str; std::u16string str;
UUID toastActivatorClsid; UUID toastActivatorClsid;
int index; int index;
if (options.Get("target", &path)) if (options.Get("target", &path))

View file

@ -28,7 +28,7 @@ std::string GetApplicationUserAgent();
#if defined(OS_WIN) #if defined(OS_WIN)
PCWSTR GetRawAppUserModelID(); PCWSTR GetRawAppUserModelID();
bool GetAppUserModelID(ScopedHString* app_id); bool GetAppUserModelID(ScopedHString* app_id);
void SetAppUserModelID(const base::string16& name); void SetAppUserModelID(const std::u16string& name);
bool IsRunningInDesktopBridge(); bool IsRunningInDesktopBridge();
#endif #endif

View file

@ -23,7 +23,7 @@ namespace electron {
namespace { namespace {
base::string16 g_app_user_model_id; std::u16string g_app_user_model_id;
} }
const wchar_t kAppUserModelIDFormat[] = L"electron.app.$1"; const wchar_t kAppUserModelIDFormat[] = L"electron.app.$1";
@ -42,7 +42,7 @@ std::string GetApplicationVersion() {
return base::UTF16ToUTF8(info->product_version()); return base::UTF16ToUTF8(info->product_version());
} }
void SetAppUserModelID(const base::string16& name) { void SetAppUserModelID(const std::u16string& name) {
g_app_user_model_id = name; g_app_user_model_id = name;
SetCurrentProcessExplicitAppUserModelID(g_app_user_model_id.c_str()); SetCurrentProcessExplicitAppUserModelID(g_app_user_model_id.c_str());
} }
@ -54,7 +54,7 @@ PCWSTR GetRawAppUserModelID() {
g_app_user_model_id = current_app_id; g_app_user_model_id = current_app_id;
} else { } else {
std::string name = GetApplicationName(); std::string name = GetApplicationName();
base::string16 generated_app_id = base::ReplaceStringPlaceholders( std::u16string generated_app_id = base::ReplaceStringPlaceholders(
kAppUserModelIDFormat, base::UTF8ToUTF16(name), nullptr); kAppUserModelIDFormat, base::UTF8ToUTF16(name), nullptr);
SetAppUserModelID(generated_app_id); SetAppUserModelID(generated_app_id);
} }

View file

@ -47,7 +47,7 @@ struct Converter<char16_t> {
static bool FromV8(v8::Isolate* isolate, static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val, v8::Handle<v8::Value> val,
char16_t* out) { 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) if (code.length() != 1)
return false; return false;
*out = code[0]; *out = code[0];
@ -206,7 +206,7 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(v8::Isolate* isolate,
// Make sure to not read beyond the buffer in case some bad code doesn't // Make sure to not read beyond the buffer in case some bad code doesn't
// NULL-terminate it (this is called from plugins). // NULL-terminate it (this is called from plugins).
size_t text_length_cap = blink::WebKeyboardEvent::kTextLengthCap; 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->text, text_length_cap, 0);
std::fill_n(out->unmodified_text, text_length_cap, 0); std::fill_n(out->unmodified_text, text_length_cap, 0);
@ -365,7 +365,7 @@ v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags) {
bool pasteFlag = false; bool pasteFlag = false;
if (editFlags & blink::ContextMenuDataEditFlags::kCanPaste) { if (editFlags & blink::ContextMenuDataEditFlags::kCanPaste) {
std::vector<base::string16> types; std::vector<std::u16string> types;
ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes( ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes(
ui::ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr, &types); ui::ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr, &types);
pasteFlag = !types.empty(); pasteFlag = !types.empty();

View file

@ -18,7 +18,7 @@ std::vector<std::string> GetPreferredLanguages();
#if defined(OS_WIN) #if defined(OS_WIN)
bool GetPreferredLanguagesUsingGlobalization( bool GetPreferredLanguagesUsingGlobalization(
std::vector<base::string16>* languages); std::vector<std::u16string>* languages);
#endif #endif
} // namespace electron } // namespace electron

View file

@ -17,7 +17,7 @@
namespace electron { namespace electron {
std::vector<std::string> GetPreferredLanguages() { std::vector<std::string> GetPreferredLanguages() {
std::vector<base::string16> languages16; std::vector<std::u16string> languages16;
// Attempt to use API available on Windows 10 or later, which // Attempt to use API available on Windows 10 or later, which
// returns the full list of language preferences. // returns the full list of language preferences.
@ -33,7 +33,7 @@ std::vector<std::string> GetPreferredLanguages() {
} }
bool GetPreferredLanguagesUsingGlobalization( bool GetPreferredLanguagesUsingGlobalization(
std::vector<base::string16>* languages) { std::vector<std::u16string>* languages) {
if (base::win::GetVersion() < base::win::Version::WIN10) if (base::win::GetVersion() < base::win::Version::WIN10)
return false; return false;
if (!base::win::ResolveCoreWinRTDelayload() || if (!base::win::ResolveCoreWinRTDelayload() ||

View file

@ -241,8 +241,8 @@ std::string OpenExternalOnWorkerThread(
// Quote the input scheme to be sure that the command does not have // Quote the input scheme to be sure that the command does not have
// parameters unexpected by the external program. This url should already // parameters unexpected by the external program. This url should already
// have been escaped. // have been escaped.
base::string16 escaped_url = L"\"" + base::UTF8ToUTF16(url.spec()) + L"\""; std::u16string escaped_url = L"\"" + base::UTF8ToUTF16(url.spec()) + L"\"";
base::string16 working_dir = options.working_dir.value(); std::u16string working_dir = options.working_dir.value();
if (reinterpret_cast<ULONG_PTR>( if (reinterpret_cast<ULONG_PTR>(
ShellExecuteW(nullptr, L"open", escaped_url.c_str(), nullptr, ShellExecuteW(nullptr, L"open", escaped_url.c_str(), nullptr,

View file

@ -28,7 +28,7 @@ namespace api {
namespace { namespace {
bool HasWordCharacters(const base::string16& text, int index) { bool HasWordCharacters(const std::u16string& text, int index) {
const char16_t* data = text.data(); const char16_t* data = text.data();
int length = text.length(); int length = text.length();
while (index < length) { while (index < length) {
@ -43,8 +43,8 @@ bool HasWordCharacters(const base::string16& text, int index) {
struct Word { struct Word {
blink::WebTextCheckingResult result; blink::WebTextCheckingResult result;
base::string16 text; std::u16string text;
std::vector<base::string16> contraction_words; std::vector<std::u16string> contraction_words;
}; };
} // namespace } // namespace
@ -52,19 +52,19 @@ struct Word {
class SpellCheckClient::SpellcheckRequest { class SpellCheckClient::SpellcheckRequest {
public: public:
SpellcheckRequest( SpellcheckRequest(
const base::string16& text, const std::u16string& text,
std::unique_ptr<blink::WebTextCheckingCompletion> completion) std::unique_ptr<blink::WebTextCheckingCompletion> completion)
: text_(text), completion_(std::move(completion)) {} : text_(text), completion_(std::move(completion)) {}
SpellcheckRequest(const SpellcheckRequest&) = delete; SpellcheckRequest(const SpellcheckRequest&) = delete;
SpellcheckRequest& operator=(const SpellcheckRequest&) = delete; SpellcheckRequest& operator=(const SpellcheckRequest&) = delete;
~SpellcheckRequest() = default; ~SpellcheckRequest() = default;
const base::string16& text() const { return text_; } const std::u16string& text() const { return text_; }
blink::WebTextCheckingCompletion* completion() { return completion_.get(); } blink::WebTextCheckingCompletion* completion() { return completion_.get(); }
std::vector<Word>& wordlist() { return word_list_; } std::vector<Word>& wordlist() { return word_list_; }
private: private:
base::string16 text_; // Text to be checked in this task. std::u16string text_; // Text to be checked in this task.
std::vector<Word> word_list_; // List of Words found in text std::vector<Word> word_list_; // List of Words found in text
// The interface to send the misspelled ranges to WebKit. // The interface to send the misspelled ranges to WebKit.
std::unique_ptr<blink::WebTextCheckingCompletion> completion_; std::unique_ptr<blink::WebTextCheckingCompletion> completion_;
@ -93,7 +93,7 @@ SpellCheckClient::~SpellCheckClient() {
void SpellCheckClient::RequestCheckingOfText( void SpellCheckClient::RequestCheckingOfText(
const blink::WebString& textToCheck, const blink::WebString& textToCheck,
std::unique_ptr<blink::WebTextCheckingCompletion> completionCallback) { std::unique_ptr<blink::WebTextCheckingCompletion> completionCallback) {
base::string16 text(textToCheck.Utf16()); std::u16string text(textToCheck.Utf16());
// Ignore invalid requests. // Ignore invalid requests.
if (text.empty() || !HasWordCharacters(text, 0)) { if (text.empty() || !HasWordCharacters(text, 0)) {
completionCallback->DidCancelCheckingText(); completionCallback->DidCancelCheckingText();
@ -151,10 +151,10 @@ void SpellCheckClient::SpellCheckText() {
text_iterator_.SetText(text.c_str(), text.size()); text_iterator_.SetText(text.c_str(), text.size());
SpellCheckScope scope(*this); SpellCheckScope scope(*this);
base::string16 word; std::u16string word;
size_t word_start; size_t word_start;
size_t word_length; size_t word_length;
std::set<base::string16> words; std::set<std::u16string> words;
auto& word_list = pending_request_param_->wordlist(); auto& word_list = pending_request_param_->wordlist();
Word word_entry; Word word_entry;
for (;;) { // Run until end of text for (;;) { // Run until end of text
@ -186,9 +186,9 @@ void SpellCheckClient::SpellCheckText() {
} }
void SpellCheckClient::OnSpellCheckDone( void SpellCheckClient::OnSpellCheckDone(
const std::vector<base::string16>& misspelled_words) { const std::vector<std::u16string>& misspelled_words) {
std::vector<blink::WebTextCheckingResult> results; std::vector<blink::WebTextCheckingResult> results;
std::unordered_set<base::string16> misspelled(misspelled_words.begin(), std::unordered_set<std::u16string> misspelled(misspelled_words.begin(),
misspelled_words.end()); misspelled_words.end());
auto& word_list = pending_request_param_->wordlist(); auto& word_list = pending_request_param_->wordlist();
@ -216,7 +216,7 @@ void SpellCheckClient::OnSpellCheckDone(
} }
void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope, void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope,
const std::set<base::string16>& words) { const std::set<std::u16string>& words) {
DCHECK(!scope.spell_check_.IsEmpty()); DCHECK(!scope.spell_check_.IsEmpty());
v8::Local<v8::FunctionTemplate> templ = gin_helper::CreateFunctionTemplate( v8::Local<v8::FunctionTemplate> templ = gin_helper::CreateFunctionTemplate(
@ -238,13 +238,13 @@ void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope,
// words in the contraction. // words in the contraction.
bool SpellCheckClient::IsContraction( bool SpellCheckClient::IsContraction(
const SpellCheckScope& scope, const SpellCheckScope& scope,
const base::string16& contraction, const std::u16string& contraction,
std::vector<base::string16>* contraction_words) { std::vector<std::u16string>* contraction_words) {
DCHECK(contraction_iterator_.IsInitialized()); DCHECK(contraction_iterator_.IsInitialized());
contraction_iterator_.SetText(contraction.c_str(), contraction.length()); contraction_iterator_.SetText(contraction.c_str(), contraction.length());
base::string16 word; std::u16string word;
size_t word_start; size_t word_start;
size_t word_length; size_t word_length;
for (auto status = for (auto status =

View file

@ -69,18 +69,18 @@ class SpellCheckClient : public blink::WebSpellCheckPanelHostClient,
// The javascript function will callback OnSpellCheckDone // The javascript function will callback OnSpellCheckDone
// with the results of all the misspelled words. // with the results of all the misspelled words.
void SpellCheckWords(const SpellCheckScope& scope, void SpellCheckWords(const SpellCheckScope& scope,
const std::set<base::string16>& words); const std::set<std::u16string>& words);
// Returns whether or not the given word is a contraction of valid words // Returns whether or not the given word is a contraction of valid words
// (e.g. "word:word"). // (e.g. "word:word").
// Output variable contraction_words will contain individual // Output variable contraction_words will contain individual
// words in the contraction. // words in the contraction.
bool IsContraction(const SpellCheckScope& scope, bool IsContraction(const SpellCheckScope& scope,
const base::string16& word, const std::u16string& word,
std::vector<base::string16>* contraction_words); std::vector<std::u16string>* contraction_words);
// Callback for the JS API which returns the list of misspelled words. // Callback for the JS API which returns the list of misspelled words.
void OnSpellCheckDone(const std::vector<base::string16>& misspelled_words); void OnSpellCheckDone(const std::vector<std::u16string>& misspelled_words);
// Represents character attributes used for filtering out characters which // Represents character attributes used for filtering out characters which
// are not supported by this SpellCheck object. // are not supported by this SpellCheck object.

View file

@ -114,7 +114,7 @@ content::RenderFrame* GetRenderFrame(v8::Local<v8::Value> value) {
bool SpellCheckWord(v8::Isolate* isolate, bool SpellCheckWord(v8::Isolate* isolate,
v8::Local<v8::Value> window, v8::Local<v8::Value> window,
const std::string& word, const std::string& word,
std::vector<base::string16>* optional_suggestions) { std::vector<std::u16string>* optional_suggestions) {
size_t start; size_t start;
size_t length; size_t length;
@ -123,7 +123,7 @@ bool SpellCheckWord(v8::Isolate* isolate,
if (!render_frame) if (!render_frame)
return true; return true;
base::string16 w = base::UTF8ToUTF16(word); std::u16string w = base::UTF8ToUTF16(word);
int id = render_frame->GetRoutingID(); int id = render_frame->GetRoutingID();
return client->GetSpellCheck()->SpellCheckWord( return client->GetSpellCheck()->SpellCheckWord(
w.c_str(), 0, word.size(), id, &start, &length, optional_suggestions); 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<v8::Value> window, std::u16string InsertCSS(v8::Local<v8::Value> window,
const std::string& css, const std::string& css,
gin_helper::Arguments* args) { gin_helper::Arguments* args) {
blink::WebDocument::CSSOrigin css_origin = blink::WebDocument::CSSOrigin css_origin =
@ -591,7 +591,7 @@ base::string16 InsertCSS(v8::Local<v8::Value> window,
args->ThrowError( args->ThrowError(
"Render frame was torn down before webFrame.insertCSS could be " "Render frame was torn down before webFrame.insertCSS could be "
"executed"); "executed");
return base::string16(); return std::u16string();
} }
blink::WebFrame* web_frame = render_frame->GetWebFrame(); blink::WebFrame* web_frame = render_frame->GetWebFrame();
@ -601,12 +601,12 @@ base::string16 InsertCSS(v8::Local<v8::Value> window,
.InsertStyleSheet(blink::WebString::FromUTF8(css), nullptr, css_origin) .InsertStyleSheet(blink::WebString::FromUTF8(css), nullptr, css_origin)
.Utf16(); .Utf16();
} }
return base::string16(); return std::u16string();
} }
void RemoveInsertedCSS(gin_helper::ErrorThrower thrower, void RemoveInsertedCSS(gin_helper::ErrorThrower thrower,
v8::Local<v8::Value> window, v8::Local<v8::Value> window,
const base::string16& key) { const std::u16string& key) {
auto* render_frame = GetRenderFrame(window); auto* render_frame = GetRenderFrame(window);
if (!render_frame) { if (!render_frame) {
thrower.ThrowError( thrower.ThrowError(
@ -624,7 +624,7 @@ void RemoveInsertedCSS(gin_helper::ErrorThrower thrower,
v8::Local<v8::Promise> ExecuteJavaScript(gin_helper::Arguments* args, v8::Local<v8::Promise> ExecuteJavaScript(gin_helper::Arguments* args,
v8::Local<v8::Value> window, v8::Local<v8::Value> window,
const base::string16& code) { const std::u16string& code) {
v8::Isolate* isolate = args->isolate(); v8::Isolate* isolate = args->isolate();
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate); gin_helper::Promise<v8::Local<v8::Value>> promise(isolate);
v8::Local<v8::Promise> handle = promise.GetHandle(); v8::Local<v8::Promise> handle = promise.GetHandle();
@ -685,8 +685,8 @@ v8::Local<v8::Promise> ExecuteJavaScriptInIsolatedWorld(
std::vector<blink::WebScriptSource> sources; std::vector<blink::WebScriptSource> sources;
for (const auto& script : scripts) { for (const auto& script : scripts) {
base::string16 code; std::u16string code;
base::string16 url; std::u16string url;
int start_line = 1; int start_line = 1;
script.Get("url", &url); script.Get("url", &url);
script.Get("startLine", &start_line); script.Get("startLine", &start_line);
@ -766,10 +766,10 @@ bool IsWordMisspelled(v8::Isolate* isolate,
return !SpellCheckWord(isolate, window, word, nullptr); return !SpellCheckWord(isolate, window, word, nullptr);
} }
std::vector<base::string16> GetWordSuggestions(v8::Isolate* isolate, std::vector<std::u16string> GetWordSuggestions(v8::Isolate* isolate,
v8::Local<v8::Value> window, v8::Local<v8::Value> window,
const std::string& word) { const std::string& word) {
std::vector<base::string16> suggestions; std::vector<std::u16string> suggestions;
SpellCheckWord(isolate, window, word, &suggestions); SpellCheckWord(isolate, window, word, &suggestions);
return suggestions; return suggestions;
} }

View file

@ -25,18 +25,18 @@ const size_t kMaxDataLength = 1024;
const size_t kMaxListSize = 512; const size_t kMaxListSize = 512;
void GetDataListSuggestions(const blink::WebInputElement& element, void GetDataListSuggestions(const blink::WebInputElement& element,
std::vector<base::string16>* values, std::vector<std::u16string>* values,
std::vector<base::string16>* labels) { std::vector<std::u16string>* labels) {
for (const auto& option : element.FilteredDataListOptions()) { for (const auto& option : element.FilteredDataListOptions()) {
values->push_back(option.Value().Utf16()); values->push_back(option.Value().Utf16());
if (option.Value() != option.Label()) if (option.Value() != option.Label())
labels->push_back(option.Label().Utf16()); labels->push_back(option.Label().Utf16());
else else
labels->push_back(base::string16()); labels->push_back(std::u16string());
} }
} }
void TrimStringVectorForIPC(std::vector<base::string16>* strings) { void TrimStringVectorForIPC(std::vector<std::u16string>* strings) {
// Limit the size of the vector. // Limit the size of the vector.
if (strings->size() > kMaxListSize) if (strings->size() > kMaxListSize)
strings->resize(kMaxListSize); strings->resize(kMaxListSize);
@ -152,8 +152,8 @@ void AutofillAgent::ShowSuggestions(const blink::WebFormControlElement& element,
return; return;
} }
std::vector<base::string16> data_list_values; std::vector<std::u16string> data_list_values;
std::vector<base::string16> data_list_labels; std::vector<std::u16string> data_list_labels;
if (input_element) { if (input_element) {
GetDataListSuggestions(*input_element, &data_list_values, GetDataListSuggestions(*input_element, &data_list_values,
&data_list_labels); &data_list_labels);
@ -182,13 +182,13 @@ void AutofillAgent::HidePopup() {
} }
void AutofillAgent::ShowPopup(const blink::WebFormControlElement& element, void AutofillAgent::ShowPopup(const blink::WebFormControlElement& element,
const std::vector<base::string16>& values, const std::vector<std::u16string>& values,
const std::vector<base::string16>& labels) { const std::vector<std::u16string>& labels) {
gfx::RectF bounds = render_frame()->ElementBoundsInWindow(element); gfx::RectF bounds = render_frame()->ElementBoundsInWindow(element);
GetAutofillDriver()->ShowAutofillPopup(bounds, values, labels); 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(); auto element = render_frame()->GetWebFrame()->GetDocument().FocusedElement();
if (element.IsFormControlElement()) { if (element.IsFormControlElement()) {
ToWebInputElement(&element)->SetAutofillValue( ToWebInputElement(&element)->SetAutofillValue(

View file

@ -58,13 +58,13 @@ class AutofillAgent : public content::RenderFrameObserver,
void DataListOptionsChanged(const blink::WebInputElement&) override; void DataListOptionsChanged(const blink::WebInputElement&) override;
// mojom::ElectronAutofillAgent // mojom::ElectronAutofillAgent
void AcceptDataListSuggestion(const base::string16& suggestion) override; void AcceptDataListSuggestion(const std::u16string& suggestion) override;
bool IsUserGesture() const; bool IsUserGesture() const;
void HidePopup(); void HidePopup();
void ShowPopup(const blink::WebFormControlElement&, void ShowPopup(const blink::WebFormControlElement&,
const std::vector<base::string16>&, const std::vector<std::u16string>&,
const std::vector<base::string16>&); const std::vector<std::u16string>&);
void ShowSuggestions(const blink::WebFormControlElement& element, void ShowSuggestions(const blink::WebFormControlElement& element,
const ShowSuggestionsOptions& options); const ShowSuggestionsOptions& options);

View file

@ -218,7 +218,7 @@ void RendererClientBase::RenderThreadStarted() {
#if defined(OS_WIN) #if defined(OS_WIN)
// Set ApplicationUserModelID in renderer process. // Set ApplicationUserModelID in renderer process.
base::string16 app_id = std::u16string app_id =
command_line->GetSwitchValueNative(switches::kAppUserModelId); command_line->GetSwitchValueNative(switches::kAppUserModelId);
if (!app_id.empty()) { if (!app_id.empty()) {
SetCurrentProcessExplicitAppUserModelID(app_id.c_str()); SetCurrentProcessExplicitAppUserModelID(app_id.c_str());