Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1136)

Unified Diff: remoting/webapp/remoting.js

Issue 435043002: Fix Chromoting client to choose correct OS-specific key filter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing brackets Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/client_screen.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/remoting.js
diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js
index c6429a5c196016689427530b88fa6bcbdb693261..7bc5931f39cd84a2eef796cf3922078992e1646f 100644
--- a/remoting/webapp/remoting.js
+++ b/remoting/webapp/remoting.js
@@ -150,7 +150,7 @@ remoting.init = function() {
// For Apps v1, check the tab type to warn the user if they are not getting
// the best keyboard experience.
- if (!remoting.isAppsV2 && navigator.platform.indexOf('Mac') == -1) {
+ if (!remoting.isAppsV2 && !remoting.platformIsMac()) {
/** @param {boolean} isWindowed */
var onIsWindowed = function(isWindowed) {
if (!isWindowed) {
@@ -189,14 +189,12 @@ function isIT2MeSupported_() {
* @return {boolean}
*/
remoting.isMe2MeInstallable = function() {
- /** @type {string} */
- var platform = navigator.platform;
// The chromoting host is currently not installable on ChromeOS.
// For Linux, we have a install package for Ubuntu but not other distros.
// Since we cannot tell from javascript alone the Linux distro the client is
// on, we don't show the daemon-control UI for Linux unless the host is
// installed.
- return platform == 'Win32' || platform == 'MacIntel';
+ return remoting.platformIsWindows() || remoting.platformIsMac();
}
/**
@@ -527,3 +525,40 @@ remoting.generateXsrfToken = function() {
var base64Token = window.btoa(String.fromCharCode.apply(null, random));
return base64Token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
};
+
+/**
+ * Tests whether we are running on Mac.
+ *
+ * @return {bool} True if the platform is Mac.
+ */
+remoting.platformIsMac = function() {
+ return navigator.platform.indexOf('Mac') != -1;
+}
+
+/**
+ * Tests whether we are running on Windows.
+ *
+ * @return {bool} True if the platform is Windows.
+ */
+remoting.platformIsWindows = function() {
+ return navigator.platform.indexOf('Win32') != -1;
+}
+
+/**
+ * Tests whether we are running on Linux.
+ *
+ * @return {bool} True if the platform is Linux.
+ */
+remoting.platformIsLinux = function() {
+ return (navigator.platform.indexOf('Linux') != -1) &&
+ !remoting.platformIsChromeOS();
+}
+
+/**
+ * Tests whether we are running on ChromeOS.
+ *
+ * @return {bool} True if the platform is ChromeOS.
+ */
+remoting.platformIsChromeOS = function() {
+ return navigator.userAgent.match(/\bCrOS\b/);
+}
« no previous file with comments | « remoting/webapp/client_screen.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698