| Index: chrome/browser/resources/aura/app_list/app_list.js
|
| diff --git a/chrome/browser/resources/aura/app_list/app_list.js b/chrome/browser/resources/aura/app_list/app_list.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e4d03b0af985137a24356a232df895fd78ada3a5
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/aura/app_list/app_list.js
|
| @@ -0,0 +1,103 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +/**
|
| + * @fileoverview App list UI.
|
| + * For now, most of its logic is borrowed from ntp4.
|
| + */
|
| +
|
| +// Use an anonymous function to enable strict mode just for this file (which
|
| +// will be concatenated with other files when embedded in Chrome
|
| +cr.define('appList', function() {
|
| + 'use strict';
|
| +
|
| + /**
|
| + * AppsView instance.
|
| + * @type {!Object|undefined}
|
| + */
|
| + var appsView;
|
| +
|
| + /**
|
| + * Invoked at startup once the DOM is available to initialize the app.
|
| + */
|
| + function initialize() {
|
| + appsView = new appList.AppsView();
|
| + }
|
| +
|
| + /**
|
| + * Wrappers to forward the callback to corresponding PageListView member.
|
| + */
|
| + function appAdded(appData, opt_highlight) {
|
| + appsView.appAdded(appData, opt_highlight);
|
| + }
|
| +
|
| + function appRemoved(appData, isUninstall) {
|
| + appsView.appRemoved(appData, isUninstall);
|
| + }
|
| +
|
| + function appsPrefChangeCallback(data) {
|
| + appsView.appsPrefChangedCallback(data);
|
| + }
|
| +
|
| + function enterRearrangeMode() {
|
| + appsView.enterRearrangeMode();
|
| + }
|
| +
|
| + function getAppsCallback(data) {
|
| + appsView.getAppsCallback(data);
|
| + }
|
| +
|
| + function getAppsPageIndex(page) {
|
| + appsView.getAppsPageIndex(page);
|
| + }
|
| +
|
| + function getCardSlider() {
|
| + return appsView.cardSlider;
|
| + }
|
| +
|
| + function leaveRearrangeMode(e) {
|
| + appsView.leaveRearrangeMode(e);
|
| + }
|
| +
|
| + function saveAppPageName(appPage, name) {
|
| + appsView.saveAppPageName(appPage, name);
|
| + }
|
| +
|
| + function setAppToBeHighlighted(appId) {
|
| + appsView.highlightAppId = appId;
|
| + }
|
| +
|
| + // Return an object with all the exports
|
| + return {
|
| + appAdded: appAdded,
|
| + appRemoved: appRemoved,
|
| + appsPrefChangeCallback: appsPrefChangeCallback,
|
| + enterRearrangeMode: enterRearrangeMode,
|
| + getAppsPageIndex: getAppsPageIndex,
|
| + getAppsCallback: getAppsCallback,
|
| + getCardSlider: getCardSlider,
|
| + initialize: initialize,
|
| + leaveRearrangeMode: leaveRearrangeMode,
|
| + saveAppPageName: saveAppPageName,
|
| + setAppToBeHighlighted: setAppToBeHighlighted
|
| + };
|
| +});
|
| +
|
| +// publish ntp globals
|
| +// TODO(xiyuan): update the following when content handlers are changed to use
|
| +// ntp namespace.
|
| +var appsPrefChangeCallback = appList.appsPrefChangeCallback;
|
| +var getAppsCallback = appList.getAppsCallback;
|
| +
|
| +var ntp4 = ntp4 || {};
|
| +ntp4.appAdded = appList.appAdded;
|
| +ntp4.appRemoved = appList.appRemoved;
|
| +ntp4.enterRearrangeMode = appList.enterRearrangeMode;
|
| +ntp4.getAppsPageIndex = appList.getAppsPageIndex;
|
| +ntp4.getCardSlider = appList.getCardSlider;
|
| +ntp4.leaveRearrangeMode = appList.leaveRearrangeMode;
|
| +ntp4.saveAppPageName = appList.saveAppPageName;
|
| +ntp4.setAppToBeHighlighted = appList.setAppToBeHighlighted;
|
| +
|
| +document.addEventListener('DOMContentLoaded', appList.initialize);
|
|
|