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

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

Issue 473583002: [Local NTP] Implementing Material Design styling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
index 59ed11fad10401aa3ba2dfb4063733caf3bc2593..34073124d395e022611d8684908bc21718161bf9 100644
--- a/chrome/browser/resources/local_ntp/local_ntp_design.js
+++ b/chrome/browser/resources/local_ntp/local_ntp_design.js
@@ -4,37 +4,50 @@
/**
- * @fileoverview Specifications for the NTP design, and an accessor to presets.
+ * @fileoverview Specifications for NTP design, and an acessor to presets.
Mathieu 2014/08/13 20:09:30 *accessor
huangs 2014/08/13 21:34:08 Done.
*/
+ var THUMBNAIL_FALLBACK = {
+ DOT: 'dot' // Draw single dot.
+ };
/**
* 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.
* titleColor: The RRGGBB color of title text.
+ * titleColorAgainstDark: The RRGGBB color of title text against a dark theme.
* 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.
* thumbnailTextColor: The RRGGBB color that thumbnail <iframe> may use to
* display text message in place of missing thumbnail.
+ * thumbnailFallback: (Optional) Specifies how to do fallback should be handled
Mathieu 2014/08/13 20:09:29 rephrase comment
huangs 2014/08/13 21:34:09 Done.
+ * handled if thumbnails are emissing. If assigned, then thumbnail <iframe>
+ * will let local NTP handle fallbacks.
+ * showFakeboxHint: Whether to display text in the fakebox.
*
* @typedef {{
* name: string,
+ * classToAdd: Array.{string},
* fontFamily: string,
* fontSize: number,
* tileWidth: number,
* tileMargin: number,
* titleColor: string,
+ * titleColorAgainstDark: string,
* titleTextAlign: string|null|undefined,
* titleTextFade: string|null|undefined,
- * thumbnailTextColor: string
+ * thumbnailTextColor: string,
+ * thumbnailFallback: string|null|undefined
+ * showFakeboxHint: string|null|undefined
* }}
*/
var NtpDesign;
@@ -46,16 +59,42 @@ var NtpDesign;
* @return {NtpDesign} The NTP design corresponding to name.
*/
function getNtpDesign(opt_name) {
- // TODO(huangs): Add new style.
- return {
- name: 'classical',
- fontFamily: 'arial, sans-serif',
- fontSize: 11,
- tileWidth: 140,
- tileMargin: 20,
- titleColor: '777777',
- // No titleTextAlign: defaults to 'center'.
- // No titleTextFade: by default we have ellipsis.
- thumbnailTextColor: '777777'
- };
+ var ntpDesign = null;
+
+ if (opt_name === 'md' || opt_name === 'smallScreen1' ||
+ opt_name === 'smallScreen2') {
Mathieu 2014/08/13 20:09:29 you don't seem to be using smallScreen2, remove?
huangs 2014/08/13 21:34:08 Done.
+ ntpDesign = {
+ name: opt_name,
+ classToAdd: ['md'],
+ fontFamily: 'Roboto2, arial, sans-serif',
+ fontSize: 12,
+ tileWidth: 146,
+ tileMargin: 12,
+ titleColor: '000000',
+ titleColorAgainstDark: 'd2d2d2',
+ titleTextAlign: 'inherit',
+ titleTextFade: 112 - 24, // 24 pixel fade.
+ thumbnailTextColor: '777777',
+ thumbnailFallback: THUMBNAIL_FALLBACK.DOT,
+ showFakeboxHint: true
+ };
+
Mathieu 2014/08/13 20:09:29 remove extra newline
huangs 2014/08/13 21:34:09 Done.
+ } else {
+ ntpDesign = {
+ name: 'classical',
+ classToAdd: ['classical'],
+ fontFamily: 'arial, sans-serif',
+ fontSize: 11,
+ tileWidth: 140,
+ tileMargin: 20,
+ titleColor: '777777',
+ titleColorAgainstDark: '777777',
+ titleTextAlign: 'center',
+ titleTextFade: null, // Default to ellipsis.
+ thumbnailTextColor: '777777',
+ thumbnailFallback: null, // Default to false.
+ showFakeboxHint: false
+ };
+ }
+ return ntpDesign;
}

Powered by Google App Engine
This is Rietveld 408576698