Commit b0fc6317 authored by sergeyu@chromium.org's avatar sergeyu@chromium.org

Add Throbber control for DOMUI. Use it everywhere in options and in Sync setup UI.

BUG=69755
TEST=Throbber works properly when settings page is scaled.

Review URL: http://codereview.chromium.org/6378006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72104 0039d316-1c4b-4281-b951-d872f2087c98
parent a19c9b67
...@@ -32,6 +32,8 @@ int PathToIDR(const std::string& path) { ...@@ -32,6 +32,8 @@ int PathToIDR(const std::string& path) {
idr = IDR_FOLDER_OPEN; idr = IDR_FOLDER_OPEN;
} else if (path == "app/resources/folder_open_rtl.png") { } else if (path == "app/resources/folder_open_rtl.png") {
idr = IDR_FOLDER_OPEN_RTL; idr = IDR_FOLDER_OPEN_RTL;
} else if (path == "app/resources/throbber.png") {
idr = IDR_THROBBER;
} else { } else {
// The name of the files in the grd list are prefixed with the following // The name of the files in the grd list are prefixed with the following
// directory: // directory:
......
...@@ -3,13 +3,8 @@ ...@@ -3,13 +3,8 @@
<title></title> <title></title>
<link rel="stylesheet" type="text/css" href="remoting_setup_flow.css" /> <link rel="stylesheet" type="text/css" href="remoting_setup_flow.css" />
<style type="text/css"> <style type="text/css">
#throb { #throbber {
background-image: url("../../../../app/resources/throbber.png");
width: 16px;
height: 16px;
background-position: 0px;
margin: -3px 10px; margin: -3px 10px;
display: inline-block;
} }
#setting_up { #setting_up {
margin: 100px; margin: 100px;
...@@ -21,23 +16,13 @@ ...@@ -21,23 +16,13 @@
font-size: 125%; font-size: 125%;
} }
</style> </style>
<link rel="stylesheet" href="chrome://resources/css/throbber.css">
<script src="chrome://resources/js/cr.js"></script> <script src="chrome://resources/js/cr.js"></script>
<script>
function advanceThrobber() {
var throbber = document.getElementById('throb');
throbber.style.backgroundPositionX =
((parseInt(getComputedStyle(throbber).backgroundPositionX) - 16) %
576) + 'px';
}
setInterval(advanceThrobber, 30);
</script>
</head> </head>
<body i18n-values=".style.fontFamily:fontfamily"> <body i18n-values=".style.fontFamily:fontfamily">
<form id="settingUpForm" onSubmit="return false;"> <form id="settingUpForm" onSubmit="return false;">
<div id="setting_up"> <div id="setting_up">
<span id="throbber_container"> <div id="throbber" class="throbber"></div>
<span id="throb"></span>
</span>
<div id="setting_up_label" i18n-content="settingup"></div> <div id="setting_up_label" i18n-content="settingup"></div>
</div> </div>
<div class="remoting-footer"> <div class="remoting-footer">
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<div id="cbdActionArea"> <div id="cbdActionArea">
<a target="_blank" i18n-content="flash_storage_settings" <a target="_blank" i18n-content="flash_storage_settings"
i18n-values="href:flash_storage_url"></a> i18n-values="href:flash_storage_url"></a>
<span id="cbdThrobber"></span> <div id="cbdThrobber" class="throbber"></div>
<div class="button-strip"> <div class="button-strip">
<button id="clearBrowserDataDismiss" i18n-content="cancel"></button> <button id="clearBrowserDataDismiss" i18n-content="cancel"></button>
<button id="clearBrowserDataCommit" <button id="clearBrowserDataCommit"
......
...@@ -90,20 +90,6 @@ cr.define('options', function() { ...@@ -90,20 +90,6 @@ cr.define('options', function() {
$('clearBrowserDataCommit').disabled = true; $('clearBrowserDataCommit').disabled = true;
else else
ClearBrowserDataOverlay.getInstance().updateCommitButtonState_(); ClearBrowserDataOverlay.getInstance().updateCommitButtonState_();
function advanceThrobber() {
var throbber = $('cbdThrobber');
// TODO(csilv): make this smoother using time-based animation?
throbber.style.backgroundPositionX =
((parseInt(getComputedStyle(throbber).backgroundPositionX, 10) - 16) %
576) + 'px';
}
if (state) {
ClearBrowserDataOverlay.throbIntervalId =
setInterval(advanceThrobber, 30);
} else {
clearInterval(ClearBrowserDataOverlay.throbIntervalId);
}
}; };
ClearBrowserDataOverlay.setClearLocalDataLabel = function(label) { ClearBrowserDataOverlay.setClearLocalDataLabel = function(label) {
......
#import-throbber { #import-throbber {
background-image: url("../../../../app/resources/throbber.png");
width: 16px;
height: 16px;
margin: -3px 10px; margin: -3px 10px;
display: inline-block;
visibility: hidden; visibility: hidden;
} }
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</div> </div>
</div> </div>
<div class="action-area"> <div class="action-area">
<span id="import-throbber"></span> <div id="import-throbber" class="throbber"></div>
<div class="button-strip"> <div class="button-strip">
<button id="import-data-cancel" i18n-content="cancel"></button> <button id="import-data-cancel" i18n-content="cancel"></button>
<button id="import-data-commit" i18n-content="importCommit"></button> <button id="import-data-commit" i18n-content="importCommit"></button>
......
...@@ -18,8 +18,6 @@ cr.define('options', function() { ...@@ -18,8 +18,6 @@ cr.define('options', function() {
'import-data-overlay'); 'import-data-overlay');
} }
ImportDataOverlay.throbIntervalId = 0;
cr.addSingletonGetter(ImportDataOverlay); cr.addSingletonGetter(ImportDataOverlay);
ImportDataOverlay.prototype = { ImportDataOverlay.prototype = {
...@@ -168,18 +166,6 @@ cr.define('options', function() { ...@@ -168,18 +166,6 @@ cr.define('options', function() {
$('import-browsers').disabled = state; $('import-browsers').disabled = state;
$('import-data-commit').disabled = state; $('import-data-commit').disabled = state;
$('import-throbber').style.visibility = state ? "visible" : "hidden"; $('import-throbber').style.visibility = state ? "visible" : "hidden";
function advanceThrobber() {
var throbber = $('import-throbber');
throbber.style.backgroundPositionX =
((parseInt(getComputedStyle(throbber).backgroundPositionX, 10) - 16)
% 576) + 'px';
}
if (state) {
ImportDataOverlay.throbIntervalId = setInterval(advanceThrobber, 30);
} else {
clearInterval(ImportDataOverlay.throbIntervalId);
}
}; };
/** /**
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<link rel="icon" href="../../../app/theme/settings_favicon.png"> <link rel="icon" href="../../../app/theme/settings_favicon.png">
<link rel="stylesheet" href="chrome://resources/css/list.css"> <link rel="stylesheet" href="chrome://resources/css/list.css">
<link rel="stylesheet" href="chrome://resources/css/throbber.css">
<link rel="stylesheet" href="chrome://resources/css/tree.css"> <link rel="stylesheet" href="chrome://resources/css/tree.css">
<link rel="stylesheet" href="../dom_ui.css"> <link rel="stylesheet" href="../dom_ui.css">
<link rel="stylesheet" href="options_page.css"> <link rel="stylesheet" href="options_page.css">
......
.throbber {
-webkit-animation: throbber-animation 1s steps(36, end) 0 infinite;
background-image: url("../../../../../app/resources/throbber.png");
background-position: 0;
display: inline-block;
height: 16px;
width: 16px;
}
@-webkit-keyframes throbber-animation {
from {
background-position-x: 0;
}
to {
background-position-x: -576px;
}
}
...@@ -20,6 +20,8 @@ without changes to the corresponding grd file. paaaae --> ...@@ -20,6 +20,8 @@ without changes to the corresponding grd file. paaaae -->
file="shared/css/list.css" type="BINDATA" /> file="shared/css/list.css" type="BINDATA" />
<include name="IDR_SHARED_CSS_MENU" <include name="IDR_SHARED_CSS_MENU"
file="shared/css/menu.css" type="BINDATA" /> file="shared/css/menu.css" type="BINDATA" />
<include name="IDR_SHARED_CSS_THROBBER"
file="shared/css/throbber.css" type="BINDATA" />
<include name="IDR_SHARED_CSS_TREE" <include name="IDR_SHARED_CSS_TREE"
file="shared/css/tree.css" type="BINDATA" /> file="shared/css/tree.css" type="BINDATA" />
<include name="IDR_SHARED_CSS_TREE_JS" <include name="IDR_SHARED_CSS_TREE_JS"
......
...@@ -58,11 +58,7 @@ ...@@ -58,11 +58,7 @@
width: 200px; width: 200px;
height: 70px; height: 70px;
} }
#throb { #logging_in_throbber {
background-image: url("../../../../app/resources/throbber.png");
width: 16px;
height: 16px;
background-position: 0px;
margin: 0px 10px 0px 10px; margin: 0px 10px 0px 10px;
} }
.toppageverticalspace { .toppageverticalspace {
...@@ -120,6 +116,7 @@ ...@@ -120,6 +116,7 @@
text-align: center; text-align: center;
} }
</style> </style>
<link rel="stylesheet" href="chrome://resources/css/throbber.css">
</head> </head>
<body bgcolor="#ffffff" vlink="#666666" <body bgcolor="#ffffff" vlink="#666666"
i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize" i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"
...@@ -168,15 +165,10 @@ ...@@ -168,15 +165,10 @@
} }
} }
function advanceThrobber() {
var throbber = document.getElementById('throb');
throbber.style.backgroundPositionX =
((parseInt(getComputedStyle(throbber).backgroundPositionX) - 16) %
576) + 'px';
}
function showGaiaLogin(args) { function showGaiaLogin(args) {
document.getElementById('throbber_container').style.display = "none"; document.getElementById('logging_in_throbber').style.display = "none";
document.getElementById('Email').disabled = false; document.getElementById('Email').disabled = false;
document.getElementById('Passwd').disabled = false; document.getElementById('Passwd').disabled = false;
...@@ -288,13 +280,11 @@ ...@@ -288,13 +280,11 @@
} }
acct_text.textContent = translated_text.replace('Google',''); acct_text.textContent = translated_text.replace('Google','');
} }
setInterval(advanceThrobber, 30);
var args = JSON.parse(chrome.dialogArguments); var args = JSON.parse(chrome.dialogArguments);
showGaiaLogin(args); showGaiaLogin(args);
} }
function sendCredentialsAndClose() { function sendCredentialsAndClose() {
if (!setErrorVisibility()) if (!setErrorVisibility())
return false; return false;
...@@ -303,8 +293,8 @@ ...@@ -303,8 +293,8 @@
document.getElementById('CaptchaValue').disabled = true; document.getElementById('CaptchaValue').disabled = true;
document.getElementById('AccessCode').disabled = true; document.getElementById('AccessCode').disabled = true;
var throbber = document.getElementById('throbber_container'); document.getElementById('logging_in_throbber').style.display = "block";
throbber.style.display = "inline";
var f = document.getElementById("gaia_loginform"); var f = document.getElementById("gaia_loginform");
var result = JSON.stringify({"user" : f.Email.value, var result = JSON.stringify({"user" : f.Email.value,
"pass" : f.Passwd.value, "pass" : f.Passwd.value,
...@@ -548,10 +538,7 @@ ...@@ -548,10 +538,7 @@
<table align="center" cellpadding="0" cellspacing="0"> <table align="center" cellpadding="0" cellspacing="0">
<tr> <tr>
<td> <td>
<div id="throbber_container" style="display:none;"> <div id="logging_in_throbber" class="throbber"></div>
<div id="throb">
</div>
</div>
</td> </td>
<td class="noverticalpadding"> <td class="noverticalpadding">
<input id="signIn" type="submit" class="gaia le button" <input id="signIn" type="submit" class="gaia le button"
......
...@@ -36,13 +36,8 @@ html[os='mac'] input[type='button'], ...@@ -36,13 +36,8 @@ html[os='mac'] input[type='button'],
html[os='mac'] input[type='submit'] { html[os='mac'] input[type='submit'] {
font-size: 12pt; font-size: 12pt;
} }
#throb { #throbber {
background-image: url("../../../../app/resources/throbber.png");
width: 16px;
height: 16px;
background-position: 0px;
margin: -3px 10px; margin: -3px 10px;
display: inline-block;
} }
#setting_up { #setting_up {
margin: 100px; margin: 100px;
...@@ -55,23 +50,13 @@ html[os='mac'] input[type='submit'] { ...@@ -55,23 +50,13 @@ html[os='mac'] input[type='submit'] {
} }
</style> </style>
<link rel="stylesheet" href="chrome://resources/css/throbber.css">
<script src="chrome://resources/js/cr.js"></script> <script src="chrome://resources/js/cr.js"></script>
<script>
function advanceThrobber() {
var throbber = document.getElementById('throb');
throbber.style.backgroundPositionX =
((parseInt(getComputedStyle(throbber).backgroundPositionX) - 16) %
576) + 'px';
}
setInterval(advanceThrobber, 30);
</script>
</head> </head>
<body i18n-values=".style.fontFamily:fontfamily"> <body i18n-values=".style.fontFamily:fontfamily">
<form id="settingUpForm" onSubmit="return false;"> <form id="settingUpForm" onSubmit="return false;">
<div id="setting_up"> <div id="setting_up">
<span id="throbber_container"> <div id="throbber" class="throbber"></div>
<span id="throb"></span>
</span>
<div id="setting_up_label" i18n-content="settingup"></div> <div id="setting_up_label" i18n-content="settingup"></div>
</div> </div>
<div class="sync-footer"> <div class="sync-footer">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment