From cc4897f8c1486e28b685069d57242ed616849ddc Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 2 Oct 2014 23:48:17 +0800 Subject: [PATCH] Add process.versions['chrome'], fixes #675 --- atom/common/api/atom_bindings.cc | 6 +++++- docs/api/process.md | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/atom/common/api/atom_bindings.cc b/atom/common/api/atom_bindings.cc index 0390d863a696..8fdc6d03ce21 100644 --- a/atom/common/api/atom_bindings.cc +++ b/atom/common/api/atom_bindings.cc @@ -8,6 +8,7 @@ #include #include "atom/common/atom_version.h" +#include "atom/common/chrome_version.h" #include "atom/common/native_mate_converters/string16_converter.h" #include "base/logging.h" #include "native_mate/callback.h" @@ -78,9 +79,12 @@ void AtomBindings::BindTo(v8::Isolate* isolate, base::Bind(&AtomBindings::ActivateUVLoop, base::Unretained(this))); v8::Handle versions; - if (dict.Get("versions", &versions)) + if (dict.Get("versions", &versions)) { versions->Set(mate::StringToV8(isolate, "atom-shell"), mate::StringToV8(isolate, ATOM_VERSION_STRING)); + versions->Set(mate::StringToV8(isolate, "chrome"), + mate::StringToV8(isolate, CHROME_VERSION_STRING)); + } } void AtomBindings::ActivateUVLoop(v8::Isolate* isolate) { diff --git a/docs/api/process.md b/docs/api/process.md index 31fb95ce3523..7669ef7cf7f7 100644 --- a/docs/api/process.md +++ b/docs/api/process.md @@ -5,4 +5,5 @@ upstream node: * `process.type` String - Process's type, can be `browser` or `renderer`. * `process.versions['atom-shell']` String - Version of atom-shell. +* `process.versions['chrome']` String - Version of Chromium. * `process.resourcesPath` String - Path to JavaScript source codes.