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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
Mathieu 2014/08/07 18:07:06 2014
huangs 2014/08/07 20:15:20 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
Mathieu 2014/08/07 18:07:05 Probably don't need these 2 extra lines
huangs 2014/08/07 20:15:20 Done.
Mathieu 2014/08/07 20:50:24 I meant the two extra newlines, not the 2 lines of
5
6 /**
7 * @fileoverview Specifications for NTP design, and an acessor to presets.
Mathieu 2014/08/07 18:07:06 *accessor
huangs 2014/08/07 20:15:19 Done.
8 */
9
10
11 /**
12 * Specifications for an NTP design (not comprehensive).
13 *
14 * name: A unique identifier for the style.
15 * classToAdd: A list of classes to be added to #ntp-contents, so the
16 * appropriate CSS will take effect.
17 * fontFamily: Font family to use for title and thumbnail <iframe>s.
18 * fontSize: Font size to use for the <iframe>s, in px.
19 * tileWidth: The width of each suggestion tile, in px.
20 * tileMargin: Spacing between successive tiles, in px.
21 * titleWidth: The width of each title <iframe>, in px.
22 * titleHeight: The height of each title <iframe>, in px.
23 * titleColor: The RRGGBB color of title text.
24 * titleTextAlign: The alignment of title text.
25 * titleTextFade: (Optional) The number of pixels beyond which title
26 * text begins to fade. This overrides the default ellipsis style.
27 * thumbnailWidth: The width of each thumbnail <iframe>, in px.
28 * thumbnailHeight: The height of each thumbnail <iframe>, in px.
29 * thumbnailTextColor: The RRGGBB color that thumbnail <iframe> may use to
30 * display text message in place of missing thumbnail.
31 *
32 * @typedef {{
33 * name: string,
34 * classToAdd: Array.{string},
35 * fontFamily: string,
36 * fontSize: number,
37 * tileWidth: number,
38 * tileMargin: number,
39 * titleWidth: number,
40 * titleHeight: number,
41 * titleColor: string,
42 * titleTextAlign: string,
43 * titleTextFade: string|null|undefined,
44 * thumbnailWidth: number,
45 * thumbnailHeight: number,
46 * thumbnailTextColor: string
47 * }}
48 */
49 var NtpDesign;
50
51 /**
52 * Returns an NTP design corresponding to the given name.
53 * @param {string|undefined} opt_name The name of the design. If undefined, then
54 * the default design is specified.
55 * @return {NtpDesign} The NTP design corresponding to name.
56 */
57 function getNtpDesign(opt_name) {
58 // TODO(huangs): Add new style.
59 var ntpDesign = {
Mathieu 2014/08/07 18:07:05 why not have this style defined above as a @const
huangs 2014/08/07 20:15:20 I'm going to return this directly. Not assigning
60 name: 'classical',
61 classToAdd: [],
62 fontFamily: 'arial, sans-serif',
63 fontSize: 11,
64 tileWidth: 140,
65 tileMargin: 20,
66 titleWidth: 138,
67 titleHeight: 18,
68 titleColor: '777777',
69 titleTextAlign: 'center',
Mathieu 2014/08/07 18:07:06 As mentioned, since center is the default I would
huangs 2014/08/07 20:15:20 Made default center. Also, not going to initialize
70 titleTextFade: null, // Default to ellipsis.
71 thumbnailWidth: 138,
72 thumbnailHeight: 83,
73 thumbnailTextColor: '777777'
74 };
75 return ntpDesign;
76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698