Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / chromeos / login / screen_account_picker.js
index 49cad85..606fd19 100644 (file)
@@ -23,6 +23,9 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() {
   return {
     EXTERNAL_API: [
       'loadUsers',
+      'runAppForTesting',
+      'setApps',
+      'showAppError',
       'updateUserImage',
       'forceOnlineSignin',
       'setCapsLockState',
@@ -78,7 +81,7 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() {
     /* Cancel user adding if ESC was pressed.
      */
     cancel: function() {
-      if (Oobe.getInstance().displayType() == DISPLAY_TYPE.USER_ADDING)
+      if (Oobe.getInstance().displayType == DISPLAY_TYPE.USER_ADDING)
         chrome.send('cancelUserAdding');
     },
 
@@ -101,13 +104,6 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() {
       var podRow = $('pod-row');
       podRow.handleBeforeShow();
 
-      // If this is showing for the lock screen display the sign out button,
-      // hide the add user button and activate the locked user's pod.
-      var lockedPod = podRow.lockedPod;
-      $('add-user-header-bar-item').hidden = !!lockedPod;
-      var signOutUserItem = $('sign-out-user-item');
-      if (signOutUserItem)
-        signOutUserItem.hidden = !lockedPod;
       // In case of the preselected pod onShow will be called once pod
       // receives focus.
       if (!podRow.preselectedPod)
@@ -189,6 +185,39 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() {
     },
 
     /**
+     * Runs app with a given id from the list of loaded apps.
+     * @param {!string} app_id of an app to run.
+     * @param {boolean=} opt_diagnostic_mode Whether to run the app in
+     *     diagnostic mode.  Default is false.
+     */
+    runAppForTesting: function(app_id, opt_diagnostic_mode) {
+      $('pod-row').findAndRunAppForTesting(app_id, opt_diagnostic_mode);
+    },
+
+    /**
+     * Adds given apps to the pod row.
+     * @param {array} apps Array of apps.
+     */
+    setApps: function(apps) {
+      $('pod-row').setApps(apps);
+    },
+
+    /**
+     * Shows the given kiosk app error message.
+     * @param {!string} message Error message to show.
+     */
+    showAppError: function(message) {
+      // TODO(nkostylev): Figure out a way to show kiosk app launch error
+      // pointing to the kiosk app pod.
+      /** @const */ var BUBBLE_PADDING = 12;
+      $('bubble').showTextForElement($('pod-row'),
+                                     message,
+                                     cr.ui.Bubble.Attachment.BOTTOM,
+                                     $('pod-row').offsetWidth / 2,
+                                     BUBBLE_PADDING);
+    },
+
+    /**
      * Updates current image of a user.
      * @param {string} username User for which to update the image.
      */