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

Side by Side Diff: chrome/browser/resources/settings/settings_drawer/settings_drawer.js

Issue 1130113005: Convert cr-settings-drawer to Polymer 0.8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ConvertSettingsMenu
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'cr-settings-drawer' holds the user card and navigation menu for settings 7 * 'cr-settings-drawer' holds the user card and navigation menu for settings
8 * pages. 8 * pages.
9 * 9 *
10 * Example: 10 * Example:
11 * 11 *
12 * <core-drawer-panel> 12 * <paper-drawer-panel>
13 * <cr-settings-drawer drawer selectedId="{{selectedId}}" 13 * <cr-settings-drawer drawer selected-id="{{selectedId}}"
14 * pages="{{pages}}"> 14 * pages="[[pages]]">
15 * </cr-settings-drawer> 15 * </cr-settings-drawer>
16 * <cr-settings-main main selectedId="{{selectedId}}" pages="{{pages}}"> 16 * <cr-settings-main main selected-id="{{selectedId}}" pages="[[pages]]">
17 * </cr-settings-main> 17 * </cr-settings-main>
18 * </core-drawer-panel> 18 * </paper-drawer-panel>
19 * 19 *
20 * @group Chrome Settings Elements 20 * @group Chrome Settings Elements
21 * @element cr-settings-drawer 21 * @element cr-settings-drawer
22 */ 22 */
23 Polymer('cr-settings-drawer', { 23 Polymer({
24 publish: { 24 is: 'cr-settings-drawer',
25
26 properties: {
25 /** 27 /**
26 * Pages to include in the navigation. 28 * Pages to include in the navigation.
27 * 29 *
Kyle Horimoto 2015/05/12 18:14:55 nit/question: I've seen some files include a blank
michaelpg 2015/05/12 18:37:12 Good point. I generally don't include the blank li
28 * @attribute pages 30 * @type {Array<!Object>}
Jeremy Klein 2015/05/12 18:06:41 nit: ?Array or initialize to [] and make non-null.
Kyle Horimoto 2015/05/12 18:14:55 IMO, let's always initialize to [] and make non-nu
michaelpg 2015/05/12 18:37:12 hmm, why bother? This element expects |pages| to b
Kyle Horimoto 2015/05/12 18:39:16 You're right - looks like this is a case where the
James Hawkins 2015/05/12 18:39:46 So you can make it non-null, which is safer than a
michaelpg 2015/05/12 19:37:52 Done.
29 * @type Array<!Object>
30 * @default null
31 */ 31 */
32 pages: null, 32 pages: Array,
33 33
34 /** 34 /**
35 * ID of the currently selected page. 35 * ID of the currently selected page.
36 * 36 *
37 * @attribute selectedId 37 * @type {string}
38 * @type string
39 * default ''
40 */ 38 */
41 selectedId: '', 39 selectedId: {
40 type: String,
41 notify: true,
42 },
42 }, 43 },
43 44
44 /** @override */ 45 ready: function() {
45 created: function() { 46 /**
46 this.pages = []; 47 * @type {Object}
47 }, 48 * TODO(michaelpg): Create custom element and data source for user card.
48 49 */
49 /** 50 this.user_ = {
michaelpg 2015/05/12 15:05:17 How do I set user_ as a property on the object, wi
Jeremy Klein 2015/05/12 18:06:41 Advice from the Polymer team is just to put it in
michaelpg 2015/05/12 18:37:12 Done.
50 * @type {Object} 51 name: 'Chrome User',
51 * TODO(michaelpg): Create custom element and data source for user card. 52 email: 'user@example.com',
52 */ 53 iconUrl: 'chrome://theme/IDR_PROFILE_AVATAR_23@1x',
53 user: { 54 };
54 name: 'Chrome User',
55 email: 'user@example.com',
56 iconUrl: 'chrome://theme/IDR_PROFILE_AVATAR_23@1x',
57 }, 55 },
58 }); 56 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698