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

Side by Side Diff: chrome/browser/resources/print_preview/search/destination_search.js

Issue 590643002: Move Print Preview onto newer i18nTemplate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix open-preview-app-throbber Created 6 years, 3 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 (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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 * @private 48 * @private
49 */ 49 */
50 this.registerPromoShownMetricRecorded_ = false; 50 this.registerPromoShownMetricRecorded_ = false;
51 51
52 /** 52 /**
53 * Search box used to search through the destination lists. 53 * Search box used to search through the destination lists.
54 * @type {!print_preview.SearchBox} 54 * @type {!print_preview.SearchBox}
55 * @private 55 * @private
56 */ 56 */
57 this.searchBox_ = new print_preview.SearchBox( 57 this.searchBox_ = new print_preview.SearchBox(
58 localStrings.getString('searchBoxPlaceholder')); 58 loadTimeData.getString('searchBoxPlaceholder'));
59 this.addChild(this.searchBox_); 59 this.addChild(this.searchBox_);
60 60
61 /** 61 /**
62 * Destination list containing recent destinations. 62 * Destination list containing recent destinations.
63 * @type {!print_preview.DestinationList} 63 * @type {!print_preview.DestinationList}
64 * @private 64 * @private
65 */ 65 */
66 this.recentList_ = new print_preview.RecentDestinationList(this); 66 this.recentList_ = new print_preview.RecentDestinationList(this);
67 this.addChild(this.recentList_); 67 this.addChild(this.recentList_);
68 68
69 /** 69 /**
70 * Destination list containing local destinations. 70 * Destination list containing local destinations.
71 * @type {!print_preview.DestinationList} 71 * @type {!print_preview.DestinationList}
72 * @private 72 * @private
73 */ 73 */
74 this.localList_ = new print_preview.DestinationList( 74 this.localList_ = new print_preview.DestinationList(
75 this, 75 this,
76 localStrings.getString('localDestinationsTitle'), 76 loadTimeData.getString('localDestinationsTitle'),
77 cr.isChromeOS ? null : localStrings.getString('manage')); 77 cr.isChromeOS ? null : loadTimeData.getString('manage'));
78 this.addChild(this.localList_); 78 this.addChild(this.localList_);
79 79
80 /** 80 /**
81 * Destination list containing cloud destinations. 81 * Destination list containing cloud destinations.
82 * @type {!print_preview.DestinationList} 82 * @type {!print_preview.DestinationList}
83 * @private 83 * @private
84 */ 84 */
85 this.cloudList_ = new print_preview.CloudDestinationList(this); 85 this.cloudList_ = new print_preview.CloudDestinationList(this);
86 this.addChild(this.cloudList_); 86 this.addChild(this.cloudList_);
87 }; 87 };
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Render any destinations already in the store. 234 // Render any destinations already in the store.
235 this.renderDestinations_(); 235 this.renderDestinations_();
236 }, 236 },
237 237
238 /** @override */ 238 /** @override */
239 decorateInternal: function() { 239 decorateInternal: function() {
240 this.searchBox_.render(this.getChildElement('.search-box-container')); 240 this.searchBox_.render(this.getChildElement('.search-box-container'));
241 this.recentList_.render(this.getChildElement('.recent-list')); 241 this.recentList_.render(this.getChildElement('.recent-list'));
242 this.localList_.render(this.getChildElement('.local-list')); 242 this.localList_.render(this.getChildElement('.local-list'));
243 this.cloudList_.render(this.getChildElement('.cloud-list')); 243 this.cloudList_.render(this.getChildElement('.cloud-list'));
244 this.getChildElement('.promo-text').innerHTML = localStrings.getStringF( 244 this.getChildElement('.promo-text').innerHTML = loadTimeData.getStringF(
245 'cloudPrintPromotion', 245 'cloudPrintPromotion',
246 '<span class="sign-in link-button">', 246 '<span class="sign-in link-button">',
247 '</span>'); 247 '</span>');
248 this.getChildElement('.account-select-label').textContent = 248 this.getChildElement('.account-select-label').textContent =
249 localStrings.getString('accountSelectTitle'); 249 loadTimeData.getString('accountSelectTitle');
250 }, 250 },
251 251
252 /** 252 /**
253 * @return {number} Height available for destination lists, in pixels. 253 * @return {number} Height available for destination lists, in pixels.
254 * @private 254 * @private
255 */ 255 */
256 getAvailableListsHeight_: function() { 256 getAvailableListsHeight_: function() {
257 var elStyle = window.getComputedStyle(this.getElement()); 257 var elStyle = window.getComputedStyle(this.getElement());
258 return this.getElement().offsetHeight - 258 return this.getElement().offsetHeight -
259 parseInt(elStyle.getPropertyValue('padding-top')) - 259 parseInt(elStyle.getPropertyValue('padding-top')) -
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 if (loggedIn) { 422 if (loggedIn) {
423 var accountSelectEl = this.getChildElement('.account-select'); 423 var accountSelectEl = this.getChildElement('.account-select');
424 accountSelectEl.innerHTML = ''; 424 accountSelectEl.innerHTML = '';
425 this.userInfo_.users.forEach(function(account) { 425 this.userInfo_.users.forEach(function(account) {
426 var option = document.createElement('option'); 426 var option = document.createElement('option');
427 option.text = account; 427 option.text = account;
428 option.value = account; 428 option.value = account;
429 accountSelectEl.add(option); 429 accountSelectEl.add(option);
430 }); 430 });
431 var option = document.createElement('option'); 431 var option = document.createElement('option');
432 option.text = localStrings.getString('addAccountTitle'); 432 option.text = loadTimeData.getString('addAccountTitle');
433 option.value = ''; 433 option.value = '';
434 accountSelectEl.add(option); 434 accountSelectEl.add(option);
435 435
436 accountSelectEl.selectedIndex = 436 accountSelectEl.selectedIndex =
437 this.userInfo_.users.indexOf(this.userInfo_.activeUser); 437 this.userInfo_.users.indexOf(this.userInfo_.activeUser);
438 } 438 }
439 439
440 setIsVisible(this.getChildElement('.user-info'), loggedIn); 440 setIsVisible(this.getChildElement('.user-info'), loggedIn);
441 setIsVisible(this.getChildElement('.cloud-list'), loggedIn); 441 setIsVisible(this.getChildElement('.cloud-list'), loggedIn);
442 setIsVisible(this.getChildElement('.cloudprint-promo'), !loggedIn); 442 setIsVisible(this.getChildElement('.cloudprint-promo'), !loggedIn);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 onWindowResize_: function() { 580 onWindowResize_: function() {
581 this.reflowLists_(); 581 this.reflowLists_();
582 } 582 }
583 }; 583 };
584 584
585 // Export 585 // Export
586 return { 586 return {
587 DestinationSearch: DestinationSearch 587 DestinationSearch: DestinationSearch
588 }; 588 };
589 }); 589 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698