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

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

Issue 2928243002: Return operation name in prefetch request callback and add internal page hookup (Closed)
Patch Set: Created 3 years, 6 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 163
164 /** 164 /**
165 * Callback when requests are deleted. 165 * Callback when requests are deleted.
166 */ 166 */
167 function requestsDeleted(status) { 167 function requestsDeleted(status) {
168 $('request-queue-actions-info').textContent = status; 168 $('request-queue-actions-info').textContent = status;
169 browserProxy.getRequestQueue().then(fillRequestQueue); 169 browserProxy.getRequestQueue().then(fillRequestQueue);
170 } 170 }
171 171
172 /**
173 * Callback for prefetch actins.
174 * @param {!IsLogging} logStatus Status of logging.
175 */
176 function setPrefetchResult(info) {
177 $('prefetch-actions-info').textContent = info;
178 }
179
172 /** 180 /**
173 * Downloads all the stored page and request queue information into a file. 181 * Downloads all the stored page and request queue information into a file.
174 * TODO(chili): Create a CSV writer that can abstract out the line joining. 182 * TODO(chili): Create a CSV writer that can abstract out the line joining.
175 */ 183 */
176 function download() { 184 function download() {
177 var json = JSON.stringify({ 185 var json = JSON.stringify({
178 offlinePages: offlinePages, 186 offlinePages: offlinePages,
179 savePageRequests: savePageRequests 187 savePageRequests: savePageRequests
180 }, null, 2); 188 }, null, 2);
181 189
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 browserProxy.getRequestQueue().then(fillRequestQueue); 294 browserProxy.getRequestQueue().then(fillRequestQueue);
287 } 295 }
288 } else { 296 } else {
289 $('save-url-state').textContent += 297 $('save-url-state').textContent +=
290 saveUrls[i] + ' failed to be added to queue.\n'; 298 saveUrls[i] + ' failed to be added to queue.\n';
291 } 299 }
292 }); 300 });
293 } 301 }
294 }; 302 };
295 $('schedule-nwake').onclick = function() { 303 $('schedule-nwake').onclick = function() {
296 browserProxy.scheduleNwake(); 304 browserProxy.scheduleNwake().then(setPrefetchResult);
297 }; 305 };
298 $('cancel-nwake').onclick = function() { 306 $('cancel-nwake').onclick = function() {
299 browserProxy.cancelNwake(); 307 browserProxy.cancelNwake().then(setPrefetchResult);
308 };
309 $('generate-page-bundle').onclick = function() {
310 browserProxy.generatePageBundle($('request-data').value).
311 then(setPrefetchResult);
312 };
313 $('get-operation').onclick = function() {
314 browserProxy.getOperation($('request-data').value).
315 then(setPrefetchResult);
300 }; 316 };
301 if (!incognito) 317 if (!incognito)
302 refreshAll(); 318 refreshAll();
303 } 319 }
304 320
305 // Return an object with all of the exports. 321 // Return an object with all of the exports.
306 return { 322 return {
307 initialize: initialize, 323 initialize: initialize,
308 }; 324 };
309 }); 325 });
310 326
311 document.addEventListener('DOMContentLoaded', offlineInternals.initialize); 327 document.addEventListener('DOMContentLoaded', offlineInternals.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698