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.
6 * @fileoverview App launcher start page implementation.
9 <include src="recommended_apps.js"/>
11 cr.define('appList.startPage', function() {
15 * Creates a StartPage object.
17 * @extends {HTMLDivElement}
19 var StartPage = cr.ui.define('div');
21 StartPage.prototype = {
22 __proto__: HTMLDivElement.prototype,
25 * Instance of the recommended apps card.
26 * @type {appsList.startPage.RecommendedApps}
29 recommendedApps_: null,
32 decorate: function() {
33 this.recommendedApps_ = new appList.startPage.RecommendedApps();
34 this.appendChild(this.recommendedApps_);
38 * Sets the recommended apps.
39 * @param {!Array.<!{appId: string,
41 * textTitle: string}>} apps An array of app info
42 * dictionary to be displayed in the AppItemView.
44 setRecommendedApps: function(apps) {
45 this.recommendedApps_.setApps(apps);
50 * Initialize the page.
52 function initialize() {
53 StartPage.decorate($('start-page'));
54 chrome.send('initialize');
58 * Sets the recommended apps.
59 * @param {Array.<Object>} apps An array of app info dictionary.
61 function setRecommendedApps(apps) {
62 $('start-page').setRecommendedApps(apps);
66 initialize: initialize,
67 setRecommendedApps: setRecommendedApps
71 document.addEventListener('contextmenu', function(e) { e.preventDefault(); });
72 document.addEventListener('DOMContentLoaded', appList.startPage.initialize);