| 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('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Component used for searching for a print destination. | 9 * Component used for searching for a print destination. |
| 10 * This is a modal dialog that allows the user to search and select a | 10 * This is a modal dialog that allows the user to search and select a |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 this.userInfo_ = userInfo; | 36 this.userInfo_ = userInfo; |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Used to record usage statistics. | 39 * Used to record usage statistics. |
| 40 * @type {!print_preview.Metrics} | 40 * @type {!print_preview.Metrics} |
| 41 * @private | 41 * @private |
| 42 */ | 42 */ |
| 43 this.metrics_ = metrics; | 43 this.metrics_ = metrics; |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * Whether or not a UMA histogram for the register promo being shown was |
| 47 * already recorded. |
| 48 * @type {bool} |
| 49 * @private |
| 50 */ |
| 51 this.registerPromoShownMetricRecorded_ = false; |
| 52 |
| 53 /** |
| 46 * Search box used to search through the destination lists. | 54 * Search box used to search through the destination lists. |
| 47 * @type {!print_preview.SearchBox} | 55 * @type {!print_preview.SearchBox} |
| 48 * @private | 56 * @private |
| 49 */ | 57 */ |
| 50 this.searchBox_ = new print_preview.SearchBox(); | 58 this.searchBox_ = new print_preview.SearchBox(); |
| 51 this.addChild(this.searchBox_); | 59 this.addChild(this.searchBox_); |
| 52 | 60 |
| 53 /** | 61 /** |
| 54 * Destination list containing recent destinations. | 62 * Destination list containing recent destinations. |
| 55 * @type {!print_preview.DestinationList} | 63 * @type {!print_preview.DestinationList} |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } else { | 323 } else { |
| 316 if (destination.connectionStatus == | 324 if (destination.connectionStatus == |
| 317 print_preview.Destination.ConnectionStatus.UNREGISTERED) { | 325 print_preview.Destination.ConnectionStatus.UNREGISTERED) { |
| 318 unregisteredCloudDestinations.push(destination); | 326 unregisteredCloudDestinations.push(destination); |
| 319 } else { | 327 } else { |
| 320 cloudDestinations.push(destination); | 328 cloudDestinations.push(destination); |
| 321 } | 329 } |
| 322 } | 330 } |
| 323 }); | 331 }); |
| 324 | 332 |
| 333 if (unregisteredCloudDestinations.length != 0 && |
| 334 !this.registerPromoShownMetricRecorded_) { |
| 335 this.metrics_.incrementDestinationSearchBucket( |
| 336 print_preview.Metrics.DestinationSearchBucket.REGISTER_PROMO_SHOWN); |
| 337 this.registerPromoShownMetricRecorded_ = true; |
| 338 } |
| 339 |
| 325 var finalCloudDestinations = unregisteredCloudDestinations.slice( | 340 var finalCloudDestinations = unregisteredCloudDestinations.slice( |
| 326 0, DestinationSearch.MAX_PROMOTED_UNREGISTERED_PRINTERS_).concat( | 341 0, DestinationSearch.MAX_PROMOTED_UNREGISTERED_PRINTERS_).concat( |
| 327 cloudDestinations, | 342 cloudDestinations, |
| 328 unregisteredCloudDestinations.slice( | 343 unregisteredCloudDestinations.slice( |
| 329 DestinationSearch.MAX_PROMOTED_UNREGISTERED_PRINTERS_)); | 344 DestinationSearch.MAX_PROMOTED_UNREGISTERED_PRINTERS_)); |
| 330 | 345 |
| 331 this.recentList_.updateDestinations(recentDestinations); | 346 this.recentList_.updateDestinations(recentDestinations); |
| 332 this.localList_.updateDestinations(localDestinations); | 347 this.localList_.updateDestinations(localDestinations); |
| 333 this.cloudList_.updateDestinations(finalCloudDestinations); | 348 this.cloudList_.updateDestinations(finalCloudDestinations); |
| 334 }, | 349 }, |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 onWindowResize_: function() { | 548 onWindowResize_: function() { |
| 534 this.reflowLists_(); | 549 this.reflowLists_(); |
| 535 } | 550 } |
| 536 }; | 551 }; |
| 537 | 552 |
| 538 // Export | 553 // Export |
| 539 return { | 554 return { |
| 540 DestinationSearch: DestinationSearch | 555 DestinationSearch: DestinationSearch |
| 541 }; | 556 }; |
| 542 }); | 557 }); |
| OLD | NEW |