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

https://chromium-review.googlesource.com/c/chromium/src/+/2757472
This commit is contained in:
John Kleinschmidt 2021-03-16 12:18:45 -04:00
Родитель 86d23cee40
Коммит 22d8f22cfb
100 изменённых файлов: 417 добавлений и 417 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -161,7 +161,7 @@ ElectronContentClient::ElectronContentClient() = default;
ElectronContentClient::~ElectronContentClient() = default;
base::string16 ElectronContentClient::GetLocalizedString(int message_id) {
std::u16string ElectronContentClient::GetLocalizedString(int message_id) {
return l10n_util::GetStringUTF16(message_id);
}

Просмотреть файл

@ -21,7 +21,7 @@ class ElectronContentClient : public content::ContentClient {
protected:
// content::ContentClient:
base::string16 GetLocalizedString(int message_id) override;
std::u16string GetLocalizedString(int message_id) override;
base::StringPiece GetDataResource(int resource_id, ui::ScaleFactor) override;
gfx::Image& GetNativeImageNamed(int resource_id) override;
base::RefCountedMemory* GetDataResourceBytes(int resource_id) override;

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -163,7 +163,7 @@ base::OnceClosure Menu::BindSelfToClosure(base::OnceClosure callback) {
void Menu::InsertItemAt(int index,
int command_id,
const base::string16& label) {
const std::u16string& label) {
model_->InsertItemAt(index, command_id, label);
}
@ -173,20 +173,20 @@ void Menu::InsertSeparatorAt(int index) {
void Menu::InsertCheckItemAt(int index,
int command_id,
const base::string16& label) {
const std::u16string& label) {
model_->InsertCheckItemAt(index, command_id, label);
}
void Menu::InsertRadioItemAt(int index,
int command_id,
const base::string16& label,
const std::u16string& label,
int group_id) {
model_->InsertRadioItemAt(index, command_id, label, group_id);
}
void Menu::InsertSubMenuAt(int index,
int command_id,
const base::string16& label,
const std::u16string& label,
Menu* menu) {
menu->parent_ = this;
model_->InsertSubMenuAt(index, command_id, label, menu->model_.get());
@ -196,15 +196,15 @@ void Menu::SetIcon(int index, const gfx::Image& image) {
model_->SetIcon(index, ui::ImageModel::FromImage(image));
}
void Menu::SetSublabel(int index, const base::string16& sublabel) {
void Menu::SetSublabel(int index, const std::u16string& sublabel) {
model_->SetSecondaryLabel(index, sublabel);
}
void Menu::SetToolTip(int index, const base::string16& toolTip) {
void Menu::SetToolTip(int index, const std::u16string& toolTip) {
model_->SetToolTip(index, toolTip);
}
void Menu::SetRole(int index, const base::string16& role) {
void Menu::SetRole(int index, const std::u16string& role) {
model_->SetRole(index, role);
}
@ -224,19 +224,19 @@ int Menu::GetCommandIdAt(int index) const {
return model_->GetCommandIdAt(index);
}
base::string16 Menu::GetLabelAt(int index) const {
std::u16string Menu::GetLabelAt(int index) const {
return model_->GetLabelAt(index);
}
base::string16 Menu::GetSublabelAt(int index) const {
std::u16string Menu::GetSublabelAt(int index) const {
return model_->GetSecondaryLabelAt(index);
}
base::string16 Menu::GetToolTipAt(int index) const {
std::u16string Menu::GetToolTipAt(int index) const {
return model_->GetToolTipAt(index);
}
base::string16 Menu::GetAcceleratorTextAt(int index) const {
std::u16string Menu::GetAcceleratorTextAt(int index) const {
ui::Accelerator accelerator;
model_->GetAcceleratorAtWithParams(index, true, &accelerator);
return accelerator.GetShortcutText();

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -920,7 +920,7 @@ ElectronBrowserClient::CreateWindowForPictureInPicture(
content::PictureInPictureWindowController* controller) {
auto overlay_window = content::OverlayWindow::Create(controller);
#if defined(OS_WIN)
base::string16 app_user_model_id = Browser::Get()->GetAppUserModelID();
std::u16string app_user_model_id = Browser::Get()->GetAppUserModelID();
if (!app_user_model_id.empty()) {
auto* overlay_window_view =
static_cast<OverlayWindowViews*>(overlay_window.get());

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -28,7 +28,7 @@ class NativeWindowObserver : public base::CheckedObserver {
~NativeWindowObserver() override {}
// Called when the web page in window wants to create a popup window.
virtual void WillCreatePopupWindow(const base::string16& frame_name,
virtual void WillCreatePopupWindow(const std::u16string& frame_name,
const GURL& target_url,
const std::string& partition_id,
WindowOpenDisposition disposition) {}

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -56,7 +56,7 @@ void ShowMessageBox(const MessageBoxSettings& settings,
// Like ShowMessageBox with simplest settings, but safe to call at very early
// stage of application.
void ShowErrorBox(const base::string16& title, const base::string16& content);
void ShowErrorBox(const std::u16string& title, const std::u16string& content);
} // namespace electron

Просмотреть файл

@ -220,7 +220,7 @@ void ShowMessageBox(const MessageBoxSettings& settings,
(new GtkMessageBox(settings))->RunAsynchronous(std::move(callback));
}
void ShowErrorBox(const base::string16& title, const base::string16& content) {
void ShowErrorBox(const std::u16string& title, const std::u16string& content) {
if (Browser::Get()->is_ready()) {
electron::MessageBoxSettings settings;
settings.type = electron::MessageBoxType::kError;

Просмотреть файл

@ -146,7 +146,7 @@ void ShowMessageBox(const MessageBoxSettings& settings,
}
}
void ShowErrorBox(const base::string16& title, const base::string16& content) {
void ShowErrorBox(const std::u16string& title, const std::u16string& content) {
NSAlert* alert = [[NSAlert alloc] init];
[alert setMessageText:base::SysUTF16ToNSString(title)];
[alert setInformativeText:base::SysUTF16ToNSString(content)];

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -297,7 +297,7 @@ void GlobalMenuBarX11::RegisterAccelerator(DbusmenuMenuitem* item,
NOTIMPLEMENTED();
return;
}
std::string name = base::UTF16ToUTF8(base::string16(1, keysym));
std::string name = base::UTF16ToUTF8(std::u16string(1, keysym));
g_variant_builder_add(&builder, "s", name.c_str());
GVariant* inside_array = g_variant_builder_end(&builder);

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -46,7 +46,7 @@ class MenuDelegate : public views::MenuDelegate {
bool IsTriggerableEvent(views::MenuItemView* source,
const ui::Event& e) override;
bool GetAccelerator(int id, ui::Accelerator* accelerator) const override;
base::string16 GetLabel(int id) const override;
std::u16string GetLabel(int id) const override;
void GetLabelStyle(int id, LabelStyle* style) const override;
bool IsCommandEnabled(int id) const override;
bool IsCommandVisible(int id) const override;

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -158,7 +158,7 @@ JumpListCategory::JumpListCategory() = default;
JumpListCategory::JumpListCategory(const JumpListCategory&) = default;
JumpListCategory::~JumpListCategory() = default;
JumpList::JumpList(const base::string16& app_id) : app_id_(app_id) {
JumpList::JumpList(const std::u16string& app_id) : app_id_(app_id) {
destinations_.CoCreateInstance(CLSID_DestinationList);
}

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -17,7 +17,7 @@
namespace electron {
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
// returns the full list of language preferences.
@ -33,7 +33,7 @@ std::vector<std::string> GetPreferredLanguages() {
}
bool GetPreferredLanguagesUsingGlobalization(
std::vector<base::string16>* languages) {
std::vector<std::u16string>* languages) {
if (base::win::GetVersion() < base::win::Version::WIN10)
return false;
if (!base::win::ResolveCoreWinRTDelayload() ||

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -69,18 +69,18 @@ class SpellCheckClient : public blink::WebSpellCheckPanelHostClient,
// The javascript function will callback OnSpellCheckDone
// with the results of all the misspelled words.
void SpellCheckWords(const SpellCheckScope& scope,
const std::set<base::string16>& words);
const std::set<std::u16string>& words);
// Returns whether or not the given word is a contraction of valid words
// (e.g. "word:word").
// Output variable contraction_words will contain individual
// words in the contraction.
bool IsContraction(const SpellCheckScope& scope,
const base::string16& word,
std::vector<base::string16>* contraction_words);
const std::u16string& word,
std::vector<std::u16string>* contraction_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
// are not supported by this SpellCheck object.

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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