Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | |
| 6 * Global wallpaperManager reference useful for poking at from the console. | |
| 7 */ | |
| 8 var wallpaperManager; | |
| 9 | |
| 10 function init() { | 5 function init() { |
| 6 var content = $('greeting'); | |
| 11 chrome.firstRunPrivate.getLocalizedStrings(function(strings) { | 7 chrome.firstRunPrivate.getLocalizedStrings(function(strings) { |
| 12 loadTimeData.data = strings; | 8 loadTimeData.data = strings; |
| 13 i18nTemplate.process(document, loadTimeData); | 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)); | |
|
Nikita (slow)
2014/02/18 10:36:21
nit: Is this RTL friendly?
| |
| 15 bounds.top = Math.round(0.5 * (window.screen.availHeight - bounds.height)); | |
| 16 appWindow.setBounds(bounds); | |
| 17 appWindow.show(); | |
| 14 }); | 18 }); |
| 15 var content = $('greeting'); | |
| 16 var closeButton = content.getElementsByClassName('close-button')[0]; | 19 var closeButton = content.getElementsByClassName('close-button')[0]; |
| 17 // Make close unfocusable by mouse. | 20 // Make close unfocusable by mouse. |
| 18 closeButton.addEventListener('mousedown', function(e) { | 21 closeButton.addEventListener('mousedown', function(e) { |
| 19 e.preventDefault(); | 22 e.preventDefault(); |
| 20 }); | 23 }); |
| 21 closeButton.addEventListener('click', function(e) { | 24 closeButton.addEventListener('click', function(e) { |
| 22 appWindow.close(); | 25 appWindow.close(); |
| 23 e.stopPropagation(); | 26 e.stopPropagation(); |
| 24 }); | 27 }); |
| 25 var tutorialButton = content.getElementsByClassName('next-button')[0]; | 28 var tutorialButton = content.getElementsByClassName('next-button')[0]; |
| 26 tutorialButton.addEventListener('click', function(e) { | 29 tutorialButton.addEventListener('click', function(e) { |
| 27 chrome.firstRunPrivate.launchTutorial(); | 30 chrome.firstRunPrivate.launchTutorial(); |
| 28 appWindow.close(); | 31 appWindow.close(); |
| 29 e.stopPropagation(); | 32 e.stopPropagation(); |
| 30 }); | 33 }); |
| 31 } | 34 } |
| 32 | 35 |
| 33 document.addEventListener('DOMContentLoaded', init); | 36 document.addEventListener('DOMContentLoaded', init); |
| OLD | NEW |