1// Copyright (c) 2012 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// File Description:
6//     Contains all the necessary functions for rendering the Welcome page on
7//     Android.
8
9cr.define('welcome', function() {
10  'use strict';
11
12  function initialize() {
13    // Disable context menus.
14    document.body.oncontextmenu = function(e) {
15      e.preventDefault();
16    }
17
18    $('settings').onclick = function() {
19      chrome.send('showSyncSettings');
20    };
21
22    var tosLink = $('tos-link');
23    if (tosLink) {
24      tosLink.onclick = function() {
25        chrome.send('showTermsOfService');
26      };
27    }
28
29    // Set visibility of terms of service footer.
30    $('tos-footer').hidden = !loadTimeData.getBoolean('tosVisible');
31
32    // Set the initial visibility for the sync footer.
33    chrome.send('updateSyncFooterVisibility');
34  }
35
36  /**
37   * Sets the visibility of the sync footer.
38   * @param {boolean} isVisible Whether the sync footer should be visible.
39   */
40  function setSyncFooterVisible(isVisible) {
41    $('sync-footer').hidden = !isVisible;
42  }
43
44  // Return an object with all of the exports.
45  return {
46    initialize: initialize,
47    setSyncFooterVisible: setSyncFooterVisible,
48  };
49});
50
51document.addEventListener('DOMContentLoaded', welcome.initialize);
52