chore: bump chromium to 91.0.4448.0 (master) (#28009)

* chore: bump chromium in DEPS to 91.0.4435.3

* build: add 'use_rts' definition

Refs: 2694187

* chore: update patches

* chore: media_internal_resources becomes resources

Refs: 2699022

* chore: update patches

* refactor: extensions::ViewType moved to mojom

Refs: 2710351

* chore: might_have_observers has been removed

Refs: 2667839

* refactor: CertVerifier is not in the network namespace anymore

Refs: 2689805

* refactor: ExtensionUserScriptManager is now UserScriptManager

Refs: 2657617

* refactor: content::SiteInstance::GetSiteForURL was removed

Refs: 2680274

* refactor: MenuItemType was moved to mojom

Refs: 2071443

* refactor: extensions::ViewType was moved to mojom

Refs: 2710351

* refacotr: grit::ResourceMap replaced with webui::ResourcePath

Refs: 2685601

* refactor: blink::MenuItem::Type was moved to mojom

Refs: 2071443

* refactor: CreateDataPipe deprecated form was removed

Refs: 2698090

* refactor: DesktopMediaList::Type replaces content::DesktopMediaType_*

Refs: 2700637

* chore: wire up activation_time in OSR

Refs: 2638372

* chore: remove deleted file from chromium_src list

* chore: fix lint

* update patches

* chore: bump chromium in DEPS to 91.0.4438.0

* chore: bump chromium in DEPS to 91.0.4439.0

* chore: bump chromium in DEPS to 91.0.4440.0

* chore: bump chromium in DEPS to 91.0.4441.0

* chore: bump chromium in DEPS to 91.0.4442.0

* chore: bump chromium in DEPS to 91.0.4443.0

* chore: bump chromium in DEPS to 91.0.4445.0

* chore: bump chromium in DEPS to 91.0.4446.0

* chore: update patches

* fixup gn check

* Merge branch 'master' into roller/chromium/master

* update to xcode 12.4.0

Needed because of 8008deb41c

* 2752406: [LSC] Replace base::string16 with std::u16string in //ui

2752406

* 2752406: [LSC] Replace base::string16 with std::u16string in //ui

2752406

* 2752932: Associate each AwProxyingURLLoaderFactory with a frame tree node id.

2752932

* 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer.

2651385

* 2734095: Introduce StoragePartitionId type to wrap current string representation.

2734095

* chore: bump chromium in DEPS to 91.0.4448.0

* Update patches

* 2743594: Remove WebSize from blink.

2743594

* 2725403: Add URLLoaderClient::OnReceiveEarlyHints()

2725403

* 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer.

2651385

* 2721718: Move HostID to extensions::mojom::HostID

2721718

* 2733070: Rename observer to URLLoaderNetworkServiceObserver

2733070

* Use nogncheck for content/browser/site_instance_impl.h

This is needed because  //content/browser:browser is not a visible target

* 2648046: Introduce alert notification helper .app

2648046

* 2752406: [LSC] Replace base::string16 with std::u16string in //ui

2752406

* only include mac notifications on mac

* add additional skipping of atk toolchain check

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

2757472

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

2757472

* 2720306: [api] Remove deprecated [Shared]ArrayBuffer API

2720306

* Fixup 2721718: Move HostID to extensions::mojom::HostID

* fixup 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer

* Fixup 2752406: [LSC] Replace base::string16 with std::u16string in //ui

* Fixup 2725403: Add URLLoaderClient::OnReceiveEarlyHints()

* update node headers

* chore: bump chromium in DEPS to 91.0.4449.0

* Revert "chore: bump chromium in DEPS to 91.0.4449.0"

This reverts commit bccafa0289.

* 2693008: Fix loading non-system cursors on Windows on browser_tests

2693008

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

2757472

* undo changes to WebContentsPreferences::GetPreloadPath to fix mac build

* fix StrCat issue

* incantations for WebContentsPreferences::GetPreloadPath wide strings

* bump nan

* fix GetAsString maybe?

* windows build fixes

* more windows build fix

* SetAppUserModelID -> wstring

* upgrade nan dep in tests

* lint

* wstrings are cross-platform

* linter

* only bind setAppUserModelId on windows

* fix a messed up merge

* well that was an odyssey

* backport fcdf35e from v8 to fix nan crash

* disable typedarrays-test.js

* don't defer in NSWindow creation

2707696

* use PartitionAllocator for ArrayBuffers in the main process

* fix patches

* chore: omit some unnecessary conversions

* refactor: make LoginItemSettings::path a wstring

* refactor: make ShowTaskDialog take a wstr

* Revert "refactor: make LoginItemSettings::path a wstring"

This reverts commit 9127cff58b.

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
Electron Bot 2021-03-30 19:17:09 -07:00 committed by GitHub
parent 6016e244fa
commit a006cf681b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
233 changed files with 1586 additions and 1469 deletions

View file

@ -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);
}

View file

@ -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;

View file

