mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
refactor: narrow or remove gin arguments (#48300)
* refactor: narrow App:SetJumpList() arg from gin::Arguments* to v8::Isolate* * refactor: narrow WebContents::AddWorkSpace() arg from gin::Arguments* to v8::Isolate* * refactor: narrow ShowMessageBox() arg from gin::Arguments* to v8::Isolate* * refactor: narrow ShowOpenDialog() arg from gin::Arguments* to v8::Isolate* * refactor: remove unused gin::Arguments* arg from OverrideGlobalPropertyFromIsolatedWorld() * refactor: narrow WebContents::StartDrag() arg from gin::Arguments* to v8::Isolate* * refactor: narrow NetLog::StopLogging() arg from gin::Arguments* to v8::Isolate* * refactor: narrow Protocol::IsProtocolHandled() arg from gin::Arguments* to v8::Isolate*
This commit is contained in:
@@ -3259,21 +3259,19 @@ v8::Local<v8::Promise> WebContents::PrintToPDF(const base::Value& settings) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void WebContents::AddWorkSpace(gin::Arguments* args,
|
||||
void WebContents::AddWorkSpace(v8::Isolate* const isolate,
|
||||
const base::FilePath& path) {
|
||||
if (path.empty()) {
|
||||
gin_helper::ErrorThrower(args->isolate())
|
||||
.ThrowError("path cannot be empty");
|
||||
gin_helper::ErrorThrower{isolate}.ThrowError("path cannot be empty");
|
||||
return;
|
||||
}
|
||||
DevToolsAddFileSystem(std::string(), path);
|
||||
}
|
||||
|
||||
void WebContents::RemoveWorkSpace(gin::Arguments* args,
|
||||
void WebContents::RemoveWorkSpace(v8::Isolate* const isolate,
|
||||
const base::FilePath& path) {
|
||||
if (path.empty()) {
|
||||
gin_helper::ErrorThrower(args->isolate())
|
||||
.ThrowError("path cannot be empty");
|
||||
gin_helper::ErrorThrower{isolate}.ThrowError("path cannot be empty");
|
||||
return;
|
||||
}
|
||||
DevToolsRemoveFileSystem(path);
|
||||
@@ -3508,8 +3506,8 @@ void WebContents::EndFrameSubscription() {
|
||||
frame_subscriber_.reset();
|
||||
}
|
||||
|
||||
void WebContents::StartDrag(const gin_helper::Dictionary& item,
|
||||
gin::Arguments* args) {
|
||||
void WebContents::StartDrag(v8::Isolate* const isolate,
|
||||
const gin_helper::Dictionary& item) {
|
||||
base::FilePath file;
|
||||
std::vector<base::FilePath> files;
|
||||
if (!item.Get("files", &files) && item.Get("file", &file)) {
|
||||
@@ -3518,13 +3516,13 @@ void WebContents::StartDrag(const gin_helper::Dictionary& item,
|
||||
|
||||
v8::Local<v8::Value> icon_value;
|
||||
if (!item.Get("icon", &icon_value)) {
|
||||
gin_helper::ErrorThrower(args->isolate())
|
||||
.ThrowError("'icon' parameter is required");
|
||||
gin_helper::ErrorThrower{isolate}.ThrowError(
|
||||
"'icon' parameter is required");
|
||||
return;
|
||||
}
|
||||
|
||||
NativeImage* icon = nullptr;
|
||||
if (!NativeImage::TryConvertNativeImage(args->isolate(), icon_value, &icon) ||
|
||||
if (!NativeImage::TryConvertNativeImage(isolate, icon_value, &icon) ||
|
||||
icon->image().IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -3534,8 +3532,8 @@ void WebContents::StartDrag(const gin_helper::Dictionary& item,
|
||||
base::CurrentThread::ScopedAllowApplicationTasksInNativeNestedLoop allow;
|
||||
DragFileItems(files, icon->image(), web_contents()->GetNativeView());
|
||||
} else {
|
||||
gin_helper::ErrorThrower(args->isolate())
|
||||
.ThrowError("Must specify either 'file' or 'files' option");
|
||||
gin_helper::ErrorThrower{isolate}.ThrowError(
|
||||
"Must specify either 'file' or 'files' option");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user