summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/about_welcome_android/about_welcome_android.js
blob: b5f65b4ed9eee7634076b26a9cf0bdfd74a105ee (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
47
48
49
50
51
// Copyright (c) 2012 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.

// File Description:
//     Contains all the necessary functions for rendering the Welcome page on
//     Android.

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

  function initialize() {
    // Disable context menus.
    document.body.oncontextmenu = function(e) {
      e.preventDefault();
    }

    $('settings').onclick = function() {
      chrome.send('showSyncSettings');
    };

    var tosLink = $('tos-link');
    if (tosLink) {
      tosLink.onclick = function() {
        chrome.send('showTermsOfService');
      };
    }

    // Set visibility of terms of service footer.
    $('tos-footer').hidden = !loadTimeData.getBoolean('tosVisible');

    // Set the initial visibility for the sync footer.
    chrome.send('updateSyncFooterVisibility');
  }

  /**
   * Sets the visibility of the sync footer.
   * @param {boolean} isVisible Whether the sync footer should be visible.
   */
  function setSyncFooterVisible(isVisible) {
    $('sync-footer').hidden = !isVisible;
  }

  // Return an object with all of the exports.
  return {
    initialize: initialize,
    setSyncFooterVisible: setSyncFooterVisible,
  };
});

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