Home | History | Annotate | Download | only in app
      1 // Copyright 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 function init() {
      6   var content = $('greeting');
      7   chrome.firstRunPrivate.getLocalizedStrings(function(strings) {
      8     loadTimeData.data = strings;
      9     i18nTemplate.process(document, loadTimeData);
     10     // Resizing and centering app's window.
     11     var bounds = {};
     12     bounds.width = content.offsetWidth;
     13     bounds.height = content.offsetHeight;
     14     bounds.left = Math.round(0.5 * (window.screen.availWidth - bounds.width));
     15     bounds.top = Math.round(0.5 * (window.screen.availHeight - bounds.height));
     16     appWindow.setBounds(bounds);
     17     appWindow.show();
     18   });
     19   var closeButton = content.getElementsByClassName('close-button')[0];
     20   // Make close unfocusable by mouse.
     21   closeButton.addEventListener('mousedown', function(e) {
     22     e.preventDefault();
     23   });
     24   closeButton.addEventListener('click', function(e) {
     25     appWindow.close();
     26     e.stopPropagation();
     27   });
     28   var tutorialButton = content.getElementsByClassName('next-button')[0];
     29   tutorialButton.addEventListener('click', function(e) {
     30     chrome.firstRunPrivate.launchTutorial();
     31     appWindow.close();
     32     e.stopPropagation();
     33   });
     34 }
     35 
     36 document.addEventListener('DOMContentLoaded', init);
     37