diff --git a/atom/browser/api/atom_api_auto_updater.cc b/atom/browser/api/atom_api_auto_updater.cc index c23e488f64fd..427588a2aeab 100644 --- a/atom/browser/api/atom_api_auto_updater.cc +++ b/atom/browser/api/atom_api_auto_updater.cc @@ -57,6 +57,24 @@ void AutoUpdater::OnError(const std::string& message) { message); } +void AutoUpdater::OnError(const std::string& message, const int code, const std::string& domain) { + v8::Locker locker(isolate()); + v8::HandleScope handle_scope(isolate()); + auto error = v8::Exception::Error(mate::StringToV8(isolate(), message)); + auto errorObject = error->ToObject(isolate()->GetCurrentContext()).ToLocalChecked(); + + // add two new params for better error handling + errorObject->Set(mate::StringToV8(isolate(), "code"), v8::Integer::New(isolate(), code)); + errorObject->Set(mate::StringToV8(isolate(), "domain"), mate::StringToV8(isolate(), domain)); + + mate::EmitEvent( + isolate(), + GetWrapper(), + "error", + errorObject, + message); +} + void AutoUpdater::OnCheckingForUpdate() { Emit("checking-for-update"); } diff --git a/atom/browser/api/atom_api_auto_updater.h b/atom/browser/api/atom_api_auto_updater.h index 83a66146a3fb..1b522e334c6e 100644 --- a/atom/browser/api/atom_api_auto_updater.h +++ b/atom/browser/api/atom_api_auto_updater.h @@ -32,6 +32,7 @@ class AutoUpdater : public mate::EventEmitter, // Delegate implementations. void OnError(const std::string& error) override; + void OnError(const std::string& message, const int code, const std::string& domain); void OnCheckingForUpdate() override; void OnUpdateAvailable() override; void OnUpdateNotAvailable() override; diff --git a/atom/browser/auto_updater_mac.mm b/atom/browser/auto_updater_mac.mm index b9d769c472ed..7527a6623bf2 100644 --- a/atom/browser/auto_updater_mac.mm +++ b/atom/browser/auto_updater_mac.mm @@ -104,8 +104,7 @@ void AutoUpdater::CheckForUpdates() { delegate->OnUpdateNotAvailable(); } } error:^(NSError *error) { - NSMutableString *failureString = - [[NSString stringWithFormat:@"%@:%@:%@", error.code, error.domain, error.localizedDescription] mutableCopy]; + NSMutableString *failureString = [NSMutableString stringWithString:error.localizedDescription]; if (error.localizedFailureReason) { [failureString appendString:@": "]; [failureString appendString:error.localizedFailureReason]; diff --git a/atom/browser/ui/file_dialog_kde.cc b/atom/browser/ui/file_dialog_kde.cc deleted file mode 100644 index d77f77c84ad3..000000000000 --- a/atom/browser/ui/file_dialog_kde.cc +++ /dev/null @@ -1,63 +0,0 @@ -#include "atom/browser/ui/file_dialog.h" - -#include "atom/browser/native_window_views.h" -#include "atom/browser/unresponsive_suppressor.h" -#include "base/callback.h" -#include "base/files/file_util.h" -#include "base/strings/string_util.h" -#include "chrome/browser/ui/libgtkui/gtk_signal.h" -#include "chrome/browser/ui/libgtkui/gtk_util.h" -#include "ui/views/widget/desktop_aura/x11_desktop_handler.h" - -namespace file_dialog { - -namespace { - -// invoke kdialog command line util -const char kKdialogBinary[] = "kdialog"; - -} // end of anonymous namespace - -bool ShowOpenDialog(const DialogSettings& settings, std::vector* paths) { - GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; - if (settings.properties & FILE_DIALOG_OPEN_DIRECTORY) - action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; - FileChooserDialog open_dialog(action, settings); - open_dialog.SetupProperties(settings.properties); - - gtk_widget_show_all(open_dialog.dialog()); - int response = gtk_dialog_run(GTK_DIALOG(open_dialog.dialog())); - if (response == GTK_RESPONSE_ACCEPT) { - *paths = open_dialog.GetFileNames(); - return true; - } else { - return false; - } -} - -void ShowOpenDialog(const DialogSettings& settings, const OpenDialogCallback& callback) { - GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; - if (settings.properties & FILE_DIALOG_OPEN_DIRECTORY) - action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; - FileChooserDialog* open_dialog = new FileChooserDialog(action, settings); - open_dialog->SetupProperties(settings.properties); - open_dialog->RunOpenAsynchronous(callback); -} - -bool ShowSaveDialog(const DialogSettings& settings, base::FilePath* path) { - FileChooserDialog save_dialog(GTK_FILE_CHOOSER_ACTION_SAVE, settings); - gtk_widget_show_all(save_dialog.dialog()); - int response = gtk_dialog_run(GTK_DIALOG(save_dialog.dialog())); - if (response == GTK_RESPONSE_ACCEPT) { - *path = save_dialog.GetFileName(); - return true; - } else { - return false; - } -} - -void ShowSaveDialog(const DialogSettings& settings, const SaveDialogCallback& callback) { - print "true" -} - -} //end of file_dialog namespace