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

Side by Side Diff: chrome/browser/resources/offline_pages/offline_internals.js

Issue 2246563002: [Offline Pages]Allow multiple urls to be requested in internal page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Parsing on JS side. Created 4 years, 4 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('offlineInternals', function() { 5 cr.define('offlineInternals', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** @type {!Array<OfflinePage>} */ 8 /** @type {!Array<OfflinePage>} */
9 var offlinePages = []; 9 var offlinePages = [];
10 10
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 $('clear-all').onclick = deleteAllPages; 198 $('clear-all').onclick = deleteAllPages;
199 $('clear-selected').onclick = deleteSelectedPages; 199 $('clear-selected').onclick = deleteSelectedPages;
200 $('refresh').onclick = refreshAll; 200 $('refresh').onclick = refreshAll;
201 $('download').onclick = download; 201 $('download').onclick = download;
202 $('log-model-on').onclick = togglePageModelLog.bind(this, true); 202 $('log-model-on').onclick = togglePageModelLog.bind(this, true);
203 $('log-model-off').onclick = togglePageModelLog.bind(this, false); 203 $('log-model-off').onclick = togglePageModelLog.bind(this, false);
204 $('log-request-on').onclick = toggleRequestQueueLog.bind(this, true); 204 $('log-request-on').onclick = toggleRequestQueueLog.bind(this, true);
205 $('log-request-off').onclick = toggleRequestQueueLog.bind(this, false); 205 $('log-request-off').onclick = toggleRequestQueueLog.bind(this, false);
206 $('refresh-logs').onclick = refreshLog; 206 $('refresh-logs').onclick = refreshLog;
207 $('add-to-queue').onclick = function() { 207 $('add-to-queue').onclick = function() {
208 var saveUrl = $('url').value; 208 var saveUrl = $('url').value;
michaelpg 2016/08/20 00:46:47 nit: you don't need this variable
romax 2016/08/20 01:23:20 Done.
209 browserProxy_.addToRequestQueue(saveUrl) 209 var saveUrls = saveUrl.split(',');
210 .then(function(state) { 210 $('save-url-state').textContent = '';
211 if (state) { 211 for (var i = 0; i < saveUrls.length; i++) {
212 $('save-url-state').textContent = 212 (function() {
213 saveUrl + ' has been added to queue.'; 213 var it = i;
michaelpg 2016/08/20 00:46:47 if you use let instead of var in the for loop, i w
romax 2016/08/20 01:23:20 Done.
214 $('url').value = ''; 214 browserProxy_.addToRequestQueue(saveUrls[it])
215 browserProxy_.getRequestQueue().then(fillRequestQueue); 215 .then(function(state) {
michaelpg 2016/08/20 00:46:47 4-space indent, while you're here :-)
romax 2016/08/20 01:23:20 Done.
216 } else { 216 if (state) {
217 $('save-url-state').textContent = 217 $('save-url-state').textContent +=
218 saveUrl + ' failed to be added to queue.'; 218 saveUrls[it] + ' has been added to queue.\n';
michaelpg 2016/08/20 00:46:47 4-space indent
romax 2016/08/20 01:23:20 Done.
219 } 219 $('url').value = '';
220 }); 220 browserProxy_.getRequestQueue().then(fillRequestQueue);
chili 2016/08/19 23:08:49 we're calling .getRequestQueue() a lot... Optiona
michaelpg 2016/08/20 00:46:47 better, use Promise.all: var promises = []; for (
romax 2016/08/20 01:23:20 Done.
221 } else {
222 $('save-url-state').textContent +=
223 saveUrls[it] + ' failed to be added to queue.\n';
michaelpg 2016/08/20 00:46:47 4-space indent
romax 2016/08/20 01:23:20 Done.
224 }
225 });
226 })();
227 }
221 }; 228 };
222 229
223 refreshAll(); 230 refreshAll();
224 } 231 }
225 232
226 // Return an object with all of the exports. 233 // Return an object with all of the exports.
227 return { 234 return {
228 initialize: initialize, 235 initialize: initialize,
229 }; 236 };
230 }); 237 });
231 238
232 document.addEventListener('DOMContentLoaded', offlineInternals.initialize); 239 document.addEventListener('DOMContentLoaded', offlineInternals.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698