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

Unified Diff: chrome/browser/resources/print_preview/color_settings.js

Issue 10108001: Refactor print preview web ui (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve conflicts Created 8 years, 7 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
Index: chrome/browser/resources/print_preview/color_settings.js
diff --git a/chrome/browser/resources/print_preview/color_settings.js b/chrome/browser/resources/print_preview/color_settings.js
deleted file mode 100644
index 2d9cdc2b92774c6a76b0348ea4e3572ae05f5b55..0000000000000000000000000000000000000000
--- a/chrome/browser/resources/print_preview/color_settings.js
+++ /dev/null
@@ -1,108 +0,0 @@
-// 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('print_preview', function() {
- 'use strict';
-
- /**
- * Creates a ColorSettings object. This object encapsulates all settings and
- * logic related to color selection (color/bw).
- * @constructor
- */
- function ColorSettings() {
- this.colorOption_ = $('color-option');
- this.colorRadioButton_ = $('color');
- this.bwRadioButton_ = $('bw');
-
- this.printerColorModelForColor_ = ColorSettings.COLOR;
- this.printerColorModelForBlack_ = ColorSettings.GRAY;
- this.addEventListeners_();
- }
-
- ColorSettings.GRAY = 1;
- ColorSettings.COLOR = 2;
- cr.addSingletonGetter(ColorSettings);
-
- ColorSettings.prototype = {
- /**
- * The radio button corresponding to the color option.
- * @type {HTMLInputElement}
- */
- get colorRadioButton() {
- return this.colorRadioButton_;
- },
-
- /**
- * The radio button corresponding to the black and white option.
- * @type {HTMLInputElement}
- */
- get bwRadioButton() {
- return this.bwRadioButton_;
- },
-
- /**
- * @return {number} The color mode for print preview.
- */
- get colorMode() {
- return this.bwRadioButton_.checked ?
- this.printerColorModelForBlack_ :
- this.printerColorModelForColor_;
- },
-
- /**
- * Adding listeners to all color related controls. The listeners take care
- * of altering their behavior depending on |hasPendingPreviewRequest|.
- * @private
- */
- addEventListeners_: function() {
- this.colorRadioButton_.onclick = function() {
- setColor(true);
- };
- this.bwRadioButton_.onclick = function() {
- setColor(false);
- };
- document.addEventListener(customEvents.PDF_LOADED,
- this.onPDFLoaded_.bind(this));
- document.addEventListener(customEvents.PRINTER_CAPABILITIES_UPDATED,
- this.onPrinterCapabilitiesUpdated_.bind(this));
- },
-
- /**
- * Executes when a |customEvents.PRINTER_CAPABILITIES_UPDATED| event occurs.
- * @private
- */
- onPrinterCapabilitiesUpdated_: function(e) {
- var disableColorOption = e.printerCapabilities.disableColorOption;
-
- disableColorOption ? fadeOutOption(this.colorOption_) :
- fadeInOption(this.colorOption_);
- this.colorOption_.setAttribute('aria-hidden', disableColorOption);
-
- var setColorAsDefault = e.printerCapabilities.setColorAsDefault;
- this.printerColorModelForColor_ =
- e.printerCapabilities.printerColorModelForColor ||
- ColorSettings.COLOR;
- this.printerColorModelForBlack_ =
- e.printerCapabilities.printerColorModelForBlack ||
- ColorSettings.GRAY;
-
- this.colorRadioButton_.checked = setColorAsDefault;
- this.bwRadioButton_.checked = !setColorAsDefault;
- setColor(this.colorRadioButton_.checked);
- },
-
- /**
- * Executes when a |customEvents.PDF_LOADED| event occurs.
- * @private
- */
- onPDFLoaded_: function() {
- setColor(this.colorRadioButton_.checked);
- }
-
- };
-
- return {
- ColorSettings: ColorSettings
- };
-});
« no previous file with comments | « chrome/browser/resources/print_preview/color_settings.html ('k') | chrome/browser/resources/print_preview/component.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698