| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // NOTE: If you modify this file, you also have to change its hash in | 6 // NOTE: If you modify this file, you also have to change its hash in |
| 7 // local_ntp.html and in LocalNtpSource::GetContentSecurityPolicyScriptSrc. | 7 // local_ntp.html and in LocalNtpSource::GetContentSecurityPolicyScriptSrc. |
| 8 | 8 |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 document.head.appendChild(inHeadStyle); | 696 document.head.appendChild(inHeadStyle); |
| 697 | 697 |
| 698 inHeadStyle.onload = function() { | 698 inHeadStyle.onload = function() { |
| 699 var inHeadScript = document.createElement('script'); | 699 var inHeadScript = document.createElement('script'); |
| 700 inHeadScript.src = 'chrome-search://local-ntp/one-google/in-head.js'; | 700 inHeadScript.src = 'chrome-search://local-ntp/one-google/in-head.js'; |
| 701 document.head.appendChild(inHeadScript); | 701 document.head.appendChild(inHeadScript); |
| 702 | 702 |
| 703 inHeadScript.onload = function() { | 703 inHeadScript.onload = function() { |
| 704 var ogElem = $('one-google'); | 704 var ogElem = $('one-google'); |
| 705 ogElem.innerHTML = barHtml; | 705 ogElem.innerHTML = barHtml; |
| 706 ogElem.classList.remove('hidden'); |
| 706 | 707 |
| 707 var afterBarScript = document.createElement('script'); | 708 var afterBarScript = document.createElement('script'); |
| 708 afterBarScript.src = | 709 afterBarScript.src = |
| 709 'chrome-search://local-ntp/one-google/after-bar.js'; | 710 'chrome-search://local-ntp/one-google/after-bar.js'; |
| 710 ogElem.parentNode.insertBefore(afterBarScript, ogElem.nextSibling); | 711 ogElem.parentNode.insertBefore(afterBarScript, ogElem.nextSibling); |
| 711 | 712 |
| 712 afterBarScript.onload = function() { | 713 afterBarScript.onload = function() { |
| 713 $('one-google-end-of-body').innerHTML = endOfBodyHtml; | 714 $('one-google-end-of-body').innerHTML = endOfBodyHtml; |
| 714 | 715 |
| 715 var endOfBodyScript = document.createElement('script'); | 716 var endOfBodyScript = document.createElement('script'); |
| 716 endOfBodyScript.src = | 717 endOfBodyScript.src = |
| 717 'chrome-search://local-ntp/one-google/end-of-body.js'; | 718 'chrome-search://local-ntp/one-google/end-of-body.js'; |
| 718 document.body.appendChild(endOfBodyScript); | 719 document.body.appendChild(endOfBodyScript); |
| 719 } | 720 } |
| 720 } | 721 } |
| 721 } | 722 } |
| 722 } | 723 } |
| 723 | 724 |
| 724 | 725 |
| 725 return { | 726 return { |
| 726 init: init, // Exposed for testing. | 727 init: init, // Exposed for testing. |
| 727 listen: listen | 728 listen: listen |
| 728 }; | 729 }; |
| 729 | 730 |
| 730 } | 731 } |
| 731 | 732 |
| 732 if (!window.localNTPUnitTest) { | 733 if (!window.localNTPUnitTest) { |
| 733 LocalNTP().listen(); | 734 LocalNTP().listen(); |
| 734 } | 735 } |
| OLD | NEW |