mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
chore: bump chromium to 91.0.4448.0 (13-x-y) (#28127)
* chore: bump chromium in DEPS to 90.0.4430.19 * build: add 'use_rts' definition Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2694187 (cherry picked from commitb820b4078d) * chore: bump chromium in DEPS to 91.0.4441.0 * chore: update patches (cherry picked from commit55e50a0879) * chore: media_internal_resources becomes resources Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2699022 (cherry picked from commite715b9c921) * chore: update patches (cherry picked from commitc8148febfa) * refactor: extensions::ViewType moved to mojom Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710351 (cherry picked from commit87df2766ba) * chore: might_have_observers has been removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2667839 (cherry picked from commite900271bea) * refactor: CertVerifier is not in the network namespace anymore Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2689805 (cherry picked from commiteccfa516c5) * refactor: ExtensionUserScriptManager is now UserScriptManager Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2657617 (cherry picked from commit2fed02556d) * refactor: content::SiteInstance::GetSiteForURL was removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2680274 (cherry picked from commit0d94e0d1d9) * refactor: MenuItemType was moved to mojom Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2071443 (cherry picked from commit1a296e59c2) * refactor: extensions::ViewType was moved to mojom Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710351 (cherry picked from commitdc36e8e6fc) * refacotr: grit::ResourceMap replaced with webui::ResourcePath Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2685601 (cherry picked from commit59669e99cb) * refactor: blink::MenuItem::Type was moved to mojom Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2071443 (cherry picked from commitbe627568b2) * refactor: CreateDataPipe deprecated form was removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2698090 (cherry picked from commit77ad17b383) * refactor: DesktopMediaList::Type replaces content::DesktopMediaType_* Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2700637 (cherry picked from commit4e02d9407a) * chore: wire up activation_time in OSR Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2638372 (cherry picked from commitf51f427646) * chore: remove deleted file from chromium_src list (cherry picked from commit59432fe30a) * chore: fix lint (cherry picked from commit54cc68dd7a) * update patches (cherry picked from commite99e6a5a8a) * chore: update patches (cherry picked from commit1e16606524) * fixup gn check (cherry picked from commit8f4e362d8f) * update to xcode 12.4.0 Needed because of8008deb41c(cherry picked from commitfae4d87a5a) * 2752406: [LSC] Replace base::string16 with std::u16string in //ui https://chromium-review.googlesource.com/c/chromium/src/+/2752406 (cherry picked from commitd4bec23bde) * 2752406: [LSC] Replace base::string16 with std::u16string in //ui https://chromium-review.googlesource.com/c/chromium/src/+/2752406 (cherry picked from commit9e336f5d0c) * 2752932: Associate each AwProxyingURLLoaderFactory with a frame tree node id. https://chromium-review.googlesource.com/c/chromium/src/+/2752932 (cherry picked from commit08036802cb) * 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer. https://chromium-review.googlesource.com/c/chromium/src/+/2651385 (cherry picked from commit676f74f3dc) * 2734095: Introduce StoragePartitionId type to wrap current string representation. https://chromium-review.googlesource.com/c/chromium/src/+/2734095 (cherry picked from commit76538d2d38) * chore: bump chromium in DEPS to 90.0.4430.19 * chore: bump chromium in DEPS to 90.0.4430.30 * chore: bump chromium in DEPS to 90.0.4430.40 * chore: bump chromium in DEPS to 90.0.4430.51 * chore: bump chromium in DEPS to 91.0.4446.0 * chore: bump chromium in DEPS to 91.0.4448.0 (cherry picked from commit003dd6c16c) * Update patches (cherry picked from commit9f5e3f6685) * 2743594: Remove WebSize from blink. https://chromium-review.googlesource.com/c/chromium/src/+/2743594 (cherry picked from commitb15b820bca) * 2725403: Add URLLoaderClient::OnReceiveEarlyHints() https://chromium-review.googlesource.com/c/chromium/src/+/2725403 (cherry picked from commit185c343b22) * 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer. https://chromium-review.googlesource.com/c/chromium/src/+/2651385 (cherry picked from commit88bbe2a352) * 2721718: Move HostID to extensions::mojom::HostID https://chromium-review.googlesource.com/c/chromium/src/+/2721718 (cherry picked from commit3010dd93e3) * 2733070: Rename observer to URLLoaderNetworkServiceObserver https://chromium-review.googlesource.com/c/chromium/src/+/2733070 (cherry picked from commitd54bee03d0) * Use nogncheck for content/browser/site_instance_impl.h This is needed because //content/browser:browser is not a visible target (cherry picked from commit5fc298ee5f) * 2648046: Introduce alert notification helper .app https://chromium-review.googlesource.com/c/chromium/src/+/2648046 (cherry picked from commit2cd53eb46a) * 2752406: [LSC] Replace base::string16 with std::u16string in //ui https://chromium-review.googlesource.com/c/chromium/src/+/2752406 (cherry picked from commitf1bb6be4b9) * only include mac notifications on mac (cherry picked from commit3160e608e2) * add additional skipping of atk toolchain check (cherry picked from commit86d23cee40) * 2757472: Reland "Reland "[LSC] Remove base::string16 alias"" https://chromium-review.googlesource.com/c/chromium/src/+/2757472 (cherry picked from commit22d8f22cfb) * 2757472: Reland "Reland "[LSC] Remove base::string16 alias"" https://chromium-review.googlesource.com/c/chromium/src/+/2757472 (cherry picked from commitec893f8322) * 2720306: [api] Remove deprecated [Shared]ArrayBuffer API https://chromium-review.googlesource.com/c/v8/v8/+/2720306 (cherry picked from commitd0989802bd) * Fixup 2721718: Move HostID to extensions::mojom::HostID (cherry picked from commit29dfabadfd) * fixup 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer (cherry picked from commit97b6868e9c) * Fixup 2752406: [LSC] Replace base::string16 with std::u16string in //ui (cherry picked from commitb6d2ae0455) * Fixup 2725403: Add URLLoaderClient::OnReceiveEarlyHints() (cherry picked from commit7e961d8a37) * update node headers (cherry picked from commitc49bc282d5) * 2693008: Fix loading non-system cursors on Windows on browser_tests https://chromium-review.googlesource.com/c/chromium/src/+/2693008 (cherry picked from commit3b183854ff) * 2757472: Reland "Reland "[LSC] Remove base::string16 alias"" https://chromium-review.googlesource.com/c/chromium/src/+/2757472 (cherry picked from commit2d3c65beca) * undo changes to WebContentsPreferences::GetPreloadPath to fix mac build (cherry picked from commitdeeb2de14b) * fix StrCat issue (cherry picked from commit451e0931bf) * incantations for WebContentsPreferences::GetPreloadPath wide strings (cherry picked from commit205f572181) * bump nan (cherry picked from commit74318705c2) * fix GetAsString maybe? (cherry picked from commitea62ecd188) * windows build fixes (cherry picked from commit5b598037bb) * more windows build fix (cherry picked from commit61cf1abd4d) * SetAppUserModelID -> wstring (cherry picked from commit83d93bcbdc) * upgrade nan dep in tests (cherry picked from commit4f97b9303c) * update patch * wstrings are cross-platform (cherry picked from commit7f7b1f6c8a) * linter (cherry picked from commitaaf03765ed) * only bind setAppUserModelId on windows (cherry picked from commit640a145112) * well that was an odyssey (cherry picked from commitdd975328a0) * backport fcdf35e from v8 to fix nan crash (cherry picked from commit606fd87d1e) * disable typedarrays-test.js (cherry picked from commit01ca00ec82) * don't defer in NSWindow creation https://chromium-review.googlesource.com/c/chromium/src/+/2707696 (cherry picked from commit3122820e58) * use PartitionAllocator for ArrayBuffers in the main process (cherry picked from commit1f575ca3af) * fix patches (cherry picked from commit54e72fa8e3) * chore: omit some unnecessary conversions (cherry picked from commit0f3620099a) * refactor: make LoginItemSettings::path a wstring (cherry picked from commit9127cff58b) * refactor: make ShowTaskDialog take a wstr (cherry picked from commit1594c54933) * Revert "refactor: make LoginItemSettings::path a wstring" This reverts commit9127cff58b. (cherry picked from commit9684d85101) * fixup patches This reverts commit0cc08813a6. * update patches after merge 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: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
@@ -26,9 +26,9 @@ ui::ClipboardBuffer Clipboard::GetClipboardBuffer(gin_helper::Arguments* args) {
|
||||
return ui::ClipboardBuffer::kCopyPaste;
|
||||
}
|
||||
|
||||
std::vector<base::string16> Clipboard::AvailableFormats(
|
||||
std::vector<std::u16string> Clipboard::AvailableFormats(
|
||||
gin_helper::Arguments* args) {
|
||||
std::vector<base::string16> format_types;
|
||||
std::vector<std::u16string> format_types;
|
||||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
clipboard->ReadAvailableTypes(GetClipboardBuffer(args),
|
||||
/* data_dst = */ nullptr, &format_types);
|
||||
@@ -80,7 +80,7 @@ void Clipboard::WriteBuffer(const std::string& format,
|
||||
void Clipboard::Write(const gin_helper::Dictionary& data,
|
||||
gin_helper::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
||||
base::string16 text, html, bookmark;
|
||||
std::u16string text, html, bookmark;
|
||||
gfx::Image image;
|
||||
|
||||
if (data.Get("text", &text)) {
|
||||
@@ -102,8 +102,8 @@ void Clipboard::Write(const gin_helper::Dictionary& data,
|
||||
writer.WriteImage(image.AsBitmap());
|
||||
}
|
||||
|
||||
base::string16 Clipboard::ReadText(gin_helper::Arguments* args) {
|
||||
base::string16 data;
|
||||
std::u16string Clipboard::ReadText(gin_helper::Arguments* args) {
|
||||
std::u16string data;
|
||||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
auto type = GetClipboardBuffer(args);
|
||||
if (clipboard->IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(),
|
||||
@@ -123,13 +123,13 @@ base::string16 Clipboard::ReadText(gin_helper::Arguments* args) {
|
||||
return data;
|
||||
}
|
||||
|
||||
void Clipboard::WriteText(const base::string16& text,
|
||||
void Clipboard::WriteText(const std::u16string& text,
|
||||
gin_helper::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
||||
writer.WriteText(text);
|
||||
}
|
||||
|
||||
base::string16 Clipboard::ReadRTF(gin_helper::Arguments* args) {
|
||||
std::u16string Clipboard::ReadRTF(gin_helper::Arguments* args) {
|
||||
std::string data;
|
||||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
clipboard->ReadRTF(GetClipboardBuffer(args), /* data_dst = */ nullptr, &data);
|
||||
@@ -141,9 +141,9 @@ void Clipboard::WriteRTF(const std::string& text, gin_helper::Arguments* args) {
|
||||
writer.WriteRTF(text);
|
||||
}
|
||||
|
||||
base::string16 Clipboard::ReadHTML(gin_helper::Arguments* args) {
|
||||
base::string16 data;
|
||||
base::string16 html;
|
||||
std::u16string Clipboard::ReadHTML(gin_helper::Arguments* args) {
|
||||
std::u16string data;
|
||||
std::u16string html;
|
||||
std::string url;
|
||||
uint32_t start;
|
||||
uint32_t end;
|
||||
@@ -154,14 +154,14 @@ base::string16 Clipboard::ReadHTML(gin_helper::Arguments* args) {
|
||||
return data;
|
||||
}
|
||||
|
||||
void Clipboard::WriteHTML(const base::string16& html,
|
||||
void Clipboard::WriteHTML(const std::u16string& html,
|
||||
gin_helper::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
||||
writer.WriteHTML(html, std::string());
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> Clipboard::ReadBookmark(gin_helper::Arguments* args) {
|
||||
base::string16 title;
|
||||
std::u16string title;
|
||||
std::string url;
|
||||
gin_helper::Dictionary dict =
|
||||
gin_helper::Dictionary::CreateEmpty(args->isolate());
|
||||
@@ -172,7 +172,7 @@ v8::Local<v8::Value> Clipboard::ReadBookmark(gin_helper::Arguments* args) {
|
||||
return dict.GetHandle();
|
||||
}
|
||||
|
||||
void Clipboard::WriteBookmark(const base::string16& title,
|
||||
void Clipboard::WriteBookmark(const std::u16string& title,
|
||||
const std::string& url,
|
||||
gin_helper::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
||||
@@ -207,9 +207,9 @@ void Clipboard::WriteImage(const gfx::Image& image,
|
||||
}
|
||||
|
||||
#if !defined(OS_MAC)
|
||||
void Clipboard::WriteFindText(const base::string16& text) {}
|
||||
base::string16 Clipboard::ReadFindText() {
|
||||
return base::string16();
|
||||
void Clipboard::WriteFindText(const std::u16string& text) {}
|
||||
std::u16string Clipboard::ReadFindText() {
|
||||
return std::u16string();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace api {
|
||||
class Clipboard {
|
||||
public:
|
||||
static ui::ClipboardBuffer GetClipboardBuffer(gin_helper::Arguments* args);
|
||||
static std::vector<base::string16> AvailableFormats(
|
||||
static std::vector<std::u16string> AvailableFormats(
|
||||
gin_helper::Arguments* args);
|
||||
static bool Has(const std::string& format_string,
|
||||
gin_helper::Arguments* args);
|
||||
@@ -34,27 +34,27 @@ class Clipboard {
|
||||
static void Write(const gin_helper::Dictionary& data,
|
||||
gin_helper::Arguments* args);
|
||||
|
||||
static base::string16 ReadText(gin_helper::Arguments* args);
|
||||
static void WriteText(const base::string16& text,
|
||||
static std::u16string ReadText(gin_helper::Arguments* args);
|
||||
static void WriteText(const std::u16string& text,
|
||||
gin_helper::Arguments* args);
|
||||
|
||||
static base::string16 ReadRTF(gin_helper::Arguments* args);
|
||||
static std::u16string ReadRTF(gin_helper::Arguments* args);
|
||||
static void WriteRTF(const std::string& text, gin_helper::Arguments* args);
|
||||
|
||||
static base::string16 ReadHTML(gin_helper::Arguments* args);
|
||||
static void WriteHTML(const base::string16& html,
|
||||
static std::u16string ReadHTML(gin_helper::Arguments* args);
|
||||
static void WriteHTML(const std::u16string& html,
|
||||
gin_helper::Arguments* args);
|
||||
|
||||
static v8::Local<v8::Value> ReadBookmark(gin_helper::Arguments* args);
|
||||
static void WriteBookmark(const base::string16& title,
|
||||
static void WriteBookmark(const std::u16string& title,
|
||||
const std::string& url,
|
||||
gin_helper::Arguments* args);
|
||||
|
||||
static gfx::Image ReadImage(gin_helper::Arguments* args);
|
||||
static void WriteImage(const gfx::Image& image, gin_helper::Arguments* args);
|
||||
|
||||
static base::string16 ReadFindText();
|
||||
static void WriteFindText(const base::string16& text);
|
||||
static std::u16string ReadFindText();
|
||||
static void WriteFindText(const std::u16string& text);
|
||||
|
||||
static v8::Local<v8::Value> ReadBuffer(const std::string& format_string,
|
||||
gin_helper::Arguments* args);
|
||||
|
||||
@@ -10,12 +10,12 @@ namespace electron {
|
||||
|
||||
namespace api {
|
||||
|
||||
void Clipboard::WriteFindText(const base::string16& text) {
|
||||
void Clipboard::WriteFindText(const std::u16string& text) {
|
||||
NSString* text_ns = base::SysUTF16ToNSString(text);
|
||||
[[FindPasteboard sharedInstance] setFindText:text_ns];
|
||||
}
|
||||
|
||||
base::string16 Clipboard::ReadFindText() {
|
||||
std::u16string Clipboard::ReadFindText() {
|
||||
return GetFindPboardText();
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ bool NativeImage::TryConvertNativeImage(v8::Isolate* isolate,
|
||||
*native_image = NativeImage::CreateFromPath(isolate, icon_path).get();
|
||||
if ((*native_image)->image().IsEmpty()) {
|
||||
#if defined(OS_WIN)
|
||||
const auto img_path = base::UTF16ToUTF8(icon_path.value());
|
||||
const auto img_path = base::WideToUTF8(icon_path.value());
|
||||
#else
|
||||
const auto img_path = icon_path.value();
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,7 @@ v8::Local<v8::Promise> NativeImage::CreateThumbnailFromPath(
|
||||
|
||||
// create an IShellItem
|
||||
Microsoft::WRL::ComPtr<IShellItem> pItem;
|
||||
std::wstring image_path = path.AsUTF16Unsafe();
|
||||
std::wstring image_path = path.value();
|
||||
hr = SHCreateItemFromParsingName(image_path.c_str(), nullptr,
|
||||
IID_PPV_ARGS(&pItem));
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ bool WriteShortcutLink(const base::FilePath& shortcut_path,
|
||||
|
||||
base::win::ShortcutProperties properties;
|
||||
base::FilePath path;
|
||||
base::string16 str;
|
||||
std::wstring str;
|
||||
UUID toastActivatorClsid;
|
||||
int index;
|
||||
if (options.Get("target", &path))
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#define SHELL_COMMON_APPLICATION_INFO_H_
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "base/strings/string16.h"
|
||||
#include "shell/browser/win/scoped_hstring.h"
|
||||
#endif
|
||||
|
||||
@@ -28,7 +27,7 @@ std::string GetApplicationUserAgent();
|
||||
#if defined(OS_WIN)
|
||||
PCWSTR GetRawAppUserModelID();
|
||||
bool GetAppUserModelID(ScopedHString* app_id);
|
||||
void SetAppUserModelID(const base::string16& name);
|
||||
void SetAppUserModelID(const std::wstring& name);
|
||||
bool IsRunningInDesktopBridge();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "base/file_version_info.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/string_util_win.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "shell/browser/win/scoped_hstring.h"
|
||||
@@ -23,7 +24,7 @@ namespace electron {
|
||||
|
||||
namespace {
|
||||
|
||||
base::string16 g_app_user_model_id;
|
||||
std::wstring g_app_user_model_id;
|
||||
}
|
||||
|
||||
const wchar_t kAppUserModelIDFormat[] = L"electron.app.$1";
|
||||
@@ -42,7 +43,7 @@ std::string GetApplicationVersion() {
|
||||
return base::UTF16ToUTF8(info->product_version());
|
||||
}
|
||||
|
||||
void SetAppUserModelID(const base::string16& name) {
|
||||
void SetAppUserModelID(const std::wstring& name) {
|
||||
g_app_user_model_id = name;
|
||||
SetCurrentProcessExplicitAppUserModelID(g_app_user_model_id.c_str());
|
||||
}
|
||||
@@ -54,8 +55,8 @@ PCWSTR GetRawAppUserModelID() {
|
||||
g_app_user_model_id = current_app_id;
|
||||
} else {
|
||||
std::string name = GetApplicationName();
|
||||
base::string16 generated_app_id = base::ReplaceStringPlaceholders(
|
||||
kAppUserModelIDFormat, base::UTF8ToUTF16(name), nullptr);
|
||||
std::wstring generated_app_id = base::ReplaceStringPlaceholders(
|
||||
kAppUserModelIDFormat, {base::UTF8ToWide(name)}, nullptr);
|
||||
SetAppUserModelID(generated_app_id);
|
||||
}
|
||||
CoTaskMemFree(current_app_id);
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
|
||||
#include "third_party/blink/public/common/widget/device_emulation_params.h"
|
||||
#include "third_party/blink/public/platform/web_size.h"
|
||||
#include "ui/base/clipboard/clipboard.h"
|
||||
#include "ui/events/blink/blink_event_util.h"
|
||||
#include "ui/events/keycodes/dom/keycode_converter.h"
|
||||
@@ -44,11 +43,11 @@ int VectorToBitArray(const std::vector<T>& vec) {
|
||||
namespace gin {
|
||||
|
||||
template <>
|
||||
struct Converter<base::char16> {
|
||||
struct Converter<char16_t> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Value> val,
|
||||
base::char16* out) {
|
||||
base::string16 code = base::UTF8ToUTF16(gin::V8ToString(isolate, val));
|
||||
char16_t* out) {
|
||||
std::u16string code = base::UTF8ToUTF16(gin::V8ToString(isolate, val));
|
||||
if (code.length() != 1)
|
||||
return false;
|
||||
*out = code[0];
|
||||
@@ -207,7 +206,7 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(v8::Isolate* isolate,
|
||||
// Make sure to not read beyond the buffer in case some bad code doesn't
|
||||
// NULL-terminate it (this is called from plugins).
|
||||
size_t text_length_cap = blink::WebKeyboardEvent::kTextLengthCap;
|
||||
base::string16 text16 = base::UTF8ToUTF16(str);
|
||||
std::u16string text16 = base::UTF8ToUTF16(str);
|
||||
|
||||
std::fill_n(out->text, text_length_cap, 0);
|
||||
std::fill_n(out->unmodified_text, text_length_cap, 0);
|
||||
@@ -285,15 +284,6 @@ bool Converter<blink::WebMouseWheelEvent>::FromV8(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Converter<blink::WebSize>::FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
blink::WebSize* out) {
|
||||
gin_helper::Dictionary dict;
|
||||
if (!ConvertFromV8(isolate, val, &dict))
|
||||
return false;
|
||||
return dict.Get("width", &out->width) && dict.Get("height", &out->height);
|
||||
}
|
||||
|
||||
bool Converter<blink::DeviceEmulationParams>::FromV8(
|
||||
v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
@@ -375,7 +365,7 @@ v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags) {
|
||||
|
||||
bool pasteFlag = false;
|
||||
if (editFlags & blink::ContextMenuDataEditFlags::kCanPaste) {
|
||||
std::vector<base::string16> types;
|
||||
std::vector<std::u16string> types;
|
||||
ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes(
|
||||
ui::ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr, &types);
|
||||
pasteFlag = !types.empty();
|
||||
|
||||
@@ -52,13 +52,6 @@ struct Converter<blink::WebMouseWheelEvent> {
|
||||
blink::WebMouseWheelEvent* out);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Converter<blink::WebSize> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
blink::WebSize* out);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Converter<blink::DeviceEmulationParams> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
|
||||
@@ -21,61 +21,6 @@
|
||||
#include "ui/events/keycodes/dom/keycode_converter.h"
|
||||
#include "ui/events/keycodes/keyboard_code_conversion.h"
|
||||
|
||||
namespace {
|
||||
|
||||
void ExecuteCommand(content::WebContents* web_contents,
|
||||
int action,
|
||||
const GURL& link_followed) {
|
||||
web_contents->ExecuteCustomContextMenuCommand(action, link_followed);
|
||||
}
|
||||
|
||||
// Forward declaration for nested recursive call.
|
||||
v8::Local<v8::Value> MenuToV8(v8::Isolate* isolate,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& link_followed,
|
||||
const std::vector<blink::MenuItem>& menu);
|
||||
|
||||
v8::Local<v8::Value> MenuItemToV8(v8::Isolate* isolate,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& link_followed,
|
||||
const blink::MenuItem& item) {
|
||||
gin_helper::Dictionary v8_item = gin::Dictionary::CreateEmpty(isolate);
|
||||
switch (item.type) {
|
||||
case blink::MenuItem::CHECKABLE_OPTION:
|
||||
case blink::MenuItem::GROUP:
|
||||
v8_item.Set("checked", item.checked);
|
||||
FALLTHROUGH;
|
||||
case blink::MenuItem::OPTION:
|
||||
case blink::MenuItem::SUBMENU:
|
||||
v8_item.Set("label", item.label);
|
||||
v8_item.Set("enabled", item.enabled);
|
||||
FALLTHROUGH;
|
||||
default:
|
||||
v8_item.Set("type", item.type);
|
||||
}
|
||||
if (item.type == blink::MenuItem::SUBMENU)
|
||||
v8_item.Set("submenu",
|
||||
MenuToV8(isolate, web_contents, link_followed, item.submenu));
|
||||
else if (item.action > 0)
|
||||
v8_item.Set("click", base::BindRepeating(ExecuteCommand, web_contents,
|
||||
item.action, link_followed));
|
||||
return v8_item.GetHandle();
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> MenuToV8(v8::Isolate* isolate,
|
||||
content::WebContents* web_contents,
|
||||
const GURL& link_followed,
|
||||
const std::vector<blink::MenuItem>& menu) {
|
||||
std::vector<v8::Local<v8::Value>> v8_menu;
|
||||
v8_menu.reserve(menu.size());
|
||||
for (const auto& menu_item : menu)
|
||||
v8_menu.push_back(
|
||||
MenuItemToV8(isolate, web_contents, link_followed, menu_item));
|
||||
return gin::ConvertToV8(isolate, v8_menu);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace gin {
|
||||
|
||||
template <>
|
||||
@@ -110,19 +55,19 @@ struct Converter<ui::MenuSourceType> {
|
||||
};
|
||||
|
||||
// static
|
||||
v8::Local<v8::Value> Converter<blink::MenuItem::Type>::ToV8(
|
||||
v8::Local<v8::Value> Converter<blink::mojom::MenuItem::Type>::ToV8(
|
||||
v8::Isolate* isolate,
|
||||
const blink::MenuItem::Type& val) {
|
||||
const blink::mojom::MenuItem::Type& val) {
|
||||
switch (val) {
|
||||
case blink::MenuItem::CHECKABLE_OPTION:
|
||||
case blink::mojom::MenuItem::Type::kCheckableOption:
|
||||
return StringToV8(isolate, "checkbox");
|
||||
case blink::MenuItem::GROUP:
|
||||
case blink::mojom::MenuItem::Type::kGroup:
|
||||
return StringToV8(isolate, "radio");
|
||||
case blink::MenuItem::SEPARATOR:
|
||||
case blink::mojom::MenuItem::Type::kSeparator:
|
||||
return StringToV8(isolate, "separator");
|
||||
case blink::MenuItem::SUBMENU:
|
||||
case blink::mojom::MenuItem::Type::kSubMenu:
|
||||
return StringToV8(isolate, "submenu");
|
||||
case blink::MenuItem::OPTION:
|
||||
case blink::mojom::MenuItem::Type::kOption:
|
||||
default:
|
||||
return StringToV8(isolate, "normal");
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "content/public/common/referrer.h"
|
||||
#include "content/public/common/stop_find_action.h"
|
||||
#include "gin/converter.h"
|
||||
#include "third_party/blink/public/common/context_menu_data/menu_item.h"
|
||||
#include "third_party/blink/public/mojom/choosers/popup_menu.mojom.h"
|
||||
#include "third_party/blink/public/mojom/permissions/permission_status.mojom.h"
|
||||
|
||||
namespace content {
|
||||
@@ -26,9 +26,9 @@ using ContextMenuParamsWithWebContents =
|
||||
namespace gin {
|
||||
|
||||
template <>
|
||||
struct Converter<blink::MenuItem::Type> {
|
||||
struct Converter<blink::mojom::MenuItem::Type> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const blink::MenuItem::Type& val);
|
||||
const blink::mojom::MenuItem::Type& val);
|
||||
};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "gin/converter.h"
|
||||
#include "shell/common/gin_converters/std_converter.h"
|
||||
|
||||
namespace gin {
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
#include "gin/converter.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "base/strings/string_util_win.h"
|
||||
#endif
|
||||
|
||||
namespace gin {
|
||||
|
||||
// Make it possible to convert move-only types.
|
||||
@@ -182,6 +186,30 @@ struct Converter<std::map<K, V>> {
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(OS_WIN)
|
||||
template <>
|
||||
struct Converter<std::wstring> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const std::wstring& val) {
|
||||
return Converter<std::u16string>::ToV8(isolate, base::AsString16(val));
|
||||
}
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
std::wstring* out) {
|
||||
if (!val->IsString())
|
||||
return false;
|
||||
|
||||
std::u16string str;
|
||||
if (Converter<std::u16string>::FromV8(isolate, val, &str)) {
|
||||
*out = base::AsWString(str);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace gin
|
||||
|
||||
#endif // SHELL_COMMON_GIN_CONVERTERS_STD_CONVERTER_H_
|
||||
|
||||
@@ -138,7 +138,7 @@ ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& s,
|
||||
|
||||
} // namespace
|
||||
|
||||
ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted) {
|
||||
ui::KeyboardCode KeyboardCodeFromCharCode(char16_t c, bool* shifted) {
|
||||
c = base::ToLowerASCII(c);
|
||||
*shifted = false;
|
||||
switch (c) {
|
||||
|
||||
@@ -7,14 +7,13 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/strings/string16.h"
|
||||
#include "ui/events/keycodes/keyboard_codes.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
// Return key code of the char, and also determine whether the SHIFT key is
|
||||
// pressed.
|
||||
ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted);
|
||||
ui::KeyboardCode KeyboardCodeFromCharCode(char16_t c, bool* shifted);
|
||||
|
||||
// Return key code of the |str|, and also determine whether the SHIFT key is
|
||||
// pressed.
|
||||
|
||||
@@ -8,19 +8,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/strings/string16.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
// Return a list of user preferred languages from OS. The list doesn't include
|
||||
// overrides from command line arguments.
|
||||
std::vector<std::string> GetPreferredLanguages();
|
||||
|
||||
#if defined(OS_WIN)
|
||||
bool GetPreferredLanguagesUsingGlobalization(
|
||||
std::vector<base::string16>* languages);
|
||||
#endif
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // SHELL_COMMON_LANGUAGE_UTIL_H_
|
||||
|
||||
@@ -16,24 +16,8 @@
|
||||
|
||||
namespace electron {
|
||||
|
||||
std::vector<std::string> GetPreferredLanguages() {
|
||||
std::vector<base::string16> languages16;
|
||||
|
||||
// Attempt to use API available on Windows 10 or later, which
|
||||
// returns the full list of language preferences.
|
||||
if (!GetPreferredLanguagesUsingGlobalization(&languages16)) {
|
||||
base::win::i18n::GetThreadPreferredUILanguageList(&languages16);
|
||||
}
|
||||
|
||||
std::vector<std::string> languages;
|
||||
for (const auto& language : languages16) {
|
||||
languages.push_back(base::SysWideToUTF8(language));
|
||||
}
|
||||
return languages;
|
||||
}
|
||||
|
||||
bool GetPreferredLanguagesUsingGlobalization(
|
||||
std::vector<base::string16>* languages) {
|
||||
std::vector<std::wstring>* languages) {
|
||||
if (base::win::GetVersion() < base::win::Version::WIN10)
|
||||
return false;
|
||||
if (!base::win::ResolveCoreWinRTDelayload() ||
|
||||
@@ -73,4 +57,20 @@ bool GetPreferredLanguagesUsingGlobalization(
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> GetPreferredLanguages() {
|
||||
std::vector<std::wstring> languages16;
|
||||
|
||||
// Attempt to use API available on Windows 10 or later, which
|
||||
// returns the full list of language preferences.
|
||||
if (!GetPreferredLanguagesUsingGlobalization(&languages16)) {
|
||||
base::win::i18n::GetThreadPreferredUILanguageList(&languages16);
|
||||
}
|
||||
|
||||
std::vector<std::string> languages;
|
||||
for (const auto& language : languages16) {
|
||||
languages.push_back(base::SysWideToUTF8(language));
|
||||
}
|
||||
return languages;
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
||||
@@ -214,7 +214,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
|
||||
|
||||
@@ -11,10 +11,6 @@
|
||||
#include "base/files/file_path.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "base/strings/string16.h"
|
||||
#endif
|
||||
|
||||
class GURL;
|
||||
|
||||
namespace platform_util {
|
||||
|
||||
@@ -242,10 +242,10 @@ std::string OpenExternalOnWorkerThread(
|
||||
// Quote the input scheme to be sure that the command does not have
|
||||
// parameters unexpected by the external program. This url should already
|
||||
// have been escaped.
|
||||
base::string16 escaped_url =
|
||||
L"\"" + base::UTF8ToUTF16(net::EscapeExternalHandlerValue(url.spec())) +
|
||||
std::wstring escaped_url =
|
||||
L"\"" + base::UTF8ToWide(net::EscapeExternalHandlerValue(url.spec())) +
|
||||
L"\"";
|
||||
base::string16 working_dir = options.working_dir.value();
|
||||
std::wstring working_dir = options.working_dir.value();
|
||||
|
||||
if (reinterpret_cast<ULONG_PTR>(
|
||||
ShellExecuteW(nullptr, L"open", escaped_url.c_str(), nullptr,
|
||||
|
||||
@@ -257,7 +257,9 @@ v8::Local<v8::Value> V8ValueConverter::ToArrayBuffer(
|
||||
}
|
||||
auto context = isolate->GetCurrentContext();
|
||||
auto array_buffer = v8::ArrayBuffer::New(isolate, length);
|
||||
memcpy(array_buffer->GetContents().Data(), data, length);
|
||||
std::shared_ptr<v8::BackingStore> backing_store =
|
||||
array_buffer->GetBackingStore();
|
||||
memcpy(backing_store->Data(), data, length);
|
||||
// From this point, if something goes wrong(can't find Buffer class for
|
||||
// example) we'll simply return a Uint8Array based on the created ArrayBuffer.
|
||||
// This can happen if no preload script was specified to the renderer.
|
||||
|
||||
Reference in New Issue
Block a user