refactor: use gin_helper::Dictionary::CreateEmpty() helper (#40140)
This commit is contained in:
parent
47beca1d2a
commit
563c370d51
17 changed files with 30 additions and 42 deletions
|
@ -246,8 +246,7 @@ void FileChooserDialog::OnFileDialogResponse(GtkWidget* widget, int response) {
|
|||
v8::Isolate* isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
if (save_promise_) {
|
||||
gin_helper::Dictionary dict =
|
||||
gin::Dictionary::CreateEmpty(save_promise_->isolate());
|
||||
auto dict = gin_helper::Dictionary::CreateEmpty(save_promise_->isolate());
|
||||
if (response == GTK_RESPONSE_ACCEPT) {
|
||||
dict.Set("canceled", false);
|
||||
dict.Set("filePath", GetFileName());
|
||||
|
@ -257,8 +256,7 @@ void FileChooserDialog::OnFileDialogResponse(GtkWidget* widget, int response) {
|
|||
}
|
||||
save_promise_->Resolve(dict);
|
||||
} else if (open_promise_) {
|
||||
gin_helper::Dictionary dict =
|
||||
gin::Dictionary::CreateEmpty(open_promise_->isolate());
|
||||
auto dict = gin_helper::Dictionary::CreateEmpty(open_promise_->isolate());
|
||||
if (response == GTK_RESPONSE_ACCEPT) {
|
||||
dict.Set("canceled", false);
|
||||
dict.Set("filePaths", GetFileNames());
|
||||
|
|
|
@ -353,7 +353,7 @@ void OpenDialogCompletion(int chosen,
|
|||
bool security_scoped_bookmarks,
|
||||
gin_helper::Promise<gin_helper::Dictionary> promise) {
|
||||
v8::HandleScope scope(promise.isolate());
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(promise.isolate());
|
||||
auto dict = gin_helper::Dictionary::CreateEmpty(promise.isolate());
|
||||
if (chosen == NSModalResponseCancel) {
|
||||
dict.Set("canceled", true);
|
||||
dict.Set("filePaths", std::vector<base::FilePath>());
|
||||
|
@ -431,7 +431,7 @@ void SaveDialogCompletion(int chosen,
|
|||
bool security_scoped_bookmarks,
|
||||
gin_helper::Promise<gin_helper::Dictionary> promise) {
|
||||
v8::HandleScope scope(promise.isolate());
|
||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(promise.isolate());
|
||||
auto dict = gin_helper::Dictionary::CreateEmpty(promise.isolate());
|
||||
if (chosen == NSModalResponseCancel) {
|
||||
dict.Set("canceled", true);
|
||||
dict.Set("filePath", base::FilePath());
|
||||
|
|
|
@ -220,7 +220,7 @@ void ShowOpenDialog(const DialogSettings& settings,
|
|||
auto done = [](gin_helper::Promise<gin_helper::Dictionary> promise,
|
||||
bool success, std::vector<base::FilePath> result) {
|
||||
v8::HandleScope handle_scope(promise.isolate());
|
||||
gin::Dictionary dict = gin::Dictionary::CreateEmpty(promise.isolate());
|
||||
auto dict = gin::Dictionary::CreateEmpty(promise.isolate());
|
||||
dict.Set("canceled", !success);
|
||||
dict.Set("filePaths", result);
|
||||
promise.Resolve(dict);
|
||||
|
@ -269,7 +269,7 @@ void ShowSaveDialog(const DialogSettings& settings,
|
|||
auto done = [](gin_helper::Promise<gin_helper::Dictionary> promise,
|
||||
bool success, base::FilePath result) {
|
||||
v8::HandleScope handle_scope(promise.isolate());
|
||||
gin::Dictionary dict = gin::Dictionary::CreateEmpty(promise.isolate());
|
||||
auto dict = gin::Dictionary::CreateEmpty(promise.isolate());
|
||||
dict.Set("canceled", !success);
|
||||
dict.Set("filePath", result);
|
||||
promise.Resolve(dict);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue