|
@@ -21,7 +21,7 @@ struct Converter<base::Time> {
|
|
|
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
|
|
const base::Time& val) {
|
|
|
v8::MaybeLocal<v8::Value> date = v8::Date::New(
|
|
|
- isolate->GetCurrentContext(), val.ToJsTime());
|
|
|
+ isolate->GetCurrentContext(), val.ToJsTime());
|
|
|
if (date.IsEmpty())
|
|
|
return v8::Null(isolate);
|
|
|
else
|
|
@@ -49,11 +49,12 @@ void AutoUpdater::OnError(const std::string& message) {
|
|
|
v8::HandleScope handle_scope(isolate());
|
|
|
auto error = v8::Exception::Error(mate::StringToV8(isolate(), message));
|
|
|
mate::EmitEvent(
|
|
|
- isolate(),
|
|
|
- GetWrapper(),
|
|
|
- "error",
|
|
|
- error->ToObject(isolate()->GetCurrentContext()).ToLocalChecked(),
|
|
|
- message);
|
|
|
+ isolate(),
|
|
|
+ GetWrapper(),
|
|
|
+ "error",
|
|
|
+ error->ToObject(isolate()->GetCurrentContext()).ToLocalChecked(),
|
|
|
+ // Message is also emitted to keep compatibility with old code.
|
|
|
+ message);
|
|
|
}
|
|
|
|
|
|
void AutoUpdater::OnError(const std::string& 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() {
|
|
@@ -122,13 +124,13 @@ mate::Handle<AutoUpdater> AutoUpdater::Create(v8::Isolate* isolate) {
|
|
|
|
|
|
// static
|
|
|
void AutoUpdater::BuildPrototype(
|
|
|
- v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype) {
|
|
|
+ v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype) {
|
|
|
prototype->SetClassName(mate::StringToV8(isolate, "AutoUpdater"));
|
|
|
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
|
|
- .SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates)
|
|
|
- .SetMethod("getFeedURL", &auto_updater::AutoUpdater::GetFeedURL)
|
|
|
- .SetMethod("setFeedURL", &AutoUpdater::SetFeedURL)
|
|
|
- .SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall);
|
|
|
+ .SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates)
|
|
|
+ .SetMethod("getFeedURL", &auto_updater::AutoUpdater::GetFeedURL)
|
|
|
+ .SetMethod("setFeedURL", &AutoUpdater::SetFeedURL)
|
|
|
+ .SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall);
|
|
|
}
|
|
|
|
|
|
} // namespace api
|