@ -33,6 +33,10 @@
#include "base/debug/dump_without_crashing.h"
#endif
#if defined(OS_WIN)
#include "base/strings/string_util_win.h"
#endif
namespace {
ElectronCrashReporterClient* Instance() {
@ -130,8 +134,8 @@ void ElectronCrashReporterClient::GetProductNameAndVersion(
std::wstring* version,
std::wstring* special_build,
std::wstring* channel_name) {
*product_name = base::UTF8ToUTF16(ELECTRON_PRODUCT_NAME);
*version = base::UTF8ToUTF16(ELECTRON_VERSION_STRING);
*product_name = base::UTF8ToWide(ELECTRON_PRODUCT_NAME);
*version = base::UTF8ToWide(ELECTRON_VERSION_STRING);
}
#endif

View file

@ -66,7 +66,7 @@ void SetNodeCliFlags() {
for (const auto& arg : argv) {
#if defined(OS_WIN)
const auto& option = base::UTF16ToUTF8(arg);
const auto& option = base::WideToUTF8(arg);
#else
const auto& option = arg;
#endif

View file

@ -0,0 +1,26 @@
enum RecordingMode { "record-until-full", "record-continuously", "record-as-much-as-possible", "trace-to-console" };
dictionary TraceConfig {
Recordingmode recording_mode;
unsigned long trace_buffer_size_in_kb;
unsigned long trace_buffer_size_in_events;
boolean enable_argument_filter;
sequence<DOMString> included_categories;
sequence<DOMString> excluded_categories;
sequence<unsigned short> included_process_ids;
sequence<DOMString> histogram_names;
object memory_dump_config;
};
dictionary TraceCategoriesAndOptions {
DOMString categoryFilter;
DOMString traceOptions;
};
interface ContentTracing {
Promise<sequence<DOMString>> getCategories();
Promise<void> startRecording(TraceConfig config);
Promise<void> startRecording(TraceCategoriesAndOptions categoriesAndOptions);
Promise<DOMString> stopRecording(optional DOMString resultFilePath);
Promise<TraceBufferUsage> getTraceBufferUsage();
};

View file

@ -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;
@ -1553,8 +1553,10 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
base::BindRepeating(&Browser::AddRecentDocument, browser))
.SetMethod("clearRecentDocuments",
base::BindRepeating(&Browser::ClearRecentDocuments, browser))
#if defined(OS_WIN)
.SetMethod("setAppUserModelId",
base::BindRepeating(&Browser::SetAppUserModelID, browser))
#endif
.SetMethod(
"isDefaultProtocolClient",
base::BindRepeating(&Browser::IsDefaultProtocolClient, browser))

View file

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

View file

@ -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();

View file

@ -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;

View file

@ -175,7 +175,7 @@ void Start(const std::string& submit_url,
base::PathService::Get(DIR_USER_DATA, &user_data_dir);
::crash_reporter::InitializeCrashpadWithEmbeddedHandler(
process_type.empty(), process_type,
base::UTF16ToUTF8(user_data_dir.value()), base::FilePath());
base::WideToUTF8(user_data_dir.value()), base::FilePath());
#endif
#endif
}

View file

@ -96,7 +96,7 @@ void DesktopCapturer::StartHandling(bool capture_window,
// Apply the new thumbnail size and restart capture.
if (capture_window) {
window_capturer_ = std::make_unique<NativeDesktopMediaList>(
content::DesktopMediaID::TYPE_WINDOW,
DesktopMediaList::Type::kWindow,
content::desktop_capture::CreateWindowCapturer());
window_capturer_->SetThumbnailSize(thumbnail_size);
window_capturer_->AddObserver(this);
@ -107,7 +107,7 @@ void DesktopCapturer::StartHandling(bool capture_window,
if (capture_screen) {
screen_capturer_ = std::make_unique<NativeDesktopMediaList>(
content::DesktopMediaID::TYPE_SCREEN,
DesktopMediaList::Type::kScreen,
content::desktop_capture::CreateScreenCapturer());
screen_capturer_->SetThumbnailSize(thumbnail_size);
screen_capturer_->AddObserver(this);
@ -124,7 +124,7 @@ void DesktopCapturer::OnSourceUnchanged(DesktopMediaList* list) {
void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
if (capture_window_ &&
list->GetMediaListType() == content::DesktopMediaID::TYPE_WINDOW) {
list->GetMediaListType() == DesktopMediaList::Type::kWindow) {
capture_window_ = false;
const auto& media_list_sources = list->GetSources();
std::vector<DesktopCapturer::Source> window_sources;
@ -138,7 +138,7 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
}
if (capture_screen_ &&
list->GetMediaListType() == content::DesktopMediaID::TYPE_SCREEN) {
list->GetMediaListType() == DesktopMediaList::Type::kScreen) {
capture_screen_ = false;
const auto& media_list_sources = list->GetSources();
std::vector<DesktopCapturer::Source> screen_sources;

View file

@ -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();

View file

@ -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;

View file

@ -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;
}

View file

@ -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_;

View file

@ -344,7 +344,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;

View file

@ -157,6 +157,7 @@
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
#include "extensions/browser/script_executor.h"
#include "extensions/browser/view_type_utils.h"
#include "extensions/common/mojom/view_type.mojom.h"
#include "shell/browser/extensions/electron_extension_web_contents_observer.h"
#endif
@ -407,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));
@ -417,12 +418,12 @@ bool IsDeviceNameValid(const base::string16& device_name) {
return printer_exists;
#elif defined(OS_WIN)
printing::ScopedPrinterHandle printer;
return printer.OpenPrinterWithName(device_name.c_str());
return printer.OpenPrinterWithName(base::UTF16ToWide(device_name).c_str());
#endif
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.
@ -591,19 +592,19 @@ bool IsDevToolsFileSystemAdded(content::WebContents* web_contents,
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
WebContents::Type GetTypeFromViewType(extensions::ViewType view_type) {
WebContents::Type GetTypeFromViewType(extensions::mojom::ViewType view_type) {
switch (view_type) {
case extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE:
case extensions::mojom::ViewType::kExtensionBackgroundPage:
return WebContents::Type::kBackgroundPage;
case extensions::VIEW_TYPE_APP_WINDOW:
case extensions::VIEW_TYPE_COMPONENT:
case extensions::VIEW_TYPE_EXTENSION_DIALOG:
case extensions::VIEW_TYPE_EXTENSION_POPUP:
case extensions::VIEW_TYPE_BACKGROUND_CONTENTS:
case extensions::VIEW_TYPE_EXTENSION_GUEST:
case extensions::VIEW_TYPE_TAB_CONTENTS:
case extensions::VIEW_TYPE_INVALID:
case extensions::mojom::ViewType::kAppWindow:
case extensions::mojom::ViewType::kComponent:
case extensions::mojom::ViewType::kExtensionDialog:
case extensions::mojom::ViewType::kExtensionPopup:
case extensions::mojom::ViewType::kBackgroundContents:
case extensions::mojom::ViewType::kExtensionGuest:
case extensions::mojom::ViewType::kTabContents:
case extensions::mojom::ViewType::kInvalid:
return WebContents::Type::kRemote;
}
}
@ -625,8 +626,8 @@ WebContents::WebContents(v8::Isolate* isolate,
{
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
// WebContents created by extension host will have valid ViewType set.
extensions::ViewType view_type = extensions::GetViewType(web_contents);
if (view_type != extensions::VIEW_TYPE_INVALID) {
extensions::mojom::ViewType view_type = extensions::GetViewType(web_contents);
if (view_type != extensions::mojom::ViewType::kInvalid) {
InitWithExtensionView(isolate, web_contents, view_type);
}
@ -865,7 +866,7 @@ void WebContents::InitWithSessionAndOptions(
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
void WebContents::InitWithExtensionView(v8::Isolate* isolate,
content::WebContents* web_contents,
extensions::ViewType view_type) {
extensions::mojom::ViewType view_type) {
// Must reassign type prior to calling `Init`.
type_ = GetTypeFromViewType(view_type);
if (GetType() == Type::kRemote)
@ -958,9 +959,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);
}
@ -1036,7 +1037,7 @@ content::WebContents* WebContents::CreateCustomWebContents(
const GURL& opener_url,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
const content::StoragePartitionId& partition_id,
content::SessionStorageNamespace* session_storage_namespace) {
return nullptr;
}
@ -1717,7 +1718,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();
@ -1984,7 +1985,7 @@ GURL WebContents::GetURL() const {
return web_contents()->GetURL();
}
base::string16 WebContents::GetTitle() const {
std::u16string WebContents::GetTitle() const {
return web_contents()->GetTitle();
}
@ -2293,9 +2294,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()) {
@ -2304,7 +2305,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.
@ -2402,7 +2403,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())
@ -2571,16 +2572,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");

View file

@ -48,7 +48,7 @@
#endif
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
#include "extensions/common/view_type.h"
#include "extensions/common/mojom/view_type.mojom.h"
namespace extensions {
class ScriptExecutor;
@ -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();
@ -325,7 +325,7 @@ class WebContents : public gin::Wrappable<WebContents>,
}
void RemoveObserver(ExtendedWebContentsObserver* obs) {
// Trying to remove from an empty collection leads to an access violation
if (observers_.might_have_observers())
if (!observers_.empty())
observers_.RemoveObserver(obs);
}
@ -438,15 +438,15 @@ class WebContents : public gin::Wrappable<WebContents>,
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
void InitWithExtensionView(v8::Isolate* isolate,
content::WebContents* web_contents,
extensions::ViewType view_type);
extensions::mojom::ViewType view_type);
#endif
// 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,
@ -459,7 +459,7 @@ class WebContents : public gin::Wrappable<WebContents>,
const GURL& opener_url,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
const content::StoragePartitionId& partition_id,
content::SessionStorageNamespace* session_storage_namespace) override;
void WebContentsCreatedWithFullParams(
content::WebContents* source_contents,

View file

@ -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();

View file

@ -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,

View file

@ -12,7 +12,6 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/values.h"
#include "gin/dictionary.h"
@ -85,7 +84,7 @@ class Browser : public WindowListObserver {
void ClearRecentDocuments();
// Set the application user model ID.
void SetAppUserModelID(const base::string16& name);
void SetAppUserModelID(const std::wstring& name);
// Remove the default protocol handler registry key
bool RemoveAsDefaultProtocolClient(const std::string& protocol,
@ -99,7 +98,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 +112,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::wstring name;
std::wstring path;
std::wstring scope;
std::vector<std::wstring> args;
bool enabled = true;
LaunchItem();
@ -132,13 +131,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::wstring name;
// used in browser::getLoginItemSettings
bool executable_will_launch_at_login = false;
@ -238,9 +237,9 @@ class Browser : public WindowListObserver {
#if defined(OS_WIN)
struct UserTask {
base::FilePath program;
base::string16 arguments;
base::string16 title;
base::string16 description;
std::wstring arguments;
std::wstring title;
std::wstring description;
base::FilePath working_dir;
base::FilePath icon_path;
int icon_index;

View file

@ -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::wstring& 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()};

View file

@ -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::wstring& name) {}
bool Browser::SetBadgeCount(base::Optional<int> count) {
DockSetBadgeText(!count.has_value() || count.value() != 0

View file

@ -48,7 +48,7 @@ namespace electron {
namespace {
bool GetProcessExecPath(base::string16* exe) {
bool GetProcessExecPath(std::wstring* 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::wstring* exe) {
if (!args->GetNext(exe) && !GetProcessExecPath(exe)) {
return false;
}
// Read in optional args arg
std::vector<base::string16> launch_args;
std::vector<std::wstring> 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::wstring& scheme) {
if (scheme.empty())
return false;
base::win::RegKey cmd_key(HKEY_CLASSES_ROOT, scheme.c_str(), KEY_QUERY_VALUE);
@ -90,11 +90,10 @@ 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,
const GURL& url) {
const base::string16 url_scheme = base::ASCIIToUTF16(url.scheme());
std::wstring GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, const GURL& url) {
const std::wstring url_scheme = base::ASCIIToWide(url.scheme());
if (!IsValidCustomProtocol(url_scheme))
return base::string16();
return std::wstring();
wchar_t out_buffer[1024];
DWORD buffer_size = base::size(out_buffer);
@ -103,13 +102,13 @@ base::string16 GetAppInfoHelperForProtocol(ASSOCSTR assoc_str,
out_buffer, &buffer_size);
if (FAILED(hr)) {
DLOG(WARNING) << "AssocQueryString failed!";
return base::string16();
return std::wstring();
}
return base::string16(out_buffer);
return std::wstring(out_buffer);
}
void OnIconDataAvailable(const base::FilePath& app_path,
const base::string16& app_display_name,
const std::wstring& app_display_name,
gin_helper::Promise<gin_helper::Dictionary> promise,
gfx::Image icon) {
if (!icon.IsEmpty()) {
@ -126,21 +125,21 @@ void OnIconDataAvailable(const base::FilePath& app_path,
}
}
base::string16 GetAppDisplayNameForProtocol(const GURL& url) {
std::wstring GetAppDisplayNameForProtocol(const GURL& url) {
return GetAppInfoHelperForProtocol(ASSOCSTR_FRIENDLYAPPNAME, url);
}
base::string16 GetAppPathForProtocol(const GURL& url) {
std::wstring 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::wstring GetAppForProtocolUsingRegistry(const GURL& url) {
const std::wstring url_scheme = base::ASCIIToWide(url.scheme());
if (!IsValidCustomProtocol(url_scheme))
return base::string16();
return std::wstring();
// First, try and extract the application's display name.
base::string16 command_to_launch;
std::wstring 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 +149,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::wstring 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,18 +158,20 @@ base::string16 GetAppForProtocolUsingRegistry(const GURL& url) {
return command_line.GetProgram().BaseName().value();
}
return base::string16();
return std::wstring();
}
bool FormatCommandLineString(base::string16* exe,
const std::vector<base::string16>& launch_args) {
bool FormatCommandLineString(std::wstring* exe,
const std::vector<std::u16string>& launch_args) {
if (exe->empty() && !GetProcessExecPath(exe)) {
return false;
}
if (!launch_args.empty()) {
std::u16string joined_launch_args =
base::JoinString(launch_args, base::UTF8ToUTF16(" "));
*exe = base::StringPrintf(L"%ls %ls", exe->c_str(),
base::JoinString(launch_args, L" ").c_str());
base::UTF16ToWide(joined_launch_args).c_str());
}
return true;
@ -184,18 +185,20 @@ bool FormatCommandLineString(base::string16* exe,
std::vector<Browser::LaunchItem> GetLoginItemSettingsHelper(
base::win::RegistryValueIterator* it,
boolean* executable_will_launch_at_login,
base::string16 scope,
std::wstring 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::wstring process_exe_path;
GetProcessExecPath(&process_exe_path);
lookup_exe_path =
base::CommandLine::FromString(process_exe_path).GetProgram();
} else {
lookup_exe_path = base::CommandLine::FromString(options.path).GetProgram();
lookup_exe_path =
base::CommandLine::FromString(base::UTF16ToWide(options.path))
.GetProgram();
}
if (!lookup_exe_path.empty()) {
@ -287,7 +290,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::wstring 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 +319,13 @@ void GetApplicationInfoForProtocolUsingRegistry(
base::CancelableTaskTracker* cancelable_task_tracker_) {
base::FilePath app_path;
const base::string16 url_scheme = base::ASCIIToUTF16(url.scheme());
const std::wstring url_scheme = base::ASCIIToWide(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::wstring command_to_launch;
const std::wstring 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 +337,7 @@ void GetApplicationInfoForProtocolUsingRegistry(
"Unable to retrieve installation path to app");
return;
}
const base::string16 app_display_name = GetAppForProtocolUsingRegistry(url);
const std::wstring app_display_name = GetAppForProtocolUsingRegistry(url);
if (app_display_name.empty()) {
promise.RejectWithErrorMessage(
@ -354,7 +357,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::wstring app_path = GetAppPathForProtocol(url);
if (app_path.empty()) {
promise.RejectWithErrorMessage(
@ -362,7 +365,7 @@ void GetApplicationInfoForProtocolUsingAssocQuery(
return;
}
base::string16 app_display_name = GetAppDisplayNameForProtocol(url);
std::wstring app_display_name = GetAppDisplayNameForProtocol(url);
if (app_display_name.empty()) {
promise.RejectWithErrorMessage("Unable to retrieve display name of app");
@ -390,7 +393,7 @@ void Browser::ClearRecentDocuments() {
SHAddToRecentDocs(SHARD_APPIDINFO, nullptr);
}
void Browser::SetAppUserModelID(const base::string16& name) {
void Browser::SetAppUserModelID(const std::wstring& name) {
electron::SetAppUserModelID(name);
}
@ -426,12 +429,12 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol,
// Main Registry Key
HKEY root = HKEY_CURRENT_USER;
base::string16 keyPath = L"Software\\Classes\\";
std::wstring 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::wstring wprotocol = base::UTF8ToWide(protocol);
std::wstring shellPath = wprotocol + L"\\shell";
std::wstring cmdPath = keyPath + shellPath + L"\\open\\command";
base::win::RegKey classesKey;
base::win::RegKey commandKey;
@ -445,12 +448,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::wstring 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::wstring exe;
if (!GetProtocolLaunchPath(args, &exe))
return false;
@ -461,7 +464,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol,
// Let's clean up after ourselves
base::win::RegKey protocolKey;
base::string16 protocolPath = keyPath + wprotocol;
std::wstring protocolPath = keyPath + wprotocol;
if (SUCCEEDED(
protocolKey.Open(root, protocolPath.c_str(), KEY_ALL_ACCESS))) {
@ -500,17 +503,17 @@ bool Browser::SetAsDefaultProtocolClient(const std::string& protocol,
if (protocol.empty())
return false;
base::string16 exe;
std::wstring 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::wstring keyPath = base::UTF8ToWide("Software\\Classes\\" + protocol);
std::wstring urlDecl = base::UTF8ToWide("URL:" + protocol);
// Command Key
base::string16 cmdPath = keyPath + L"\\shell\\open\\command";
std::wstring cmdPath = keyPath + L"\\shell\\open\\command";
// Write information to registry
base::win::RegKey key(root, keyPath.c_str(), KEY_ALL_ACCESS);
@ -530,16 +533,16 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol,
if (protocol.empty())
return false;
base::string16 exe;
std::wstring exe;
if (!GetProtocolLaunchPath(args, &exe))
return false;
// Main Registry Key
HKEY root = HKEY_CURRENT_USER;
base::string16 keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol);
std::wstring keyPath = base::UTF8ToWide("Software\\Classes\\" + protocol);
// Command Key
base::string16 cmdPath = keyPath + L"\\shell\\open\\command";
std::wstring cmdPath = keyPath + L"\\shell\\open\\command";
base::win::RegKey key;
base::win::RegKey commandKey;
@ -551,7 +554,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::wstring keyVal;
if (FAILED(commandKey.ReadValue(L"", &keyVal)))
// Default value not set, we can confirm that it is not set
return false;
@ -560,15 +563,15 @@ 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::wstring application_name = GetAppDisplayNameForProtocol(url);
if (!application_name.empty())
return application_name;
return base::WideToUTF16(application_name);
}
return GetAppForProtocolUsingRegistry(url);
return base::WideToUTF16(GetAppForProtocolUsingRegistry(url));
}
v8::Local<v8::Promise> Browser::GetApplicationInfoForProtocol(
@ -686,11 +689,10 @@ void Browser::UpdateBadgeContents(
}
void Browser::SetLoginItemSettings(LoginItemSettings settings) {
base::string16 key_path =
L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
std::wstring 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::wstring startup_approved_key_path =
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApproved"
L"\\Run";
base::win::RegKey startup_approved_key(
@ -699,7 +701,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::wstring exe = base::UTF16ToWide(settings.path);
if (FormatCommandLineString(&exe, settings.args)) {
key.WriteValue(key_name, exe.c_str());
@ -732,13 +734,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::wstring keyPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
base::win::RegKey key(HKEY_CURRENT_USER, keyPath.c_str(), KEY_ALL_ACCESS);
base::string16 keyVal;
std::wstring keyVal;
// keep old openAtLogin behaviour
if (!FAILED(key.ReadValue(GetAppUserModelID(), &keyVal))) {
base::string16 exe = options.path;
std::wstring exe = base::UTF16ToWide(options.path);
if (FormatCommandLineString(&exe, options.args)) {
settings.open_at_login = keyVal == exe;
}

View file

@ -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(

View file

@ -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:

View file

@ -30,6 +30,7 @@
#include "chrome/common/chrome_version.h"
#include "components/net_log/chrome_net_log.h"
#include "components/network_hints/common/network_hints.mojom.h"
#include "content/browser/site_instance_impl.h" // nogncheck
#include "content/public/browser/browser_main_runner.h"
#include "content/public/browser/browser_ppapi_host.h"
#include "content/public/browser/browser_task_traits.h"
@ -195,6 +196,14 @@ namespace {
// Next navigation should not restart renderer process.
bool g_suppress_renderer_process_restart = false;
// c.f. https://chromium-review.googlesource.com/c/chromium/src/+/2680274
content::SiteInfo GetSiteForURL(content::BrowserContext* browser_context,
const GURL& url) {
return content::SiteInfo::Create(
content::IsolationContext(browser_context), content::UrlInfo(url, false),
content::CoopCoepCrossOriginIsolatedInfo::CreateNonIsolated());
}
bool IsSameWebSite(content::BrowserContext* browser_context,
content::SiteInstance* site_instance,
const GURL& dest_url) {
@ -202,7 +211,7 @@ bool IsSameWebSite(content::BrowserContext* browser_context,
// `IsSameSiteWithURL` doesn't seem to work for some URIs such as
// `file:`, handle these scenarios by comparing only the site as
// defined by `GetSiteForURL`.
(content::SiteInstance::GetSiteForURL(browser_context, dest_url) ==
(GetSiteForURL(browser_context, dest_url).site_url() ==
site_instance->GetSiteURL());
}
@ -499,7 +508,7 @@ content::SiteInstance* ElectronBrowserClient::GetSiteInstanceFromAffinity(
std::string affinity = GetAffinityPreference(rfh);
if (!affinity.empty()) {
auto iter = site_per_affinities_.find(affinity);
GURL dest_site = content::SiteInstance::GetSiteForURL(browser_context, url);
GURL dest_site = GetSiteForURL(browser_context, url).site_url();
if (iter != site_per_affinities_.end() &&
IsSameWebSite(browser_context, iter->second, dest_site)) {
return iter->second;
@ -911,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::wstring app_user_model_id = Browser::Get()->GetAppUserModelID();
if (!app_user_model_id.empty()) {
auto* overlay_window_view =
static_cast<OverlayWindowViews*>(overlay_window.get());
@ -1068,7 +1077,8 @@ void ElectronBrowserClient::ConfigureNetworkContextParams(
bool in_memory,
const base::FilePath& relative_partition_path,
network::mojom::NetworkContextParams* network_context_params,
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) {
cert_verifier::mojom::CertVerifierCreationParams*
cert_verifier_creation_params) {
DCHECK(browser_context);
return NetworkContextServiceFactory::GetForContext(browser_context)
->ConfigureNetworkContextParams(network_context_params,
@ -1161,6 +1171,7 @@ bool ElectronBrowserClient::HandleExternalProtocol(
const GURL& url,
content::WebContents::OnceGetter web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,

View file

@ -167,8 +167,8 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
bool in_memory,
const base::FilePath& relative_partition_path,
network::mojom::NetworkContextParams* network_context_params,
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params)
override;
cert_verifier::mojom::CertVerifierCreationParams*
cert_verifier_creation_params) override;
network::mojom::NetworkContext* GetSystemNetworkContext() override;
content::MediaObserver* GetMediaObserver() override;
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
@ -239,6 +239,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
const GURL& url,
content::WebContents::OnceGetter web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,

View file

@ -108,9 +108,7 @@ ElectronBrowserContext::ElectronBrowserContext(const std::string& partition,
: storage_policy_(new SpecialStoragePolicy),
protocol_registry_(new ProtocolRegistry),
in_memory_(in_memory),
ssl_config_(network::mojom::SSLConfig::New()),
shared_cors_origin_access_list_(
content::SharedCorsOriginAccessList::Create()) {
ssl_config_(network::mojom::SSLConfig::New()) {
user_agent_ = ElectronBrowserClient::Get()->GetUserAgent();
// Read options.
@ -354,8 +352,8 @@ ElectronBrowserContext::GetURLLoaderFactory() {
auto* storage_partition =
content::BrowserContext::GetDefaultStoragePartition(this);
params->auth_cert_observer =
storage_partition->CreateAuthAndCertObserverForNavigationRequest(-1);
params->url_loader_network_observer =
storage_partition->CreateURLLoaderNetworkObserverForNavigationRequest(-1);
storage_partition->GetNetworkContext()->CreateURLLoaderFactory(
std::move(factory_receiver), std::move(params));
url_loader_factory_ =
@ -433,34 +431,6 @@ ElectronBrowserContext::GetStorageNotificationService() {
return nullptr;
}
void ElectronBrowserContext::SetCorsOriginAccessListForOrigin(
TargetBrowserContexts target_mode,
const url::Origin& source_origin,
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
base::OnceClosure closure) {
using content::CorsOriginPatternSetter;
// We ignore target_mode because we don't support extensions in in-memory
// sessions.
auto barrier_closure = BarrierClosure(2, std::move(closure));
base::MakeRefCounted<CorsOriginPatternSetter>(
source_origin, CorsOriginPatternSetter::ClonePatterns(allow_patterns),
CorsOriginPatternSetter::ClonePatterns(block_patterns), barrier_closure)
->ApplyToEachStoragePartition(this);
// Keep the per-profile access list up to date so that we can use this to
// restore NetworkContext settings at anytime, e.g. on restarting the
// network service.
shared_cors_origin_access_list_->SetForOrigin(
source_origin, std::move(allow_patterns), std::move(block_patterns),
barrier_closure);
}
content::SharedCorsOriginAccessList*
ElectronBrowserContext::GetSharedCorsOriginAccessList() {
return shared_cors_origin_access_list_.get();
}
ResolveProxyHelper* ElectronBrowserContext::GetResolveProxyHelper() {
if (!resolve_proxy_helper_) {
resolve_proxy_helper_ = base::MakeRefCounted<ResolveProxyHelper>(this);

View file

@ -113,15 +113,6 @@ class ElectronBrowserContext
override;
content::StorageNotificationService* GetStorageNotificationService() override;
// extensions deps
void SetCorsOriginAccessListForOrigin(
TargetBrowserContexts target_mode,
const url::Origin& source_origin,
std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
base::OnceClosure closure) override;
content::SharedCorsOriginAccessList* GetSharedCorsOriginAccessList() override;
CookieChangeNotifier* cookie_change_notifier() const {
return cookie_change_notifier_.get();
}
@ -199,9 +190,6 @@ class ElectronBrowserContext
network::mojom::SSLConfigPtr ssl_config_;
mojo::Remote<network::mojom::SSLConfigClient> ssl_config_client_;
scoped_refptr<content::SharedCorsOriginAccessList>
shared_cors_origin_access_list_;
base::WeakPtrFactory<ElectronBrowserContext> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserContext);

View file

@ -86,7 +86,6 @@
#endif
#if defined(OS_WIN)
#include "ui/base/cursor/win/win_cursor_factory.h"
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/display/win/dpi.h"
#include "ui/gfx/system_fonts_win.h"
@ -142,7 +141,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 +150,7 @@ base::string16 MediaStringProvider(media::MessageId id) {
return base::ASCIIToUTF16("Communications");
#endif
default:
return base::string16();
return std::u16string();
}
}
@ -408,10 +407,6 @@ void ElectronBrowserMainParts::ToolkitInitialized() {
#if defined(OS_WIN)
gfx::win::SetAdjustFontCallback(&AdjustUIFont);
gfx::win::SetGetMinimumFontSizeCallback(&GetMinimumFontSize);
wchar_t module_name[MAX_PATH] = {0};
if (GetModuleFileName(NULL, module_name, base::size(module_name)))
ui::SetCursorResourceModule(module_name);
#endif
#if defined(OS_MAC)

View file

@ -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

View file

@ -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,

View file

@ -8,7 +8,6 @@
#include <vector>
#include "base/observer_list.h"
#include "base/strings/string16.h"
#include "electron/shell/common/api/api.mojom.h"
#include "ui/gfx/geometry/rect.h"
@ -23,7 +22,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() {}

View file

@ -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()

View file

@ -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;

View file

@ -10,6 +10,7 @@
#include "extensions/browser/extension_api_frame_id_map.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/mojom/host_id.mojom.h"
#include "extensions/common/permissions/permissions_data.h"
#include "shell/browser/api/electron_api_web_contents.h"
#include "shell/browser/web_contents_zoom_controller.h"
@ -84,7 +85,8 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
execute_tab_id_ = tab_id;
details_ = std::move(details);
set_host_id(HostID(HostID::EXTENSIONS, extension()->id()));
set_host_id(
mojom::HostID(mojom::HostID::HostType::kExtensions, extension()->id()));
return set_init_result(SUCCESS);
}

View file

@ -82,7 +82,7 @@ ElectronComponentExtensionResourceManager::GetTemplateReplacementsForExtension(
}
void ElectronComponentExtensionResourceManager::AddComponentResourceEntries(
const GritResourceMap* entries,
const webui::ResourcePath* entries,
size_t size) {
base::FilePath gen_folder_path = base::FilePath().AppendASCII(
"@out_folder@/gen/chrome/browser/resources/");
@ -90,12 +90,12 @@ void ElectronComponentExtensionResourceManager::AddComponentResourceEntries(
for (size_t i = 0; i < size; ++i) {
base::FilePath resource_path =
base::FilePath().AppendASCII(entries[i].name);
base::FilePath().AppendASCII(entries[i].path);
resource_path = resource_path.NormalizePathSeparators();
if (!gen_folder_path.IsParent(resource_path)) {
DCHECK(!base::Contains(path_to_resource_id_, resource_path));
path_to_resource_id_[resource_path] = entries[i].value;
path_to_resource_id_[resource_path] = entries[i].id;
} else {
// If the resource is a generated file, strip the generated folder's path,
// so that it can be served from a normal URL (as if it were not
@ -104,7 +104,7 @@ void ElectronComponentExtensionResourceManager::AddComponentResourceEntries(
base::FilePath().AppendASCII(resource_path.AsUTF8Unsafe().substr(
gen_folder_path.value().length()));
DCHECK(!base::Contains(path_to_resource_id_, effective_path));
path_to_resource_id_[effective_path] = entries[i].value;
path_to_resource_id_[effective_path] = entries[i].id;
}
}
}

View file

@ -13,6 +13,7 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "extensions/browser/component_extension_resource_manager.h"
#include "ui/base/webui/resource_path.h"
struct GritResourceMap;
@ -32,7 +33,8 @@ class ElectronComponentExtensionResourceManager
const std::string& extension_id) const override;
private:
void AddComponentResourceEntries(const GritResourceMap* entries, size_t size);
void AddComponentResourceEntries(const webui::ResourcePath* entries,
size_t size);
// A map from a resource path to the resource ID. Used by
// IsComponentExtensionResource.

View file

@ -24,7 +24,6 @@
#include "electron/buildflags/buildflags.h"
#include "extensions/browser/api/app_runtime/app_runtime_api.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_user_script_manager.h"
#include "extensions/browser/info_map.h"
#include "extensions/browser/management_policy.h"
#include "extensions/browser/notification_types.h"
@ -32,6 +31,7 @@
#include "extensions/browser/quota_service.h"
#include "extensions/browser/runtime_data.h"
#include "extensions/browser/service_worker_manager.h"
#include "extensions/browser/user_script_manager.h"
#include "extensions/browser/value_store/value_store_factory_impl.h"
#include "extensions/common/constants.h"
#include "extensions/common/file_util.h"
@ -84,8 +84,7 @@ void ElectronExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
runtime_data_ =
std::make_unique<RuntimeData>(ExtensionRegistry::Get(browser_context_));
quota_service_ = std::make_unique<QuotaService>();
extension_user_script_manager_ =
std::make_unique<ExtensionUserScriptManager>(browser_context_);
user_script_manager_ = std::make_unique<UserScriptManager>(browser_context_);
app_sorting_ = std::make_unique<NullAppSorting>();
extension_loader_ =
std::make_unique<ElectronExtensionLoader>(browser_context_);
@ -143,9 +142,8 @@ ServiceWorkerManager* ElectronExtensionSystem::service_worker_manager() {
return service_worker_manager_.get();
}
ExtensionUserScriptManager*
ElectronExtensionSystem::extension_user_script_manager() {
return new ExtensionUserScriptManager(browser_context_);
UserScriptManager* ElectronExtensionSystem::user_script_manager() {
return new UserScriptManager(browser_context_);
}
StateStore* ElectronExtensionSystem::state_store() {

View file

@ -61,7 +61,7 @@ class ElectronExtensionSystem : public ExtensionSystem {
RuntimeData* runtime_data() override;
ManagementPolicy* management_policy() override;
ServiceWorkerManager* service_worker_manager() override;
ExtensionUserScriptManager* extension_user_script_manager() override;
UserScriptManager* user_script_manager() override;
StateStore* state_store() override;
StateStore* rules_store() override;
scoped_refptr<ValueStoreFactory> store_factory() override;
@ -103,7 +103,7 @@ class ElectronExtensionSystem : public ExtensionSystem {
std::unique_ptr<ServiceWorkerManager> service_worker_manager_;
std::unique_ptr<RuntimeData> runtime_data_;
std::unique_ptr<QuotaService> quota_service_;
std::unique_ptr<ExtensionUserScriptManager> extension_user_script_manager_;
std::unique_ptr<UserScriptManager> user_script_manager_;
std::unique_ptr<AppSorting> app_sorting_;
std::unique_ptr<ManagementPolicy> management_policy_;

View file

@ -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_);
}

View file

@ -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;
}

View file

@ -9,6 +9,7 @@
#include <unordered_set>
#include <utility>
#include "base/allocator/partition_allocator/partition_alloc.h"
#include "base/command_line.h"
#include "base/task/current_thread.h"
#include "base/task/thread_pool/initialization_util.h"
@ -65,6 +66,83 @@ struct base::trace_event::TraceValue::Helper<
namespace electron {
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
public:
enum InitializationPolicy { kZeroInitialize, kDontInitialize };
ArrayBufferAllocator() {
// Ref.
// https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/wtf/allocator/partitions.cc;l=94;drc=062c315a858a87f834e16a144c2c8e9591af2beb
allocator_->init({base::PartitionOptions::Alignment::kRegular,
base::PartitionOptions::ThreadCache::kDisabled,
base::PartitionOptions::Quarantine::kAllowed,
base::PartitionOptions::RefCount::kDisabled});
}
// Allocate() methods return null to signal allocation failure to V8, which
// should respond by throwing a RangeError, per
// http://www.ecma-international.org/ecma-262/6.0/#sec-createbytedatablock.
void* Allocate(size_t size) override {
void* result = AllocateMemoryOrNull(size, kZeroInitialize);
return result;
}
void* AllocateUninitialized(size_t size) override {
void* result = AllocateMemoryOrNull(size, kDontInitialize);
return result;
}
void* Realloc(void* data, size_t size) override {
return allocator_->root()->Realloc(data, size, "Electron");
}
void Free(void* data, size_t size) override {
allocator_->root()->Free(data);
}
private:
static void* AllocateMemoryOrNull(size_t size, InitializationPolicy policy) {
return AllocateMemoryWithFlags(size, policy,
base::PartitionAllocReturnNull);
}
static void* AllocateMemoryWithFlags(size_t size,
InitializationPolicy policy,
int flags) {
// The array buffer contents are sometimes expected to be 16-byte aligned in
// order to get the best optimization of SSE, especially in case of audio
// and video buffers. Hence, align the given size up to 16-byte boundary.
// Technically speaking, 16-byte aligned size doesn't mean 16-byte aligned
// address, but this heuristics works with the current implementation of
// PartitionAlloc (and PartitionAlloc doesn't support a better way for now).
if (base::kAlignment <
16) { // base::kAlignment is a compile-time constant.
size_t aligned_size = base::bits::AlignUp(size, 16);
if (size == 0) {
aligned_size = 16;
}
if (aligned_size >= size) { // Only when no overflow
size = aligned_size;
}
}
if (policy == kZeroInitialize) {
flags |= base::PartitionAllocZeroFill;
}
void* data = allocator_->root()->AllocFlags(flags, size, "Electron");
if (base::kAlignment < 16) {
char* ptr = reinterpret_cast<char*>(data);
DCHECK_EQ(base::bits::AlignUp(ptr, 16), ptr)
<< "Pointer " << ptr << " not 16B aligned for size " << size;
}
return data;
}
static base::NoDestructor<base::PartitionAllocator> allocator_;
};
base::NoDestructor<base::PartitionAllocator> ArrayBufferAllocator::allocator_{};
JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop)
: isolate_(Initialize(event_loop)),
isolate_holder_(base::ThreadTaskRunnerHandle::Get(),
@ -249,10 +327,9 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) {
tracing_controller, gin::V8Platform::PageAllocator());
v8::V8::InitializePlatform(platform_);
gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
gin::ArrayBufferAllocator::SharedInstance(),
nullptr /* external_reference_table */,
false /* create_v8_platform */);
gin::IsolateHolder::Initialize(
gin::IsolateHolder::kNonStrictMode, new ArrayBufferAllocator(),
nullptr /* external_reference_table */, false /* create_v8_platform */);
v8::Isolate* isolate = v8::Isolate::Allocate();
platform_->RegisterIsolate(isolate, event_loop);

View file

@ -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) {

View file

@ -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;

View file

@ -10,7 +10,6 @@
#include <vector>
#include "base/callback.h"
#include "base/strings/string16.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "gin/arguments.h"
#include "gin/dictionary.h"
@ -83,7 +82,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;

View file

@ -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();
}

View file

@ -15,7 +15,6 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/optional.h"
#include "base/strings/string16.h"
#include "base/supports_user_data.h"
#include "base/values.h"
#include "content/public/browser/desktop_media_id.h"
@ -326,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; }
@ -384,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};

View file

@ -8,7 +8,6 @@
#include <string>
#include "base/observer_list_types.h"
#include "base/strings/string16.h"
#include "base/values.h"
#include "ui/base/window_open_disposition.h"
#include "url/gurl.h"
@ -28,7 +27,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) {}

View file

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

View file

@ -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,

View file

@ -501,7 +501,7 @@ void ElectronURLLoaderFactory::StartLoadingStream(
client_remote->OnReceiveResponse(std::move(head));
mojo::ScopedDataPipeProducerHandle producer;
mojo::ScopedDataPipeConsumerHandle consumer;
if (mojo::CreateDataPipe(nullptr, &producer, &consumer) != MOJO_RESULT_OK) {
if (mojo::CreateDataPipe(nullptr, producer, consumer) != MOJO_RESULT_OK) {
client_remote->OnComplete(
network::URLLoaderCompletionStatus(net::ERR_INSUFFICIENT_RESOURCES));
return;
@ -548,7 +548,7 @@ void ElectronURLLoaderFactory::SendContents(
// Code bellow follows the pattern of data_url_loader_factory.cc.
mojo::ScopedDataPipeProducerHandle producer;
mojo::ScopedDataPipeConsumerHandle consumer;
if (mojo::CreateDataPipe(nullptr, &producer, &consumer) != MOJO_RESULT_OK) {
if (mojo::CreateDataPipe(nullptr, producer, consumer) != MOJO_RESULT_OK) {
client_remote->OnComplete(
network::URLLoaderCompletionStatus(net::ERR_INSUFFICIENT_RESOURCES));
return;

View file

@ -26,7 +26,8 @@ NetworkContextService::~NetworkContextService() = default;
void NetworkContextService::ConfigureNetworkContextParams(
network::mojom::NetworkContextParams* network_context_params,
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) {
cert_verifier::mojom::CertVerifierCreationParams*
cert_verifier_creation_params) {
bool in_memory = browser_context_->IsOffTheRecord();
const base::FilePath& path = browser_context_->GetPath();
@ -43,7 +44,7 @@ void NetworkContextService::ConfigureNetworkContextParams(
network_context_params->user_agent = browser_context_->GetUserAgent();
network_context_params->cors_origin_access_list =
browser_context_->GetSharedCorsOriginAccessList()
content::BrowserContext::GetSharedCorsOriginAccessList(browser_context_)
->GetOriginAccessList()
.CreateCorsOriginAccessPatternsList();

View file

@ -9,6 +9,7 @@
#include "chrome/browser/net/proxy_config_monitor.h"
#include "components/keyed_service/core/keyed_service.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "shell/browser/electron_browser_context.h"
@ -26,7 +27,7 @@ class NetworkContextService : public KeyedService {
void ConfigureNetworkContextParams(
network::mojom::NetworkContextParams* network_context_params,
network::mojom::CertVerifierCreationParams*
cert_verifier::mojom::CertVerifierCreationParams*
cert_verifier_creation_params);
private:

View file

@ -52,7 +52,7 @@ NodeStreamLoader::~NodeStreamLoader() {
void NodeStreamLoader::Start(network::mojom::URLResponseHeadPtr head) {
mojo::ScopedDataPipeProducerHandle producer;
mojo::ScopedDataPipeConsumerHandle consumer;
MojoResult rv = mojo::CreateDataPipe(nullptr, &producer, &consumer);
MojoResult rv = mojo::CreateDataPipe(nullptr, producer, consumer);
if (rv != MOJO_RESULT_OK) {
NotifyComplete(net::ERR_INSUFFICIENT_RESOURCES);
return;

View file

@ -240,6 +240,11 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveResponse(
}
}
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveEarlyHints(
network::mojom::EarlyHintsPtr early_hints) {
target_client_->OnReceiveEarlyHints(std::move(early_hints));
}
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveRedirect(
const net::RedirectInfo& redirect_info,
network::mojom::URLResponseHeadPtr head) {

View file

@ -74,6 +74,8 @@ class ProxyingURLLoaderFactory
// network::mojom::URLLoaderClient:
void OnReceiveResponse(network::mojom::URLResponseHeadPtr head) override;
void OnReceiveEarlyHints(
network::mojom::EarlyHintsPtr early_hints) override;
void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
network::mojom::URLResponseHeadPtr head) override;
void OnUploadProgress(int64_t current_position,

View file

@ -15,6 +15,7 @@
#include "content/public/common/content_features.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "net/net_buildflags.h"
#include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom.h"
#include "services/network/network_service.h"
#include "services/network/public/cpp/cross_thread_pending_shared_url_loader_factory.h"
#include "services/network/public/cpp/features.h"
@ -157,8 +158,9 @@ SystemNetworkContextManager::CreateDefaultNetworkContextParams() {
ConfigureDefaultNetworkContextParams(network_context_params.get());
network::mojom::CertVerifierCreationParamsPtr cert_verifier_creation_params =
network::mojom::CertVerifierCreationParams::New();
cert_verifier::mojom::CertVerifierCreationParamsPtr
cert_verifier_creation_params =
cert_verifier::mojom::CertVerifierCreationParams::New();
network_context_params->cert_verifier_params =
content::GetCertVerifierParams(std::move(cert_verifier_creation_params));
return network_context_params;

View file

@ -61,7 +61,7 @@ void URLPipeLoader::OnResponseStarted(
const network::mojom::URLResponseHead& response_head) {
mojo::ScopedDataPipeProducerHandle producer;
mojo::ScopedDataPipeConsumerHandle consumer;
MojoResult rv = mojo::CreateDataPipe(nullptr, &producer, &consumer);
MojoResult rv = mojo::CreateDataPipe(nullptr, producer, consumer);
if (rv != MOJO_RESULT_OK) {
NotifyComplete(net::ERR_INSUFFICIENT_RESOURCES);
return;

View file

@ -9,7 +9,6 @@
#include <vector>
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "url/gurl.h"
@ -19,26 +18,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();

View file

@ -72,7 +72,7 @@ bool NotificationPresenterWin::Init() {
return temp_dir_.CreateUniqueTempDir();
}
base::string16 NotificationPresenterWin::SaveIconToFilesystem(
std::wstring NotificationPresenterWin::SaveIconToFilesystem(
const SkBitmap& icon,
const GURL& origin) {
std::string filename;
@ -85,12 +85,12 @@ base::string16 NotificationPresenterWin::SaveIconToFilesystem(
}
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::FilePath path = temp_dir_.GetPath().Append(base::UTF8ToUTF16(filename));
base::FilePath path = temp_dir_.GetPath().Append(base::UTF8ToWide(filename));
if (base::PathExists(path))
return path.value();
if (SaveIconToPath(icon, path))
return path.value();
return base::UTF8ToUTF16(origin.spec());
return base::UTF8ToWide(origin.spec());
}
Notification* NotificationPresenterWin::CreateNotificationObject(

View file

@ -24,7 +24,6 @@
#define SHELL_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_PRESENTER_WIN_H_
#include "base/files/scoped_temp_dir.h"
#include "base/strings/string16.h"
#include "shell/browser/notifications/notification_presenter.h"
class GURL;
@ -39,7 +38,7 @@ class NotificationPresenterWin : public NotificationPresenter {
bool Init();
base::string16 SaveIconToFilesystem(const SkBitmap& icon, const GURL& origin);
std::wstring SaveIconToFilesystem(const SkBitmap& icon, const GURL& origin);
private:
Notification* CreateNotificationObject(

View file

@ -13,6 +13,7 @@
#include <utility>
#include <vector>
#include "base/strings/utf_string_conversions.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace electron {
@ -49,13 +50,15 @@ void Win32Notification::Show(const NotificationOptions& options) {
existing->tag_.clear();
this->notification_ref_ = std::move(existing->notification_ref_);
this->notification_ref_.Set(options.title, options.msg, image);
this->notification_ref_.Set(base::UTF16ToWide(options.title),
base::UTF16ToWide(options.msg), image);
// Need to remove the entry in the notifications set that
// NotificationPresenter is holding
existing->Destroy();
} else {
this->notification_ref_ =
presenter->AddNotification(options.title, options.msg, image);
presenter->AddNotification(base::UTF16ToWide(options.title),
base::UTF16ToWide(options.msg), image);
}
this->tag_ = options.tag;

View file

@ -21,7 +21,7 @@
#include "shell/browser/notifications/win/notification_presenter_win.h"
#include "shell/browser/win/scoped_hstring.h"
#include "shell/common/application_info.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/strings/grit/ui_strings.h"
using ABI::Windows::Data::Xml::Dom::IXmlAttribute;
@ -132,15 +132,18 @@ HRESULT WindowsToastNotification::ShowInternal(
// The custom xml takes priority over the preset template.
if (!options.toast_xml.empty()) {
REPORT_AND_RETURN_IF_FAILED(
XmlDocumentFromString(options.toast_xml.c_str(), &toast_xml),
XmlDocumentFromString(base::UTF16ToWide(options.toast_xml).c_str(),
&toast_xml),
"XML: Invalid XML");
} else {
auto* presenter_win = static_cast<NotificationPresenterWin*>(presenter());
std::wstring icon_path =
presenter_win->SaveIconToFilesystem(options.icon, options.icon_url);
REPORT_AND_RETURN_IF_FAILED(
GetToastXml(toast_manager_.Get(), options.title, options.msg, icon_path,
options.timeout_type, options.silent, &toast_xml),
GetToastXml(toast_manager_.Get(), base::UTF16ToWide(options.title),
base::UTF16ToWide(options.msg), icon_path,
base::UTF16ToWide(options.timeout_type), options.silent,
&toast_xml),
"XML: Failed to create XML document");
}
@ -211,7 +214,7 @@ HRESULT WindowsToastNotification::GetToastXml(
}
// Configure the toast's timeout settings
if (timeout_type == base::ASCIIToUTF16("never")) {
if (timeout_type == base::ASCIIToWide("never")) {
REPORT_AND_RETURN_IF_FAILED(
(SetXmlScenarioReminder(*toast_xml)),
"XML: Setting \"scenario\" option on notification failed");
@ -379,7 +382,7 @@ HRESULT WindowsToastNotification::SetXmlScenarioReminder(IXmlDocument* doc) {
RETURN_IF_FAILED(content_attribute.As(&content_attribute_node));
// Set content attribute to Dismiss
ScopedHString content_value(l10n_util::GetStringUTF16(IDS_APP_CLOSE));
ScopedHString content_value(l10n_util::GetWideString(IDS_APP_CLOSE));
if (!content_value.success())
return E_FAIL;

View file

@ -144,8 +144,9 @@ class ElectronDelegatedFrameHostClient
return *view_->GetBackgroundColor();
}
void OnFrameTokenChanged(uint32_t frame_token) override {
view_->render_widget_host()->DidProcessFrame(frame_token);
void OnFrameTokenChanged(uint32_t frame_token,
base::TimeTicks activation_time) override {
view_->render_widget_host()->DidProcessFrame(frame_token, activation_time);
}
float GetDeviceScaleFactor() const override {
@ -455,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_;

View file

@ -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,

View file

@ -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())

View file

@ -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;

View file

@ -10,7 +10,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "content/public/browser/serial_chooser.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"

View file

@ -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);
}

View file

@ -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_;

View file

@ -11,7 +11,6 @@
#include "base/callback.h"
#include "base/mac/scoped_nsobject.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
namespace electron {
class ElectronMenuModel;

View file

@ -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];

View file

@ -35,7 +35,7 @@ bool ScopedDisableResize::disable_resize_ = false;
if ((self = [super initWithContentRect:ui::kWindowSizeDeterminedLater
styleMask:styleMask
backing:NSBackingStoreBuffered
defer:YES])) {
defer:NO])) {
shell_ = shell;
}
return self;

View file

@ -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(

View file

@ -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};

View file

@ -6,10 +6,13 @@
#include <windows.h> // windows.h must be included first
#include <atlbase.h> // atlbase.h for CComPtr
#include "base/win/shlwapi.h" // NOLINT(build/include_order)
#include <shlobj.h>
#include <shobjidl.h>
// atlbase.h for CComPtr
#include <atlbase.h> // NOLINT(build/include_order)
#include <shlobj.h> // NOLINT(build/include_order)
#include <shobjidl.h> // NOLINT(build/include_order)
#include "base/files/file_util.h"
#include "base/i18n/case_conversion.h"
@ -118,10 +121,10 @@ static void ApplySettings(IFileDialog* dialog, const DialogSettings& settings) {
dialog->SetFileName(file_part.c_str());
if (!settings.title.empty())
dialog->SetTitle(base::UTF8ToUTF16(settings.title).c_str());
dialog->SetTitle(base::UTF8ToWide(settings.title).c_str());
if (!settings.button_label.empty())
dialog->SetOkButtonLabel(base::UTF8ToUTF16(settings.button_label).c_str());
dialog->SetOkButtonLabel(base::UTF8ToWide(settings.button_label).c_str());
std::vector<std::wstring> buffer;
std::vector<COMDLG_FILTERSPEC> filterspec;

View file

@ -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();

View file

@ -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;

View file

@ -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());
}

View file

@ -8,7 +8,6 @@
#include <memory>
#include "base/macros.h"
#include "base/strings/string16.h"
#include "ui/base/glib/glib_integers.h"
#include "ui/base/glib/glib_signal.h"
#include "ui/views/linux_ui/status_icon_linux.h"
@ -32,12 +31,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;

View file

@ -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();

View file

@ -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

View file

@ -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()

View file

@ -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;

View file

@ -6,7 +6,8 @@
#ifndef SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_
#define SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_
#include "base/strings/string16.h"
#include <string>
#include "ui/gfx/native_widget_types.h"
class DevToolsContentsResizingStrategy;
@ -51,7 +52,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.

View file

@ -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_;

View file

@ -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)];
}

View file

@ -10,7 +10,6 @@
#include <vector>
#include "base/callback_forward.h"
#include "base/strings/string16.h"
#include "ui/gfx/image/image_skia.h"
namespace electron {
@ -56,7 +55,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

View file

@ -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;

View file

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

View file

@ -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::wstring& button) {
std::wstring 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::wstring>& buttons,
std::map<int, int>* id_map,
TASKDIALOG_COMMON_BUTTON_FLAGS* button_flags,
std::vector<TASKDIALOG_BUTTON>* dialog_buttons) {
@ -76,18 +76,18 @@ void MapToCommonID(const std::vector<base::string16>& buttons,
}
}
DialogResult ShowTaskDialogUTF16(NativeWindow* parent,
MessageBoxType type,
const std::vector<base::string16>& 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,
bool checkbox_checked,
const gfx::ImageSkia& icon) {
DialogResult ShowTaskDialogWstr(NativeWindow* parent,
MessageBoxType type,
const std::vector<std::wstring>& buttons,
int default_id,
int cancel_id,
bool no_link,
const std::wstring& title,
const std::wstring& message,
const std::wstring& detail,
const std::wstring& checkbox_label,
bool checkbox_checked,
const gfx::ImageSkia& icon) {
TASKDIALOG_FLAGS flags =
TDF_SIZE_TO_CONTENT | // Show all content.
TDF_ALLOW_DIALOG_CANCELLATION; // Allow canceling the dialog.
@ -107,11 +107,12 @@ 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());
if (title.empty())
if (title.empty()) {
std::wstring app_name = base::UTF8ToWide(Browser::Get()->GetName());
config.pszWindowTitle = app_name.c_str();
else
} else {
config.pszWindowTitle = title.c_str();
}
base::win::ScopedHICON hicon;
if (!icon.isNull()) {
@ -185,20 +186,19 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent,
}
DialogResult ShowTaskDialogUTF8(const MessageBoxSettings& settings) {
std::vector<base::string16> utf16_buttons;
std::vector<std::wstring> buttons;
for (const auto& button : settings.buttons)
utf16_buttons.push_back(base::UTF8ToUTF16(button));
buttons.push_back(base::UTF8ToWide(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 =
base::UTF8ToUTF16(settings.checkbox_label);
const std::wstring title = base::UTF8ToWide(settings.title);
const std::wstring message = base::UTF8ToWide(settings.message);
const std::wstring detail = base::UTF8ToWide(settings.detail);
const std::wstring checkbox_label = base::UTF8ToWide(settings.checkbox_label);
return ShowTaskDialogUTF16(
settings.parent_window, settings.type, utf16_buttons, settings.default_id,
settings.cancel_id, settings.no_link, title_16, message_16, detail_16,
checkbox_label_16, settings.checkbox_checked, settings.icon);
return ShowTaskDialogWstr(
settings.parent_window, settings.type, buttons, settings.default_id,
settings.cancel_id, settings.no_link, title, message, detail,
checkbox_label, settings.checkbox_checked, settings.icon);
}
} // namespace
@ -219,10 +219,12 @@ 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());
ShowTaskDialogWstr(nullptr, MessageBoxType::kError, {}, -1, 0, false,
base::UTF8ToWide("Error"), base::UTF16ToWide(title),
base::UTF16ToWide(content), base::UTF8ToWide(""), false,
gfx::ImageSkia());
}
} // namespace electron

View file

@ -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;

View file

@ -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_;
}

View file

@ -33,14 +33,14 @@ class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate {
// The following four methods are only used by StatusIconLinuxDbus, which we
// 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);

View file

@ -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);
};

View file

@ -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) {}

View file

@ -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;

View file

@ -8,7 +8,6 @@
#include <glib-object.h>
#include "base/logging.h"
#include "base/strings/string16.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h"
@ -297,7 +296,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);

Some files were not shown because too many files have changed in this diff Show more