summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/profile_signin_confirmation.js
blob: 6591fac862c876e6f29512627ed4188d3c1b62a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

cr.define('profile_signin_confirmation', function() {
  'use strict';

  function initialize() {
    var args = JSON.parse(chrome.getVariableValue('dialogArguments'));
    $('dialog-message').textContent = loadTimeData.getStringF(
        'dialogMessage', args.username);
    $('dialog-prompt').textContent = loadTimeData.getStringF(
        'dialogPrompt', args.username);
    $('create-button').addEventListener('click', function() {
      chrome.send('createNewProfile');
    });
    $('continue-button').addEventListener('click', function() {
      chrome.send('continue');
    });
    $('cancel-button').addEventListener('click', function() {
      chrome.send('cancel');
    });

    if (args.promptForNewProfile) {
      $('continue-button').innerText =
          loadTimeData.getStringF('continueButtonText');
    } else {
      $('create-button').hidden = true;
      $('dialog-prompt').hidden = true;
      $('continue-button').innerText =
          loadTimeData.getStringF('okButtonText');
      // Right-align the buttons when only "OK" and "Cancel" are showing.
      $('button-row').style['text-align'] = 'end';
    }

    if (args.hideTitle)
      $('dialog-title').hidden = true;
  }

  return {
    initialize: initialize
  };
});

document.addEventListener('DOMContentLoaded',
                          profile_signin_confirmation.initialize);