Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / remoting / webapp / base / js / platform.js
blob627edccc62620fa134e03b390d4d59332b191f2b
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.
5 'use strict';
7 /** @suppress {duplicate} */
8 var remoting = remoting || {};
10 /**
11 * Returns full Chrome version.
12 * @return {string?}
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];
19 return null;
22 /**
23 * Returns Chrome major version.
24 * @return {number}
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);
31 return 0;
34 /**
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;
43 /**
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);
53 /**
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();
63 /**
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;