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

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

View file

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

View file

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

View file

@ -78,7 +78,7 @@ void MenuBar::SetAcceleratorVisibility(bool visible) {
static_cast<SubmenuButton*>(child)->SetAcceleratorVisibility(visible);
}
MenuBar::View* MenuBar::FindAccelChild(base::char16 key) {
MenuBar::View* MenuBar::FindAccelChild(char16_t key) {
for (auto* child : GetChildrenInZOrder()) {
if (static_cast<SubmenuButton*>(child)->accelerator() == key)
return child;
@ -86,11 +86,11 @@ MenuBar::View* MenuBar::FindAccelChild(base::char16 key) {
return nullptr;
}
bool MenuBar::HasAccelerator(base::char16 key) {
bool MenuBar::HasAccelerator(char16_t key) {
return FindAccelChild(key) != nullptr;
}
void MenuBar::ActivateAccelerator(base::char16 key) {
void MenuBar::ActivateAccelerator(char16_t key) {
auto* child = FindAccelChild(key);
if (child)
static_cast<SubmenuButton*>(child)->Activate(nullptr);

View file

@ -51,10 +51,10 @@ class MenuBar : public views::AccessiblePaneView,
void SetAcceleratorVisibility(bool visible);
// Returns true if the submenu has accelerator |key|
bool HasAccelerator(base::char16 key);
bool HasAccelerator(char16_t key);
// Shows the submenu whose accelerator is |key|.
void ActivateAccelerator(base::char16 key);
void ActivateAccelerator(char16_t key);
// Returns there are how many items in the root menu.
int GetItemCount() const;
@ -95,7 +95,7 @@ class MenuBar : public views::AccessiblePaneView,
RootView* window_ = nullptr;
ElectronMenuModel* menu_model_ = nullptr;
View* FindAccelChild(base::char16 key);
View* FindAccelChild(char16_t key);
bool has_focus_ = true;

View file

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

View file

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

View file

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

View file

@ -17,14 +17,14 @@ namespace electron {
class SubmenuButton : public views::MenuButton {
public:
SubmenuButton(PressedCallback callback,
const base::string16& title,
const std::u16string& title,
const SkColor& background_color);
~SubmenuButton() override;
void SetAcceleratorVisibility(bool visible);
void SetUnderlineColor(SkColor color);
base::char16 accelerator() const { return accelerator_; }
char16_t accelerator() const { return accelerator_; }
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
@ -36,15 +36,15 @@ class SubmenuButton : public views::MenuButton {
std::unique_ptr<views::InkDrop> CreateInkDrop() override;
private:
bool GetUnderlinePosition(const base::string16& text,
base::char16* accelerator,
bool GetUnderlinePosition(const std::u16string& text,
char16_t* accelerator,
int* start,
int* end) const;
void GetCharacterPosition(const base::string16& text,
void GetCharacterPosition(const std::u16string& text,
int index,
int* pos) const;
base::char16 accelerator_ = 0;
char16_t accelerator_ = 0;
bool show_underline_ = false;

View file

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

View file

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

View file

@ -141,7 +141,7 @@ void NotifyIcon::SetToolTip(const std::string& tool_tip) {
NOTIFYICONDATA icon_data;
InitIconData(&icon_data);
icon_data.uFlags |= NIF_TIP;
wcsncpy_s(icon_data.szTip, base::UTF8ToUTF16(tool_tip).c_str(), _TRUNCATE);
wcsncpy_s(icon_data.szTip, base::UTF8ToWide(tool_tip).c_str(), _TRUNCATE);
BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data);
if (!result)
LOG(WARNING) << "Unable to set tooltip for status tray icon";
@ -151,8 +151,10 @@ void NotifyIcon::DisplayBalloon(const BalloonOptions& options) {
NOTIFYICONDATA icon_data;
InitIconData(&icon_data);
icon_data.uFlags |= NIF_INFO;
wcsncpy_s(icon_data.szInfoTitle, options.title.c_str(), _TRUNCATE);
wcsncpy_s(icon_data.szInfo, options.content.c_str(), _TRUNCATE);
wcsncpy_s(icon_data.szInfoTitle, base::UTF16ToWide(options.title).c_str(),
_TRUNCATE);
wcsncpy_s(icon_data.szInfo, base::UTF16ToWide(options.content).c_str(),
_TRUNCATE);
icon_data.uTimeout = 0;
icon_data.hBalloonIcon = options.icon;
icon_data.dwInfoFlags = ConvertIconType(options.icon_type);

View file

@ -104,7 +104,7 @@ bool TaskbarHost::SetThumbarButtons(HWND window,
// Set tooltip.
if (!button.tooltip.empty()) {
thumb_button.dwMask |= THB_TOOLTIP;
wcsncpy_s(thumb_button.szTip, base::UTF8ToUTF16(button.tooltip).c_str(),
wcsncpy_s(thumb_button.szTip, base::UTF8ToWide(button.tooltip).c_str(),
_TRUNCATE);
}
@ -174,7 +174,7 @@ bool TaskbarHost::SetOverlayIcon(HWND window,
base::win::ScopedHICON icon(IconUtil::CreateHICONFromSkBitmap(overlay));
return SUCCEEDED(taskbar_->SetOverlayIcon(window, icon.get(),
base::UTF8ToUTF16(text).c_str()));
base::UTF8ToWide(text).c_str()));
}
bool TaskbarHost::SetThumbnailClip(HWND window, const gfx::Rect& region) {
@ -194,8 +194,8 @@ bool TaskbarHost::SetThumbnailToolTip(HWND window, const std::string& tooltip) {
if (!InitializeTaskbar())
return false;
return SUCCEEDED(taskbar_->SetThumbnailTooltip(
window, base::UTF8ToUTF16(tooltip).c_str()));
return SUCCEEDED(
taskbar_->SetThumbnailTooltip(window, base::UTF8ToWide(tooltip).c_str()));
}
bool TaskbarHost::HandleThumbarButtonEvent(int button_id) {