Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / resources / app_list / start_page.js
blobc1ac7ae3d97cd7eaba3f01f944d8514e0497be06
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.
5 /**
6 * @fileoverview App launcher start page implementation.
7 */
9 <include src="recommended_apps.js"/>
10 <include src="speech_manager.js"/>
12 cr.define('appList.startPage', function() {
13 'use strict';
15 var speechManager = null;
17 /**
18 * Creates a StartPage object.
19 * @constructor
20 * @extends {HTMLDivElement}
22 var StartPage = cr.ui.define('div');
24 StartPage.prototype = {
25 __proto__: HTMLDivElement.prototype,
27 /**
28 * Instance of the recommended apps card.
29 * @type {appsList.startPage.RecommendedApps}
30 * @private
32 recommendedApps_: null,
34 /** @override */
35 decorate: function() {
36 this.recommendedApps_ = new appList.startPage.RecommendedApps();
37 this.appendChild(this.recommendedApps_);
40 /**
41 * Sets the recommended apps.
42 * @param {!Array.<!{appId: string,
43 * iconUrl: string,
44 * textTitle: string}>} apps An array of app info
45 * dictionary to be displayed in the AppItemView.
47 setRecommendedApps: function(apps) {
48 this.recommendedApps_.setApps(apps);
52 /**
53 * Initialize the page.
55 function initialize() {
56 StartPage.decorate($('start-page'));
57 speechManager = new speech.SpeechManager();
58 chrome.send('initialize');
61 /**
62 * Sets the recommended apps.
63 * @param {Array.<Object>} apps An array of app info dictionary.
65 function setRecommendedApps(apps) {
66 $('start-page').setRecommendedApps(apps);
69 /**
70 * Invoked when the app-list bubble is shown.
72 function onAppListShown() {
73 speechManager.start();
76 /**
77 * Invoked when the app-list bubble is hidden.
79 function onAppListHidden() {
80 speechManager.stop();
83 /**
84 * Invoked when the user explicitly wants to toggle the speech recognition
85 * state.
87 function toggleSpeechRecognition() {
88 speechManager.toggleSpeechRecognition();
91 return {
92 initialize: initialize,
93 setRecommendedApps: setRecommendedApps,
94 onAppListShown: onAppListShown,
95 onAppListHidden: onAppListHidden,
96 toggleSpeechRecognition: toggleSpeechRecognition
98 });
100 document.addEventListener('contextmenu', function(e) { e.preventDefault(); });
101 document.addEventListener('DOMContentLoaded', appList.startPage.initialize);