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

Side by Side Diff: components/ntp_tiles/webui/resources/ntp_tiles_internals.js

Issue 2572133002: Add more features to ntp-tiles-internal (Closed)
Patch Set: Add ntp_tiles owners to client webui owners Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 cr.define('chrome.ntp_tiles_internals', function() { 5 cr.define('chrome.ntp_tiles_internals', function() {
6 'use strict'; 6 'use strict';
7 7
8 var initialize = function() { 8 var initialize = function() {
9 receiveSites({}); 9 receiveSites({});
10 10
11 $('submit-update').addEventListener('click', function(event) { 11 $('submit-update').addEventListener('click', function(event) {
12 event.preventDefault(); 12 event.preventDefault();
13 chrome.send('update', [{ 13 chrome.send('update', [{
14 "popular": { 14 "popular": {
15 "overrideURL": $('override-url').value, 15 "overrideURL": $('override-url').value,
16 "overrideCountry": $('override-country').value, 16 "overrideCountry": $('override-country').value,
17 "overrideVersion": $('override-version').value, 17 "overrideVersion": $('override-version').value,
18 }, 18 },
19 }]) 19 }]);
20 });
21
22 $('suggestions-fetch').addEventListener('click', function(event) {
23 event.preventDefault();
24 chrome.send('fetchSuggestions');
25 });
26
27 $('popular-view-json').addEventListener('click', function(event) {
28 event.preventDefault();
29 if ($('popular-json-value').textContent === "") {
30 chrome.send('viewPopularSitesJson');
31 } else {
32 $('popular-json-value').textContent = "";
33 }
20 }); 34 });
21 35
22 chrome.send('registerForEvents'); 36 chrome.send('registerForEvents');
23 } 37 }
24 38
25 var receiveSourceInfo = function(state) { 39 var receiveSourceInfo = function(state) {
26 jstProcess(new JsEvalContext(state), $('sources')); 40 jstProcess(new JsEvalContext(state), $('sources'));
27 } 41 }
28 42
29 var receiveSites = function(sites) { 43 var receiveSites = function(sites) {
30 jstProcess(new JsEvalContext(sites), $('sites')); 44 jstProcess(new JsEvalContext(sites), $('sites'));
31 } 45 }
32 46
33 // Return an object with all of the exports. 47 // Return an object with all of the exports.
34 return { 48 return {
35 initialize: initialize, 49 initialize: initialize,
36 receiveSourceInfo: receiveSourceInfo, 50 receiveSourceInfo: receiveSourceInfo,
37 receiveSites: receiveSites, 51 receiveSites: receiveSites,
38 }; 52 };
39 }); 53 });
40 54
41 document.addEventListener('DOMContentLoaded', 55 document.addEventListener('DOMContentLoaded',
42 chrome.ntp_tiles_internals.initialize); 56 chrome.ntp_tiles_internals.initialize);
43 57
OLDNEW
« no previous file with comments | « components/ntp_tiles/webui/resources/ntp_tiles_internals.html ('k') | ios/chrome/browser/ui/webui/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698