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

Unified Diff: chrome/browser/resources/aura/app_list/app_list.js

Issue 8423055: [Aura] Initial app list webui. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove grabber.js Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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..ece784bcace367c63eafe5f4f9d02adddf1b2e97
--- /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 load() {
+ 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,
+ leaveRearrangeMode: leaveRearrangeMode,
+ load: load,
+ 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.load);
« no previous file with comments | « chrome/browser/resources/aura/app_list/app_list.html ('k') | chrome/browser/resources/aura/app_list/apps_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698