Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / remoting / webapp / base / js / platform.js
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 'use strict';
6
7 /** @suppress {duplicate} */
8 var remoting = remoting || {};
9
10 /**
11  * Returns full Chrome version.
12  * @return {string?}
13  */
14 remoting.getChromeVersion = function() {
15   var match = new RegExp('Chrome/([0-9.]*)').exec(navigator.userAgent);
16   if (match && (match.length >= 2)) {
17     return match[1];
18   }
19   return null;
20 };
21
22 /**
23  * Returns Chrome major version.
24  * @return {number}
25  */
26 remoting.getChromeMajorVersion = function() {
27   var match = new RegExp('Chrome/([0-9]+)\.').exec(navigator.userAgent);
28   if (match && (match.length >= 2)) {
29     return parseInt(match[1], 10);
30   }
31   return 0;
32 };