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

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

Issue 6966022: ntp4: Make theme attribution separate from chrome logo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rtl Created 9 years, 7 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
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 New tab page 6 * @fileoverview New tab page
7 * This is the main code for the new tab page used by touch-enabled Chrome 7 * This is the main code for the new tab page used by touch-enabled Chrome
8 * browsers. For now this is still a prototype. 8 * browsers. For now this is still a prototype.
9 */ 9 */
10 10
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 }, DEFAULT_TRANSITION_TIME); 673 }, DEFAULT_TRANSITION_TIME);
674 674
675 updateSliderCards(); 675 updateSliderCards();
676 } 676 }
677 677
678 // TODO(estade): rename newtab.css to new_tab_theme.css 678 // TODO(estade): rename newtab.css to new_tab_theme.css
679 function themeChanged(hasAttribution) { 679 function themeChanged(hasAttribution) {
680 $('themecss').href = 'chrome://theme/css/newtab.css?' + Date.now(); 680 $('themecss').href = 'chrome://theme/css/newtab.css?' + Date.now();
681 if (typeof hasAttribution != 'undefined') 681 if (typeof hasAttribution != 'undefined')
682 document.documentElement.setAttribute('hasattribution', hasAttribution); 682 document.documentElement.setAttribute('hasattribution', hasAttribution);
683 updateLogo();
683 updateAttribution(); 684 updateAttribution();
684 } 685 }
685 686
686 /** 687 /**
687 * Sets the proper image for the logo at the bottom left. 688 * Sets the proper image for the logo at the bottom left.
688 */ 689 */
689 function updateAttribution() { 690 function updateLogo() {
690 // Default value for standard NTP with no theme attribution or custom logo.
691 var imageId = 'IDR_PRODUCT_LOGO'; 691 var imageId = 'IDR_PRODUCT_LOGO';
692 // Theme attribution always overrides custom logos. 692 if (document.documentElement.getAttribute('customlogo') == 'true')
693 if (document.documentElement.getAttribute('hasattribution') == 'true')
694 imageId = 'IDR_THEME_NTP_ATTRIBUTION';
695 else if (document.documentElement.getAttribute('customlogo') == 'true')
696 imageId = 'IDR_CUSTOM_PRODUCT_LOGO'; 693 imageId = 'IDR_CUSTOM_PRODUCT_LOGO';
697 694
698 $('attribution-img').src = 'chrome://theme/' + imageId + '?' + Date.now(); 695 $('logo-img').src = 'chrome://theme/' + imageId + '?' + Date.now();
696 }
697
698 /**
699 * Attributes the attribution image at the bottom left.
700 */
701 function updateAttribution() {
702 var attribution = $('attribution');
703 if (document.documentElement.getAttribute('hasattribution') == 'true') {
704 $('attribution-img').src =
705 'chrome://theme/IDR_THEME_NTP_ATTRIBUTION?' + Date.now();
706 attribution.hidden = false;
707 } else {
708 attribution.hidden = true;
709 }
710
699 } 711 }
700 712
701 function setRecentlyClosedTabs(dataItems) { 713 function setRecentlyClosedTabs(dataItems) {
702 $('recently-closed-menu-button').dataItems = dataItems; 714 $('recently-closed-menu-button').dataItems = dataItems;
703 } 715 }
704 716
705 function setMostVisitedPages(data, firstRun, hasBlacklistedUrls) { 717 function setMostVisitedPages(data, firstRun, hasBlacklistedUrls) {
706 mostVisitedPage.data = data; 718 mostVisitedPage.data = data;
707 } 719 }
708 720
(...skipping 13 matching lines...) Expand all
722 // TODO(estade): update the content handlers to use ntp namespace instead of 734 // TODO(estade): update the content handlers to use ntp namespace instead of
723 // making these global. 735 // making these global.
724 var assert = ntp4.assert; 736 var assert = ntp4.assert;
725 var getAppsCallback = ntp4.getAppsCallback; 737 var getAppsCallback = ntp4.getAppsCallback;
726 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; 738 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback;
727 var themeChanged = ntp4.themeChanged; 739 var themeChanged = ntp4.themeChanged;
728 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; 740 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs;
729 var setMostVisitedPages = ntp4.setMostVisitedPages; 741 var setMostVisitedPages = ntp4.setMostVisitedPages;
730 742
731 document.addEventListener('DOMContentLoaded', ntp4.initialize); 743 document.addEventListener('DOMContentLoaded', ntp4.initialize);
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698