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

Unified Diff: chrome/browser/resources/print_preview/data/margins.js

Issue 10108001: Refactor print preview web ui (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove new widget Created 8 years, 8 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/data/margins.js
diff --git a/chrome/browser/resources/print_preview/data/margins.js b/chrome/browser/resources/print_preview/data/margins.js
new file mode 100644
index 0000000000000000000000000000000000000000..f221f2d6113b5c95c0ae8467c5c9552c6ff1f779
--- /dev/null
+++ b/chrome/browser/resources/print_preview/data/margins.js
@@ -0,0 +1,71 @@
+// 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 Margins object that holds four margin values in points.
+ * @param {number} top The top margin in pts.
+ * @param {number} right The right margin in pts.
+ * @param {number} bottom The bottom margin in pts.
+ * @param {number} left The left margin in pts.
+ * @constructor
+ */
+ function Margins(top, right, bottom, left) {
+ this.top_ = top;
+ this.right_ = right;
+ this.bottom_ = bottom;
+ this.left_ = left;
+ };
+
+ /**
+ * Enumeration of margin types. Matches enum MarginType in
+ * printing/print_job_constants.h.
+ * @enum {number}
+ */
+ Margins.Type = {
+ DEFAULT: 0,
+ NO_MARGINS: 1,
+ MINIMUM: 2,
+ CUSTOM: 3
+ },
+
+ Margins.prototype = {
+ get top() {
+ return this.top_;
+ },
+
+ get right() {
+ return this.right_;
+ },
+
+ get bottom() {
+ return this.bottom_;
+ },
+
+ get left() {
+ return this.left_;
+ },
+
+ /**
+ * Checks if this margins object is equivalent to another.
+ * @param {print_preview.Margins} other The other margins object to compare
+ * against.
+ * @return {boolean} Whether this margins object is equivalent to another.
dpapad1 2012/04/19 22:45:01 Nit: s/equivalent/equal
Robert Toscano 2012/04/23 23:00:09 Done.
+ */
+ equals: function(other) {
+ return other != null &&
+ this.top_ == other.top_ &&
+ this.right_ == other.right_ &&
+ this.bottom_ == other.bottom_ &&
+ this.left_ == other.left_;
+ }
+ };
+
+ // Export
+ return {
+ Margins: Margins
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698