Indenting stuff

This commit is contained in:
Samuel Attard 2017-07-27 11:52:19 +10:00
parent ed717a9b45
commit f385e19594
4 changed files with 25 additions and 20 deletions

View file

@ -53,6 +53,7 @@ void AutoUpdater::OnError(const std::string& message) {
GetWrapper(),
"error",
error->ToObject(isolate()->GetCurrentContext()).ToLocalChecked(),
// Message is also emitted to keep compatibility with old code.
message);
}
@ -89,8 +90,9 @@ void AutoUpdater::OnUpdateDownloaded(const std::string& release_notes,
const std::string& release_name,
const base::Time& release_date,
const std::string& url) {
Emit("update-downloaded", release_notes, release_name, release_date,
url, base::Bind(&AutoUpdater::QuitAndInstall, base::Unretained(this)));
Emit("update-downloaded", release_notes, release_name, release_date, url,
// Keep compatibility with old APIs.
base::Bind(&AutoUpdater::QuitAndInstall, base::Unretained(this)));
}
void AutoUpdater::OnWindowAllClosed() {

View file

@ -32,8 +32,8 @@ class AutoUpdater : public mate::EventEmitter<AutoUpdater>,
// Delegate implementations.
void OnError(const std::string& error) override;
void OnError(const std::string& message,
const int code, const std::string& domain);
void OnError(const std::string& message, const int code,
const std::string& domain);
void OnCheckingForUpdate() override;
void OnUpdateAvailable() override;
void OnUpdateNotAvailable() override;

View file

@ -22,8 +22,8 @@ class Delegate {
// An error happened.
virtual void OnError(const std::string& error) {}
virtual void OnError(const std::string& error,
const int code, const std::string& domain) {}
virtual void OnError(const std::string& error, const int code,
const std::string& domain) {}
// Checking to see if there is an update
virtual void OnCheckingForUpdate() {}

View file

@ -104,7 +104,8 @@ void AutoUpdater::CheckForUpdates() {
delegate->OnUpdateNotAvailable();
}
} error:^(NSError *error) {
NSMutableString *failureString = [NSMutableString stringWithString:error.localizedDescription];
NSMutableString *failureString =
[NSMutableString stringWithString:error.localizedDescription];
if (error.localizedFailureReason) {
[failureString appendString:@": "];
[failureString appendString:error.localizedFailureReason];
@ -115,7 +116,8 @@ void AutoUpdater::CheckForUpdates() {
[failureString appendString:@" "];
[failureString appendString:error.localizedRecoverySuggestion];
}
delegate->OnError(base::SysNSStringToUTF8(failureString), error.code, base::SysNSStringToUTF8(error.domain));
delegate->OnError(base::SysNSStringToUTF8(failureString), error.code,
base::SysNSStringToUTF8(error.domain));
}];
}
@ -124,7 +126,8 @@ void AutoUpdater::QuitAndInstall() {
if (g_update_available) {
[[g_updater relaunchToInstallUpdate] subscribeError:^(NSError* error) {
if (delegate)
delegate->OnError(base::SysNSStringToUTF8(error.localizedDescription), error.code, base::SysNSStringToUTF8(error.domain));
delegate->OnError(base::SysNSStringToUTF8(error.localizedDescription),
error.code, base::SysNSStringToUTF8(error.domain));
}];
} else {
if (delegate)