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

Side by Side Diff: chrome/browser/resources/ntp4/page_list_view.js

Issue 9567027: aura: Remove apps from NTP4 and disable NTP4 intro bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview PageListView implementation. 6 * @fileoverview PageListView implementation.
7 * PageListView manages page list, dot list, switcher buttons and handles apps 7 * PageListView manages page list, dot list, switcher buttons and handles apps
8 * pages callbacks from backend. 8 * pages callbacks from backend.
9 * 9 *
10 * Note that you need to have AppLauncherHandler in your WebUI to use this code. 10 * Note that you need to have AppLauncherHandler in your WebUI to use this code.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 if (this.pageSwitcherStart) 146 if (this.pageSwitcherStart)
147 ntp.initializePageSwitcher(this.pageSwitcherStart); 147 ntp.initializePageSwitcher(this.pageSwitcherStart);
148 148
149 this.pageSwitcherEnd = opt_pageSwitcherEnd; 149 this.pageSwitcherEnd = opt_pageSwitcherEnd;
150 if (this.pageSwitcherEnd) 150 if (this.pageSwitcherEnd)
151 ntp.initializePageSwitcher(this.pageSwitcherEnd); 151 ntp.initializePageSwitcher(this.pageSwitcherEnd);
152 152
153 this.shownPage = templateData.shown_page_type; 153 this.shownPage = templateData.shown_page_type;
154 this.shownPageIndex = templateData.shown_page_index; 154 this.shownPageIndex = templateData.shown_page_index;
155 155
156 // Request data on the apps so we can fill them in. 156 if (templateData.showAppsPage) {
157 // Note that this is kicked off asynchronously. 'getAppsCallback' will be 157 // Request data on the apps so we can fill them in.
158 // invoked at some point after this function returns. 158 // Note that this is kicked off asynchronously. 'getAppsCallback' will
159 chrome.send('getApps'); 159 // be invoked at some point after this function returns.
160 chrome.send('getApps');
161 } else {
162 // No apps page.
163 if (this.shownPage == templateData['apps_page_id']) {
164 this.shownPage = templateData['most_visited_page_id'];
165 this.shownPageIndex = 0;
166 }
167
168 // Mark section ready asynchronously soon after.
169 window.setTimeout(this.markSectionReady_.bind(this), 0);
170 }
160 171
161 document.addEventListener('keydown', this.onDocKeyDown_.bind(this)); 172 document.addEventListener('keydown', this.onDocKeyDown_.bind(this));
162 // Prevent touch events from triggering any sort of native scrolling 173 // Prevent touch events from triggering any sort of native scrolling
163 document.addEventListener('touchmove', function(e) { 174 document.addEventListener('touchmove', function(e) {
164 e.preventDefault(); 175 e.preventDefault();
165 }, true); 176 }, true);
166 177
167 this.tilePages = this.pageList.getElementsByClassName('tile-page'); 178 this.tilePages = this.pageList.getElementsByClassName('tile-page');
168 this.appsPages = this.pageList.getElementsByClassName('apps-page'); 179 this.appsPages = this.pageList.getElementsByClassName('apps-page');
169 180
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if (app.id == this.highlightAppId) 370 if (app.id == this.highlightAppId)
360 highlightApp = app; 371 highlightApp = app;
361 else 372 else
362 this.appsPages[pageIndex].appendApp(app, false); 373 this.appsPages[pageIndex].appendApp(app, false);
363 } 374 }
364 375
365 ntp.AppsPage.setPromo(data.showPromo ? data : null); 376 ntp.AppsPage.setPromo(data.showPromo ? data : null);
366 377
367 this.cardSlider.currentCard = prevCurrentCard; 378 this.cardSlider.currentCard = prevCurrentCard;
368 379
369 // Tell the slider about the pages.
370 this.updateSliderCards();
371
372 if (highlightApp) 380 if (highlightApp)
373 this.appAdded(highlightApp, true); 381 this.appAdded(highlightApp, true);
374 382
383 logEvent('apps.layout: ' + (Date.now() - startTime));
384
385 this.markSectionReady_();
386 },
387
388 /**
389 * Marks section ready.
390 * @private
391 */
392 markSectionReady_: function() {
393 // Tell the slider about the pages.
394 this.updateSliderCards();
375 // Mark the current page. 395 // Mark the current page.
376 this.cardSlider.currentCardValue.navigationDot.classList.add('selected'); 396 this.cardSlider.currentCardValue.navigationDot.classList.add('selected');
377 logEvent('apps.layout: ' + (Date.now() - startTime));
378 397
379 document.documentElement.classList.remove('starting-up'); 398 document.documentElement.classList.remove('starting-up');
380
381 cr.dispatchSimpleEvent(document, 'sectionready', true, true); 399 cr.dispatchSimpleEvent(document, 'sectionready', true, true);
382 }, 400 },
383 401
384 /** 402 /**
385 * Called by chrome when a new app has been added to chrome or has been 403 * Called by chrome when a new app has been added to chrome or has been
386 * enabled if previously disabled. 404 * enabled if previously disabled.
387 * @param {Object} appData A data structure full of relevant information for 405 * @param {Object} appData A data structure full of relevant information for
388 * the app. 406 * the app.
389 */ 407 */
390 appAdded: function(appData, opt_highlight) { 408 appAdded: function(appData, opt_highlight) {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 if (page.navigationDot) 707 if (page.navigationDot)
690 page.navigationDot.remove(opt_animate); 708 page.navigationDot.remove(opt_animate);
691 this.cardSlider.removeCard(page); 709 this.cardSlider.removeCard(page);
692 }, 710 },
693 }; 711 };
694 712
695 return { 713 return {
696 PageListView: PageListView 714 PageListView: PageListView
697 }; 715 };
698 }); 716 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/new_tab_page_handler.cc » ('j') | chrome/browser/ui/webui/ntp/new_tab_ui.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698