Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1113)

Unified Diff: remoting/webapp/me2mom/remoting.js

Issue 7718008: Use a split toggle button to reflect scaling state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed i18n-content tag. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/me2mom/client_session.js ('k') | remoting/webapp/me2mom/scale-to-fit.png » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/me2mom/remoting.js
diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js
index 5ade16ecea3c97588bb7fed0147ef590056ea0e0..823686373b7344e0b1121d55be8dab8f31c8689f 100644
--- a/remoting/webapp/me2mom/remoting.js
+++ b/remoting/webapp/me2mom/remoting.js
@@ -68,13 +68,16 @@ function hasClass(classes, cls) {
}
function addClass(element, cls) {
- if (!hasClass(element.className, cls))
- element.className = element.className + ' ' + cls;
+ if (!hasClass(element.className, cls)) {
+ var padded = element.className == '' ? '' : element.className + ' ';
+ element.className = padded + cls;
+ }
}
function removeClass(element, cls) {
element.className =
- element.className.replace(new RegExp('\\b' + cls + '\\b', 'g'), '');
+ element.className.replace(new RegExp('\\b' + cls + '\\b', 'g'), '')
+ .replace(' ', ' ');
}
function retrieveEmail_(access_token) {
@@ -143,6 +146,8 @@ remoting.toggleDebugLog = function() {
remoting.init = function() {
l10n.localize();
+ var button = document.getElementById('toggle-scaling');
+ button.title = chrome.i18n.getMessage(/*i18n-content*/'TOOLTIP_SCALING');
// Create global objects.
remoting.oauth2 = new remoting.OAuth2();
remoting.debug =
@@ -597,11 +602,17 @@ function isHostModeSupported() {
/**
* Enable or disable scale-to-fit.
*
+ * @param {boolean} scale True to enable scaling.
* @return {void} Nothing.
*/
-remoting.toggleScaleToFit = function() {
+remoting.toggleScaleToFit = function(button) {
remoting.scaleToFit = !remoting.scaleToFit;
- remoting.session.toggleScaleToFit(remoting.scaleToFit);
+ if (remoting.scaleToFit) {
+ addClass(button, 'toggle-button-active');
+ } else {
+ removeClass(button, 'toggle-button-active');
+ }
+ remoting.session.setScaleToFit(remoting.scaleToFit);
}
/**
@@ -640,4 +651,4 @@ remoting.promptClose = function() {
}());
// Shortcut to save typing now that this is the only way to show the debug log.
-var tdl = remoting.toggleDebugLog;
+var tdl = remoting.toggleDebugLog;
« no previous file with comments | « remoting/webapp/me2mom/client_session.js ('k') | remoting/webapp/me2mom/scale-to-fit.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698