Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / chromeos / login / screen_gaia_signin.js
index d4e243a..ea24a66 100644 (file)
@@ -18,10 +18,6 @@ login.createScreen('GaiaSigninScreen', 'gaia-signin', function() {
 
   /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613;
 
-  /** @const */ var NET_ERROR_ABORTED = 3;
-
-  /** @const */ var NET_ERROR_DISALLOWED_URL_SCHEME = 301;
-
   return {
     EXTERNAL_API: [
       'loadAuthExtension',
@@ -97,6 +93,8 @@ login.createScreen('GaiaSigninScreen', 'gaia-signin', function() {
           this.onAuthConfirmPassword_.bind(this);
       this.gaiaAuthHost_.noPasswordCallback =
           this.onAuthNoPassword_.bind(this);
+      this.gaiaAuthHost_.insecureContentBlockedCallback =
+          this.onInsecureContentBlocked_.bind(this);
       this.gaiaAuthHost_.addEventListener('authFlowChange',
           this.onAuthFlowChange_.bind(this));
 
@@ -455,10 +453,26 @@ login.createScreen('GaiaSigninScreen', 'gaia-signin', function() {
     },
 
     /**
+     * Invoked when the authentication flow had to be aborted because content
+     * served over an unencrypted connection was detected. Shows a fatal error.
+     * This method is only called on Chrome OS, where the entire authentication
+     * flow is required to be encrypted.
+     * @param {string} url The URL that was blocked.
+     */
+    onInsecureContentBlocked_: function(url) {
+      this.showFatalAuthError(loadTimeData.getStringF(
+          'fatalErrorMessageInsecureURL',
+          url));
+    },
+
+    /**
      * Shows the fatal auth error.
+     * @param {string} message The error message to show.
      */
-    showFatalAuthError: function() {
-      login.FatalErrorScreen.show(Oobe.showSigninUI);
+    showFatalAuthError: function(message) {
+      if (!message)
+        message = loadTimeData.getString('fatalErrorMessageGeneric');
+      login.FatalErrorScreen.show(message, Oobe.showSigninUI);
     },
 
     /**
@@ -606,19 +620,6 @@ login.createScreen('GaiaSigninScreen', 'gaia-signin', function() {
      * @param {string} url The URL that failed to load.
      */
     onFrameError: function(error, url) {
-      // Chrome OS requires that the entire authentication flow use https. If
-      // GAIA attempts to redirect to an http URL, the load will be blocked by
-      // CSP. Show a fatal error in this case.
-      // Some tests deviate from the above by disabling the CSP and using a
-      // mock GAIA implementation served over http. If an http URL fails to load
-      // in such a test, it has nothing to do with CSP and should not cause a
-      // fatal error to be shown.
-      if (error == NET_ERROR_ABORTED &&
-          url.indexOf('http://') == 0 &&
-          this.gaiaAuthParams_.gaiaUrl.indexOf('https://') == 0) {
-        error = NET_ERROR_DISALLOWED_URL_SCHEME;
-        this.showFatalAuthError();
-      }
       this.error_ = error;
       chrome.send('frameLoadingCompleted', [this.error_]);
     },