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

Side by Side Diff: chrome/browser/resources/app_list/recommended_apps.js

Issue 874563003: Remove old HTML app list start page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview Implement the recommended apps card in the launcher start page.
7 */
8
9 cr.define('appList.startPage', function() {
10 'use strict';
11
12 /**
13 * Create a view with icon and label for the given app data.
14 * @constructor
15 * @extends {HTMLDivElement}
16 */
17 var AppItemView = cr.ui.define('div');
18
19 AppItemView.prototype = {
20 __proto__: HTMLDivElement.prototype,
21
22 /**
23 * The app id of the app displayed by this view. Used to launch
24 * the app when the view is clicked.
25 * @type {string}
26 */
27 appId: '',
28
29 /**
30 * Sets the icon URL to display the app icon.
31 * @type {string}
32 */
33 set iconUrl(url) {
34 this.style.backgroundImage = 'url(' + url + ')';
35 },
36
37 /**
38 * Sets the text title.
39 * @type {string}
40 */
41 set textTitle(title) {
42 this.textContent = title;
43 },
44
45 /** @override */
46 decorate: function() {
47 this.className = 'app';
48 this.addEventListener('click', this.handleClick_.bind(this));
49 },
50
51 /**
52 * Handles 'click' event.
53 * @private
54 */
55 handleClick_: function() {
56 assert(this.appId);
57 chrome.send('launchApp', [this.appId]);
58 }
59 };
60
61 /**
62 * Create recommended apps card.
63 * @constructor
64 * @extends {HTMLDivElement}
65 */
66 var RecommendedApps = cr.ui.define('div');
67
68 RecommendedApps.prototype = {
69 __proto__: HTMLDivElement.prototype,
70
71 /** @override */
72 decorate: function() {
73 this.className = 'recommended-apps';
74 },
75
76 /**
77 * Sets the apps to be displayed in this card.
78 */
79 setApps: function(apps) {
80 this.textContent = '';
81 for (var i = 0; i < apps.length; ++i) {
82 this.appendChild(new AppItemView(apps[i]));
83 }
84 }
85 };
86
87 return {
88 RecommendedApps: RecommendedApps
89 };
90 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/app_list/recommended_apps.css ('k') | chrome/browser/resources/app_list/start_page.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698