| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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('cloudprint', function() { | 5 cr.define('cloudprint', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * API to the Google Cloud Print service. | 9 * API to the Google Cloud Print service. |
| 10 * @param {string} baseUrl Base part of the Google Cloud Print service URL | 10 * @param {string} baseUrl Base part of the Google Cloud Print service URL |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 */ | 308 */ |
| 309 onSearchDone_: function(isRecent, status, result) { | 309 onSearchDone_: function(isRecent, status, result) { |
| 310 --this.outstandingCloudSearchRequestCount_; | 310 --this.outstandingCloudSearchRequestCount_; |
| 311 if (status == 200 && result['success']) { | 311 if (status == 200 && result['success']) { |
| 312 var printerListJson = result['printers'] || []; | 312 var printerListJson = result['printers'] || []; |
| 313 var printerList = []; | 313 var printerList = []; |
| 314 printerListJson.forEach(function(printerJson) { | 314 printerListJson.forEach(function(printerJson) { |
| 315 try { | 315 try { |
| 316 printerList.push( | 316 printerList.push( |
| 317 cloudprint.CloudDestinationParser.parse( | 317 cloudprint.CloudDestinationParser.parse( |
| 318 printerJson, print_preview.Destination.AuthType.COOKIES)); | 318 printerJson, print_preview.Destination.Origin.COOKIES)); |
| 319 } catch (err) { | 319 } catch (err) { |
| 320 console.error('Unable to parse cloud print destination: ' + err); | 320 console.error('Unable to parse cloud print destination: ' + err); |
| 321 } | 321 } |
| 322 }); | 322 }); |
| 323 var searchDoneEvent = | 323 var searchDoneEvent = |
| 324 new cr.Event(CloudPrintInterface.EventType.SEARCH_DONE); | 324 new cr.Event(CloudPrintInterface.EventType.SEARCH_DONE); |
| 325 searchDoneEvent.printers = printerList; | 325 searchDoneEvent.printers = printerList; |
| 326 searchDoneEvent.isRecent = isRecent; | 326 searchDoneEvent.isRecent = isRecent; |
| 327 searchDoneEvent.email = result['request']['user']; | 327 searchDoneEvent.email = result['request']['user']; |
| 328 this.dispatchEvent(searchDoneEvent); | 328 this.dispatchEvent(searchDoneEvent); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 358 * @param {number} status Status of the HTTP request. | 358 * @param {number} status Status of the HTTP request. |
| 359 * @param {Object} result JSON response. | 359 * @param {Object} result JSON response. |
| 360 * @private | 360 * @private |
| 361 */ | 361 */ |
| 362 onPrinterDone_: function(destinationId, status, result) { | 362 onPrinterDone_: function(destinationId, status, result) { |
| 363 if (status == 200 && result['success']) { | 363 if (status == 200 && result['success']) { |
| 364 var printerJson = result['printers'][0]; | 364 var printerJson = result['printers'][0]; |
| 365 var printer; | 365 var printer; |
| 366 try { | 366 try { |
| 367 printer = cloudprint.CloudDestinationParser.parse( | 367 printer = cloudprint.CloudDestinationParser.parse( |
| 368 printerJson, print_preview.Destination.AuthType.COOKIES); | 368 printerJson, print_preview.Destination.Origin.COOKIES); |
| 369 } catch (err) { | 369 } catch (err) { |
| 370 console.error('Failed to parse cloud print destination: ' + | 370 console.error('Failed to parse cloud print destination: ' + |
| 371 JSON.stringify(printerJson)); | 371 JSON.stringify(printerJson)); |
| 372 return; | 372 return; |
| 373 } | 373 } |
| 374 var printerDoneEvent = | 374 var printerDoneEvent = |
| 375 new cr.Event(CloudPrintInterface.EventType.PRINTER_DONE); | 375 new cr.Event(CloudPrintInterface.EventType.PRINTER_DONE); |
| 376 printerDoneEvent.printer = printer; | 376 printerDoneEvent.printer = printer; |
| 377 this.dispatchEvent(printerDoneEvent); | 377 this.dispatchEvent(printerDoneEvent); |
| 378 } else { | 378 } else { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 * @type {string} | 418 * @type {string} |
| 419 */ | 419 */ |
| 420 this.value = value; | 420 this.value = value; |
| 421 }; | 421 }; |
| 422 | 422 |
| 423 // Export | 423 // Export |
| 424 return { | 424 return { |
| 425 CloudPrintInterface: CloudPrintInterface | 425 CloudPrintInterface: CloudPrintInterface |
| 426 }; | 426 }; |
| 427 }); | 427 }); |
| OLD | NEW |