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

Unified Diff: chrome/browser/resources/local_ntp/local_ntp_design.js

Issue 447243003: [Local NTP] Adding NtpDesign class to parametrizing NTP design specs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Making titleTextAlign optional; cleanups. Created 6 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
Index: chrome/browser/resources/local_ntp/local_ntp_design.js
diff --git a/chrome/browser/resources/local_ntp/local_ntp_design.js b/chrome/browser/resources/local_ntp/local_ntp_design.js
new file mode 100644
index 0000000000000000000000000000000000000000..1eaf9eb42857e5ab2a309be1603aad56007011e0
--- /dev/null
+++ b/chrome/browser/resources/local_ntp/local_ntp_design.js
@@ -0,0 +1,74 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+
+
+/**
+ * @fileoverview Specifications for the NTP design, and an accessor to presets.
+ */
+
+
+/**
+ * Specifications for an NTP design (not comprehensive).
+ *
+ * name: A unique identifier for the style.
+ * classToAdd: A list of classes to be added to #ntp-contents, so the
+ * appropriate CSS will take effect.
+ * fontFamily: Font family to use for title and thumbnail <iframe>s.
+ * fontSize: Font size to use for the <iframe>s, in px.
+ * tileWidth: The width of each suggestion tile, in px.
+ * tileMargin: Spacing between successive tiles, in px.
+ * titleWidth: The width of each title <iframe>, in px.
+ * titleHeight: The height of each title <iframe>, in px.
+ * titleColor: The RRGGBB color of title text.
+ * titleTextAlign: (Optional) The alignment of title text. If unspecified, the
+ * default value is 'center'.
+ * titleTextFade: (Optional) The number of pixels beyond which title
+ * text begins to fade. This overrides the default ellipsis style.
+ * thumbnailWidth: The width of each thumbnail <iframe>, in px.
+ * thumbnailHeight: The height of each thumbnail <iframe>, in px.
+ * thumbnailTextColor: The RRGGBB color that thumbnail <iframe> may use to
+ * display text message in place of missing thumbnail.
+ *
+ * @typedef {{
+ * name: string,
+ * classToAdd: Array.{string},
+ * fontFamily: string,
+ * fontSize: number,
+ * tileWidth: number,
+ * tileMargin: number,
+ * titleWidth: number,
+ * titleHeight: number,
+ * titleColor: string,
+ * titleTextAlign: string|null|undefined,
+ * titleTextFade: string|null|undefined,
+ * thumbnailWidth: number,
+ * thumbnailHeight: number,
+ * thumbnailTextColor: string
+ * }}
+ */
+var NtpDesign;
+
+/**
+ * Returns an NTP design corresponding to the given name.
+ * @param {string|undefined} opt_name The name of the design. If undefined, then
+ * the default design is specified.
+ * @return {NtpDesign} The NTP design corresponding to name.
+ */
+function getNtpDesign(opt_name) {
+ // TODO(huangs): Add new style.
+ return {
+ name: 'classical',
+ classToAdd: [],
+ fontFamily: 'arial, sans-serif',
+ fontSize: 11,
+ tileWidth: 140,
+ tileMargin: 20,
+ titleWidth: 138,
+ titleHeight: 18,
+ titleColor: '777777',
+ // No titleTextAlign: defaults to 'center'.
+ // No titleTextFade: by default we have ellipsis.
+ thumbnailWidth: 138,
+ thumbnailHeight: 83,
+ thumbnailTextColor: '777777'
+ };
+}

Powered by Google App Engine
This is Rietveld 408576698