blob: 25758f10da2ae3a1f8073f85f9554d083723bd1a (
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
|
// 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.
cr.define('cloudprint', function() {
function hideAllPages() {
var pages = ['cloudprintsetup', 'setupdone'];
for (var i = 0; i < pages.length; ++i) {
$(pages[i]).style.display = 'none';
$(pages[i]).tabIndex = -1;
}
}
function showPage(page) {
hideAllPages();
$(page).style.display = 'block';
$(page).tabIndex = 0;
}
function showInitialPage() {
var args = JSON.parse(chrome.getVariableValue('dialogArguments'));
showPage(args.pageToShow);
}
function showSetupLogin() {
showPage('cloudprintsetup');
}
function showSetupDone(width, height) {
hideAllPages();
var moveByX = (window.innerWidth - width) / 2;
var moveByY = (window.innerHeight - height) / 2;
var sizeByX = width - window.innerWidth;
var sizeByY = height - window.innerHeight;
window.moveBy(moveByX, moveByY);
window.resizeBy(sizeByX, sizeByY);
showPage('setupdone');
}
return {
hideAllPages: hideAllPages,
showPage: showPage,
showInitialPage: showInitialPage,
showSetupLogin: showSetupLogin,
showSetupDone: showSetupDone
};
});
|