Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / login / account_picker / screen_account_picker.js
index 865d64d..41c6a0c 100644 (file)
@@ -41,6 +41,9 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() {
     // Whether this screen is shown for the first time.
     firstShown_: true,
 
+    // Whether this screen is currently being shown.
+    showing_: false,
+
     /** @override */
     decorate: function() {
       login.PodRow.decorate($('pod-row'));
@@ -54,6 +57,12 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() {
     /** @override */
     onWindowResize: function() {
       $('pod-row').onWindowResize();
+
+      // Reposition the error bubble, if it is showing. Since we are just
+      // moving the bubble, the number of login attempts tried doesn't matter.
+      var errorBubble = $('bubble');
+      if (errorBubble && !errorBubble.hidden)
+        this.showErrorBubble(0, undefined  /* Reuses the existing message. */);
     },
 
     /**
@@ -98,6 +107,7 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() {
      * @param {string} data Screen init payload.
      */
     onBeforeShow: function(data) {
+      this.showing_ = true;
       chrome.send('loginUIStateChanged', ['account-picker', true]);
       $('login-header-bar').signinUIState = SIGNIN_UI_STATE.ACCOUNT_PICKER;
       chrome.send('hideCaptivePortal');
@@ -114,6 +124,12 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() {
      * Event handler invoked when the page is shown and ready.
      */
     onShow: function() {
+      if (!this.showing_) {
+        // This method may be called asynchronously when the pod row finishes
+        // initializing. However, at that point, the screen may have been hidden
+        // again already. If that happens, ignore the onShow() call.
+        return;
+      }
       chrome.send('getTouchViewState');
       if (!this.firstShown_) return;
       this.firstShown_ = false;
@@ -129,6 +145,7 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() {
      * Event handler that is invoked just before the frame is hidden.
      */
     onBeforeHide: function() {
+      this.showing_ = false;
       chrome.send('loginUIStateChanged', ['account-picker', false]);
       $('login-header-bar').signinUIState = SIGNIN_UI_STATE.HIDDEN;
       $('pod-row').handleHide();
@@ -348,4 +365,3 @@ login.createScreen('AccountPickerScreen', 'account-picker', function() {
     }
   };
 });
-