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.
7 /** @suppress {duplicate} */
8 var remoting
= remoting
|| {};
11 * Returns full Chrome version.
14 remoting
.getChromeVersion = function() {
15 var match
= new RegExp('Chrome/([0-9.]*)').exec(navigator
.userAgent
);
16 if (match
&& (match
.length
>= 2)) {
23 * Returns Chrome major version.
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);
35 * Tests whether we are running on Mac.
37 * @return {boolean} True if the platform is Mac.
39 remoting
.platformIsMac = function() {
40 return navigator
.platform
.indexOf('Mac') != -1;
44 * Tests whether we are running on Windows.
46 * @return {boolean} True if the platform is Windows.
48 remoting
.platformIsWindows = function() {
49 return (navigator
.platform
.indexOf('Win32') != -1) ||
50 (navigator
.platform
.indexOf('Win64') != -1);
54 * Tests whether we are running on Linux.
56 * @return {boolean} True if the platform is Linux.
58 remoting
.platformIsLinux = function() {
59 return (navigator
.platform
.indexOf('Linux') != -1) &&
60 !remoting
.platformIsChromeOS();
64 * Tests whether we are running on ChromeOS.
66 * @return {boolean} True if the platform is ChromeOS.
68 remoting
.platformIsChromeOS = function() {
69 return navigator
.userAgent
.match(/\bCrOS\b/) != null;