diff --git a/smart_card_connector_app/src/_locales/en/messages.json b/smart_card_connector_app/src/_locales/en/messages.json index 13ccb0aa7..dd71ae558 100644 --- a/smart_card_connector_app/src/_locales/en/messages.json +++ b/smart_card_connector_app/src/_locales/en/messages.json @@ -19,6 +19,10 @@ "message": "Smart Card Connector", "description": "The header displayed in the main window" }, + "nonChromeOsWarning": { + "message": "Warning: The app is intended to be run on Chrome OS only!", + "description": "The text that is displayed as a warning when the app is executed on non-Chrome OS systems" + }, "windowClose": { "message": "Close", "description": "Accessibility text for close button" diff --git a/smart_card_connector_app/src/window-main.js b/smart_card_connector_app/src/window-main.js index 993ef0dda..e70fcd1d9 100644 --- a/smart_card_connector_app/src/window-main.js +++ b/smart_card_connector_app/src/window-main.js @@ -28,6 +28,7 @@ goog.require('GoogleSmartCard.I18n'); goog.require('GoogleSmartCard.Logging'); goog.require('GoogleSmartCard.PopupWindow.Client'); goog.require('goog.dom'); +goog.require('goog.dom.classlist'); goog.require('goog.events'); goog.require('goog.events.EventType'); goog.require('goog.log.Logger'); @@ -45,10 +46,6 @@ var logger = GSC.Logging.getScopedLogger('ConnectorApp.MainWindow'); logger.info('The main window is created'); -function closeWindowClickListener() { - chrome.app.window.current().close(); -} - goog.events.listen( goog.dom.getElement('close-window'), goog.events.EventType.CLICK, @@ -59,8 +56,27 @@ GSC.ConnectorApp.Window.AppsDisplaying.initialize(); GSC.ConnectorApp.Window.DevicesDisplaying.initialize(); GSC.ConnectorApp.Window.LogsExporting.initialize(); +GSC.I18n.adjustElementsTranslation(); + GSC.PopupWindow.Client.showWindow(); -GSC.I18n.adjustElementsTranslation(); +displayNonChromeOsWarningIfNeeded(); + +function closeWindowClickListener() { + chrome.app.window.current().close(); +} + +function displayNonChromeOsWarningIfNeeded() { + chrome.runtime.getPlatformInfo(function(platformInfo) { + /** @type {string} */ + var os = platformInfo['os']; + if (os != 'cros') { + logger.info('Displaying the warning regarding non-Chrome OS system ' + + '(the current OS is "' + os + '")'); + goog.dom.classlist.remove( + goog.dom.getElement('non-chrome-os-warning'), 'hidden'); + } + }); +} }); // goog.scope diff --git a/smart_card_connector_app/src/window.css b/smart_card_connector_app/src/window.css index 54cfb4e3e..2d5881037 100644 --- a/smart_card_connector_app/src/window.css +++ b/smart_card_connector_app/src/window.css @@ -17,6 +17,10 @@ -webkit-user-select: text; } +.hidden { + display: none; +} + html, body, button { @@ -58,6 +62,13 @@ body { -webkit-user-select: none; } +#non-chrome-os-warning { + color: red; + font-size: 15px; + font-weight: 600; + margin-top: 15px; +} + .list-header { color: #4285f4; font-size: 12px; diff --git a/smart_card_connector_app/src/window.html b/smart_card_connector_app/src/window.html index 70910f016..d75f6c1d9 100644 --- a/smart_card_connector_app/src/window.html +++ b/smart_card_connector_app/src/window.html @@ -25,6 +25,8 @@
+ +