Home | History | Annotate | Download | only in resources
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 cr.define('profile_signin_confirmation', function() {
      6   'use strict';
      7 
      8   function initialize() {
      9     var args = JSON.parse(chrome.getVariableValue('dialogArguments'));
     10     $('dialog-message').textContent = loadTimeData.getStringF(
     11         'dialogMessage', args.username);
     12     $('dialog-prompt').textContent = loadTimeData.getStringF(
     13         'dialogPrompt', args.username);
     14     $('create-button').addEventListener('click', function() {
     15       chrome.send('createNewProfile');
     16     });
     17     $('continue-button').addEventListener('click', function() {
     18       chrome.send('continue');
     19     });
     20     $('cancel-button').addEventListener('click', function() {
     21       chrome.send('cancel');
     22     });
     23 
     24     if (args.promptForNewProfile) {
     25       $('continue-button').innerText =
     26           loadTimeData.getStringF('continueButtonText');
     27     } else {
     28       $('create-button').hidden = true;
     29       $('dialog-prompt').hidden = true;
     30       $('continue-button').innerText =
     31           loadTimeData.getStringF('okButtonText');
     32       // Right-align the buttons when only "OK" and "Cancel" are showing.
     33       $('button-row').style['text-align'] = 'end';
     34     }
     35 
     36     if (args.hideTitle)
     37       $('dialog-title').hidden = true;
     38   }
     39 
     40   return {
     41     initialize: initialize
     42   };
     43 });
     44 
     45 document.addEventListener('DOMContentLoaded',
     46                           profile_signin_confirmation.initialize);
     47