OLD | NEW |
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 /** | 5 /** |
6 * Chrome window that hosts UI. Only one window is allowed. | 6 * Chrome window that hosts UI. Only one window is allowed. |
7 * @type {chrome.app.window.AppWindow} | 7 * @type {chrome.app.window.AppWindow} |
8 */ | 8 */ |
9 var appWindow = null; | 9 var appWindow = null; |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 */ | 56 */ |
57 function sendNativeMessage(event, opt_props) { | 57 function sendNativeMessage(event, opt_props) { |
58 var message = Object.assign({'event': event}, opt_props); | 58 var message = Object.assign({'event': event}, opt_props); |
59 port.postMessage(message); | 59 port.postMessage(message); |
60 } | 60 } |
61 | 61 |
62 /** | 62 /** |
63 * Class to handle checkbox corresponding to a preference. | 63 * Class to handle checkbox corresponding to a preference. |
64 */ | 64 */ |
65 class PreferenceCheckbox { | 65 class PreferenceCheckbox { |
66 | |
67 /** | 66 /** |
68 * Creates a Checkbox which handles the corresponding preference update. | 67 * Creates a Checkbox which handles the corresponding preference update. |
69 * @param {Element} container The container this checkbox corresponds to. | 68 * @param {Element} container The container this checkbox corresponds to. |
70 * The element must have <input type="checkbox" class="checkbox-option"> | 69 * The element must have <input type="checkbox" class="checkbox-option"> |
71 * for the checkbox itself, and <p class="checkbox-text"> for its label. | 70 * for the checkbox itself, and <p class="checkbox-text"> for its label. |
72 * @param {string} learnMoreContent I18n content which is shown when "Learn | 71 * @param {string} learnMoreContent I18n content which is shown when "Learn |
73 * More" link is clicked. | 72 * More" link is clicked. |
74 * @param {string?} learnMoreLinkId The ID for the "Learn More" link element. | 73 * @param {string?} learnMoreLinkId The ID for the "Learn More" link element. |
75 * TODO: Get rid of this. The element can have class so that it can be | 74 * TODO: Get rid of this. The element can have class so that it can be |
76 * identified easily. Also, it'd be better to extract the link element | 75 * identified easily. Also, it'd be better to extract the link element |
(...skipping 23 matching lines...) Expand all Loading... |
100 } else { | 99 } else { |
101 this.policyIndicator_ = null; | 100 this.policyIndicator_ = null; |
102 } | 101 } |
103 } | 102 } |
104 | 103 |
105 /** | 104 /** |
106 * Returns if the checkbox is checked or not. Note that this *may* be | 105 * Returns if the checkbox is checked or not. Note that this *may* be |
107 * different from the preference value, because the user's check is | 106 * different from the preference value, because the user's check is |
108 * not propagated to the preference until the user clicks "AGREE" button. | 107 * not propagated to the preference until the user clicks "AGREE" button. |
109 */ | 108 */ |
110 isChecked() { return this.checkbox_.checked; } | 109 isChecked() { |
| 110 return this.checkbox_.checked; |
| 111 } |
111 | 112 |
112 /** | 113 /** |
113 * Called when the preference value in native code is updated. | 114 * Called when the preference value in native code is updated. |
114 */ | 115 */ |
115 onPreferenceChanged(isEnabled, isManaged) { | 116 onPreferenceChanged(isEnabled, isManaged) { |
116 this.checkbox_.checked = isEnabled; | 117 this.checkbox_.checked = isEnabled; |
117 this.checkbox_.disabled = isManaged; | 118 this.checkbox_.disabled = isManaged; |
118 this.label_.disabled = isManaged; | 119 this.label_.disabled = isManaged; |
119 | 120 |
120 if (this.policyIndicator_) { | 121 if (this.policyIndicator_) { |
(...skipping 13 matching lines...) Expand all Loading... |
134 } | 135 } |
135 } | 136 } |
136 | 137 |
137 /** | 138 /** |
138 * Handles the checkbox action of metrics preference. | 139 * Handles the checkbox action of metrics preference. |
139 * This has special customization e.g. show/hide the checkbox based on | 140 * This has special customization e.g. show/hide the checkbox based on |
140 * the native preference. | 141 * the native preference. |
141 */ | 142 */ |
142 class MetricsPreferenceCheckbox extends PreferenceCheckbox { | 143 class MetricsPreferenceCheckbox extends PreferenceCheckbox { |
143 constructor( | 144 constructor( |
144 container, learnMoreContent, learnMoreLinkId, isOwner, | 145 container, learnMoreContent, learnMoreLinkId, isOwner, textDisabled, |
145 textDisabled, textEnabled, textManagedDisabled, textManagedEnabled) { | 146 textEnabled, textManagedDisabled, textManagedEnabled) { |
146 // Do not use policy indicator. | 147 // Do not use policy indicator. |
147 // Learn More link handling is done by this class. | 148 // Learn More link handling is done by this class. |
148 // So pass |null| intentionally. | 149 // So pass |null| intentionally. |
149 super(container, learnMoreContent, null, null); | 150 super(container, learnMoreContent, null, null); |
150 | 151 |
151 this.learnMoreLinkId_ = learnMoreLinkId; | 152 this.learnMoreLinkId_ = learnMoreLinkId; |
152 this.isOwner_ = isOwner; | 153 this.isOwner_ = isOwner; |
153 | 154 |
154 // Two dimensional array. First dimension is whether it is managed or not, | 155 // Two dimensional array. First dimension is whether it is managed or not, |
155 // the second one is whether it is enabled or not. | 156 // the second one is whether it is enabled or not. |
156 this.texts_ = [ | 157 this.texts_ = [ |
157 [textDisabled, textEnabled], | 158 [textDisabled, textEnabled], |
158 [textManagedDisabled, textManagedEnabled] | 159 [textManagedDisabled, textManagedEnabled], |
159 ]; | 160 ]; |
160 } | 161 } |
161 | 162 |
162 onPreferenceChanged(isEnabled, isManaged) { | 163 onPreferenceChanged(isEnabled, isManaged) { |
163 isManaged = isManaged || !this.isOwner_; | 164 isManaged = isManaged || !this.isOwner_; |
164 super.onPreferenceChanged(isEnabled, isManaged); | 165 super.onPreferenceChanged(isEnabled, isManaged); |
165 | 166 |
166 // Hide the checkbox if it is not allowed to (re-)enable. | 167 // Hide the checkbox if it is not allowed to (re-)enable. |
167 var canEnable = !isEnabled && !isManaged; | 168 var canEnable = !isEnabled && !isManaged; |
168 this.checkbox_.hidden = !canEnable; | 169 this.checkbox_.hidden = !canEnable; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 LOADING: 1, | 201 LOADING: 1, |
201 ABORTED: 2, | 202 ABORTED: 2, |
202 LOADED: 3, | 203 LOADED: 3, |
203 }; | 204 }; |
204 | 205 |
205 /** | 206 /** |
206 * Handles events for Terms-Of-Service page. Also this implements the async | 207 * Handles events for Terms-Of-Service page. Also this implements the async |
207 * loading of Terms-Of-Service content. | 208 * loading of Terms-Of-Service content. |
208 */ | 209 */ |
209 class TermsOfServicePage { | 210 class TermsOfServicePage { |
210 | |
211 /** | 211 /** |
212 * @param {Element} container The container of the page. | 212 * @param {Element} container The container of the page. |
213 * @param {boolean} isManaged Set true if ARC is managed. | 213 * @param {boolean} isManaged Set true if ARC is managed. |
214 * @param {string} countryCode The country code for the terms of service. | 214 * @param {string} countryCode The country code for the terms of service. |
215 * @param {MetricsPreferenceCheckbox} metricsCheckbox. The checkbox for the | 215 * @param {MetricsPreferenceCheckbox} metricsCheckbox. The checkbox for the |
216 * metrics preference. | 216 * metrics preference. |
217 * @param {PreferenceCheckbox} backupRestoreCheckbox The checkbox for the | 217 * @param {PreferenceCheckbox} backupRestoreCheckbox The checkbox for the |
218 * backup-restore preference. | 218 * backup-restore preference. |
219 * @param {PreferenceCheckbox} locationServiceCheckbox The checkbox for the | 219 * @param {PreferenceCheckbox} locationServiceCheckbox The checkbox for the |
220 * location service. | 220 * location service. |
221 */ | 221 */ |
222 constructor( | 222 constructor( |
223 container, isManaged, countryCode, | 223 container, isManaged, countryCode, metricsCheckbox, backupRestoreCheckbox, |
224 metricsCheckbox, backupRestoreCheckbox, locationServiceCheckbox) { | 224 locationServiceCheckbox) { |
225 this.loadingContainer_ = | 225 this.loadingContainer_ = |
226 container.querySelector('#terms-of-service-loading'); | 226 container.querySelector('#terms-of-service-loading'); |
227 this.contentContainer_ = | 227 this.contentContainer_ = |
228 container.querySelector('#terms-of-service-content'); | 228 container.querySelector('#terms-of-service-content'); |
229 | 229 |
230 this.metricsCheckbox_ = metricsCheckbox; | 230 this.metricsCheckbox_ = metricsCheckbox; |
231 this.backupRestoreCheckbox_ = backupRestoreCheckbox; | 231 this.backupRestoreCheckbox_ = backupRestoreCheckbox; |
232 this.locationServiceCheckbox_ = locationServiceCheckbox; | 232 this.locationServiceCheckbox_ = locationServiceCheckbox; |
233 | 233 |
234 this.isManaged_ = isManaged; | 234 this.isManaged_ = isManaged; |
235 | 235 |
236 // Set event listener for webview loading. | 236 // Set event listener for webview loading. |
237 this.termsView_ = container.querySelector('#terms-view'); | 237 this.termsView_ = container.querySelector('#terms-view'); |
238 this.termsView_.addEventListener( | 238 this.termsView_.addEventListener( |
239 'loadstart', () => this.onTermsViewLoadStarted_()); | 239 'loadstart', () => this.onTermsViewLoadStarted_()); |
240 this.termsView_.addEventListener( | 240 this.termsView_.addEventListener( |
241 'contentload', () => this.onTermsViewLoaded_()); | 241 'contentload', () => this.onTermsViewLoaded_()); |
242 this.termsView_.addEventListener( | 242 this.termsView_.addEventListener( |
243 'loadabort', (event) => this.onTermsViewLoadAborted_(event.reason)); | 243 'loadabort', (event) => this.onTermsViewLoadAborted_(event.reason)); |
244 | 244 |
245 var scriptSetCountryCode = | 245 var scriptSetCountryCode = |
246 'document.countryCode = \'' + countryCode.toLowerCase() + '\';'; | 246 'document.countryCode = \'' + countryCode.toLowerCase() + '\';'; |
247 this.termsView_.addContentScripts([ | 247 this.termsView_.addContentScripts([ |
248 { name: 'preProcess', | 248 { |
| 249 name: 'preProcess', |
249 matches: ['https://play.google.com/*'], | 250 matches: ['https://play.google.com/*'], |
250 js: { code: scriptSetCountryCode }, | 251 js: {code: scriptSetCountryCode}, |
251 run_at: 'document_start' | 252 run_at: 'document_start' |
252 }, | 253 }, |
253 { name: 'postProcess', | 254 { |
| 255 name: 'postProcess', |
254 matches: ['https://play.google.com/*'], | 256 matches: ['https://play.google.com/*'], |
255 css: { files: ['playstore.css'] }, | 257 css: {files: ['playstore.css']}, |
256 js: { files: ['playstore.js'] }, | 258 js: {files: ['playstore.js']}, |
257 run_at: 'document_end' | 259 run_at: 'document_end' |
258 }]); | 260 } |
| 261 ]); |
259 | 262 |
260 // webview is not allowed to open links in the new window. Hook these | 263 // webview is not allowed to open links in the new window. Hook these |
261 // events and open links in overlay dialog. | 264 // events and open links in overlay dialog. |
262 this.termsView_.addEventListener('newwindow', function(event) { | 265 this.termsView_.addEventListener('newwindow', function(event) { |
263 event.preventDefault(); | 266 event.preventDefault(); |
264 showURLOverlay(event.targetUrl); | 267 showURLOverlay(event.targetUrl); |
265 }); | 268 }); |
266 this.state_ = LoadState.UNLOADED; | 269 this.state_ = LoadState.UNLOADED; |
267 | 270 |
268 // On managed case, do not show TermsOfService section. Note that the | 271 // On managed case, do not show TermsOfService section. Note that the |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 */ | 409 */ |
407 function initialize(data, deviceId) { | 410 function initialize(data, deviceId) { |
408 currentDeviceId = deviceId; | 411 currentDeviceId = deviceId; |
409 var doc = appWindow.contentWindow.document; | 412 var doc = appWindow.contentWindow.document; |
410 var loadTimeData = appWindow.contentWindow.loadTimeData; | 413 var loadTimeData = appWindow.contentWindow.loadTimeData; |
411 loadTimeData.data = data; | 414 loadTimeData.data = data; |
412 appWindow.contentWindow.i18nTemplate.process(doc, loadTimeData); | 415 appWindow.contentWindow.i18nTemplate.process(doc, loadTimeData); |
413 | 416 |
414 // Initialize preference connected checkboxes in terms of service page. | 417 // Initialize preference connected checkboxes in terms of service page. |
415 termsPage = new TermsOfServicePage( | 418 termsPage = new TermsOfServicePage( |
416 doc.getElementById('terms'), | 419 doc.getElementById('terms'), data.arcManaged, data.countryCode, |
417 data.arcManaged, | |
418 data.countryCode, | |
419 new MetricsPreferenceCheckbox( | 420 new MetricsPreferenceCheckbox( |
420 doc.getElementById('metrics-preference'), | 421 doc.getElementById('metrics-preference'), data.learnMoreStatistics, |
421 data.learnMoreStatistics, | 422 '#learn-more-link-metrics', data.isOwnerProfile, |
422 '#learn-more-link-metrics', | 423 data.textMetricsDisabled, data.textMetricsEnabled, |
423 data.isOwnerProfile, | 424 data.textMetricsManagedDisabled, data.textMetricsManagedEnabled), |
424 data.textMetricsDisabled, | |
425 data.textMetricsEnabled, | |
426 data.textMetricsManagedDisabled, | |
427 data.textMetricsManagedEnabled), | |
428 new PreferenceCheckbox( | 425 new PreferenceCheckbox( |
429 doc.getElementById('backup-restore-preference'), | 426 doc.getElementById('backup-restore-preference'), |
430 data.learnMoreBackupAndRestore, | 427 data.learnMoreBackupAndRestore, '#learn-more-link-backup-restore', |
431 '#learn-more-link-backup-restore', | |
432 data.controlledByPolicy), | 428 data.controlledByPolicy), |
433 new PreferenceCheckbox( | 429 new PreferenceCheckbox( |
434 doc.getElementById('location-service-preference'), | 430 doc.getElementById('location-service-preference'), |
435 data.learnMoreLocationServices, | 431 data.learnMoreLocationServices, '#learn-more-link-location-service', |
436 '#learn-more-link-location-service', | |
437 data.controlledByPolicy)); | 432 data.controlledByPolicy)); |
438 } | 433 } |
439 | 434 |
440 /** | 435 /** |
441 * Handles native messages received from ArcSupportHost. | 436 * Handles native messages received from ArcSupportHost. |
442 * @param {!Object} message The message received. | 437 * @param {!Object} message The message received. |
443 */ | 438 */ |
444 function onNativeMessage(message) { | 439 function onNativeMessage(message) { |
445 if (!message.action) { | 440 if (!message.action) { |
446 return; | 441 return; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 // change from users' point of view. | 496 // change from users' point of view. |
502 if (pageDivId != 'lso-loading' || doc.getElementById('arc-loading').hidden) { | 497 if (pageDivId != 'lso-loading' || doc.getElementById('arc-loading').hidden) { |
503 var pages = doc.getElementsByClassName('section'); | 498 var pages = doc.getElementsByClassName('section'); |
504 for (var i = 0; i < pages.length; i++) { | 499 for (var i = 0; i < pages.length; i++) { |
505 pages[i].hidden = pages[i].id != pageDivId; | 500 pages[i].hidden = pages[i].id != pageDivId; |
506 } | 501 } |
507 } | 502 } |
508 | 503 |
509 if (pageDivId == 'lso-loading') { | 504 if (pageDivId == 'lso-loading') { |
510 lsoView.src = 'https://accounts.google.com/o/oauth2/v2/auth?client_id=' + | 505 lsoView.src = 'https://accounts.google.com/o/oauth2/v2/auth?client_id=' + |
511 '1070009224336-sdh77n7uot3oc99ais00jmuft6sk2fg9.apps.' + | 506 '1070009224336-sdh77n7uot3oc99ais00jmuft6sk2fg9.apps.' + |
512 'googleusercontent.com&response_type=code&redirect_uri=oob&' + | 507 'googleusercontent.com&response_type=code&redirect_uri=oob&' + |
513 'scope=https://www.google.com/accounts/OAuthLogin&' + | 508 'scope=https://www.google.com/accounts/OAuthLogin&' + |
514 'device_type=arc_plus_plus&device_id=' + currentDeviceId + | 509 'device_type=arc_plus_plus&device_id=' + currentDeviceId + |
515 '&hl=' + navigator.language; | 510 '&hl=' + navigator.language; |
516 } | 511 } |
517 appWindow.show(); | 512 appWindow.show(); |
518 if (pageDivId == 'terms') { | 513 if (pageDivId == 'terms') { |
519 termsPage.onShow(); | 514 termsPage.onShow(); |
520 } | 515 } |
521 } | 516 } |
522 | 517 |
523 /** | 518 /** |
524 * Shows an error page, with given errorMessage. | 519 * Shows an error page, with given errorMessage. |
525 * | 520 * |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 lastFocusedElement.focus(); | 606 lastFocusedElement.focus(); |
612 lastFocusedElement = null; | 607 lastFocusedElement = null; |
613 } | 608 } |
614 } | 609 } |
615 | 610 |
616 function setWindowBounds() { | 611 function setWindowBounds() { |
617 if (!appWindow) { | 612 if (!appWindow) { |
618 return; | 613 return; |
619 } | 614 } |
620 | 615 |
621 var decorationWidth = appWindow.outerBounds.width - | 616 var decorationWidth = |
622 appWindow.innerBounds.width; | 617 appWindow.outerBounds.width - appWindow.innerBounds.width; |
623 var decorationHeight = appWindow.outerBounds.height - | 618 var decorationHeight = |
624 appWindow.innerBounds.height; | 619 appWindow.outerBounds.height - appWindow.innerBounds.height; |
625 | 620 |
626 var outerWidth = INNER_WIDTH + decorationWidth; | 621 var outerWidth = INNER_WIDTH + decorationWidth; |
627 var outerHeight = INNER_HEIGHT + decorationHeight; | 622 var outerHeight = INNER_HEIGHT + decorationHeight; |
628 if (outerWidth > screen.availWidth) { | 623 if (outerWidth > screen.availWidth) { |
629 outerWidth = screen.availWidth; | 624 outerWidth = screen.availWidth; |
630 } | 625 } |
631 if (outerHeight > screen.availHeight) { | 626 if (outerHeight > screen.availHeight) { |
632 outerHeight = screen.availHeight; | 627 outerHeight = screen.availHeight; |
633 } | 628 } |
634 if (appWindow.outerBounds.width == outerWidth && | 629 if (appWindow.outerBounds.width == outerWidth && |
635 appWindow.outerBounds.height == outerHeight) { | 630 appWindow.outerBounds.height == outerHeight) { |
636 return; | 631 return; |
637 } | 632 } |
638 | 633 |
639 appWindow.outerBounds.width = outerWidth; | 634 appWindow.outerBounds.width = outerWidth; |
640 appWindow.outerBounds.height = outerHeight; | 635 appWindow.outerBounds.height = outerHeight; |
641 appWindow.outerBounds.left = Math.ceil((screen.availWidth - outerWidth) / 2); | 636 appWindow.outerBounds.left = Math.ceil((screen.availWidth - outerWidth) / 2); |
642 appWindow.outerBounds.top = | 637 appWindow.outerBounds.top = Math.ceil((screen.availHeight - outerHeight) / 2); |
643 Math.ceil((screen.availHeight - outerHeight) / 2); | |
644 } | 638 } |
645 | 639 |
646 chrome.app.runtime.onLaunched.addListener(function() { | 640 chrome.app.runtime.onLaunched.addListener(function() { |
647 var onAppContentLoad = function() { | 641 var onAppContentLoad = function() { |
648 var doc = appWindow.contentWindow.document; | 642 var doc = appWindow.contentWindow.document; |
649 lsoView = doc.getElementById('arc-support'); | 643 lsoView = doc.getElementById('arc-support'); |
650 lsoView.addContentScripts([ | 644 lsoView.addContentScripts([{ |
651 { name: 'postProcess', | 645 name: 'postProcess', |
652 matches: ['https://accounts.google.com/*'], | 646 matches: ['https://accounts.google.com/*'], |
653 css: { files: ['lso.css'] }, | 647 css: {files: ['lso.css']}, |
654 run_at: 'document_end' | 648 run_at: 'document_end' |
655 }]); | 649 }]); |
656 | 650 |
657 var isApprovalResponse = function(url) { | 651 var isApprovalResponse = function(url) { |
658 var resultUrlPrefix = 'https://accounts.google.com/o/oauth2/approval?'; | 652 var resultUrlPrefix = 'https://accounts.google.com/o/oauth2/approval?'; |
659 return url.substring(0, resultUrlPrefix.length) == resultUrlPrefix; | 653 return url.substring(0, resultUrlPrefix.length) == resultUrlPrefix; |
660 }; | 654 }; |
661 | 655 |
662 var lsoError = false; | 656 var lsoError = false; |
663 var onLsoViewRequestResponseStarted = function(details) { | 657 var onLsoViewRequestResponseStarted = function(details) { |
664 if (isApprovalResponse(details.url)) { | 658 if (isApprovalResponse(details.url)) { |
665 showPage('arc-loading'); | 659 showPage('arc-loading'); |
(...skipping 23 matching lines...) Expand all Loading... |
689 } | 683 } |
690 | 684 |
691 lsoView.executeScript({code: 'document.title;'}, function(results) { | 685 lsoView.executeScript({code: 'document.title;'}, function(results) { |
692 var authCodePrefix = 'Success code='; | 686 var authCodePrefix = 'Success code='; |
693 if (results && results.length == 1 && typeof results[0] == 'string' && | 687 if (results && results.length == 1 && typeof results[0] == 'string' && |
694 results[0].substring(0, authCodePrefix.length) == authCodePrefix) { | 688 results[0].substring(0, authCodePrefix.length) == authCodePrefix) { |
695 var authCode = results[0].substring(authCodePrefix.length); | 689 var authCode = results[0].substring(authCodePrefix.length); |
696 sendNativeMessage('onAuthSucceeded', {code: authCode}); | 690 sendNativeMessage('onAuthSucceeded', {code: authCode}); |
697 } else { | 691 } else { |
698 sendNativeMessage('onAuthFailed'); | 692 sendNativeMessage('onAuthFailed'); |
699 showErrorPage( | 693 showErrorPage(appWindow.contentWindow.loadTimeData.getString( |
700 appWindow.contentWindow.loadTimeData.getString( | 694 'authorizationFailed')); |
701 'authorizationFailed')); | |
702 } | 695 } |
703 }); | 696 }); |
704 }; | 697 }; |
705 | 698 |
706 var requestFilter = { | 699 var requestFilter = {urls: ['<all_urls>'], types: ['main_frame']}; |
707 urls: ['<all_urls>'], | |
708 types: ['main_frame'] | |
709 }; | |
710 | 700 |
711 lsoView.request.onResponseStarted.addListener( | 701 lsoView.request.onResponseStarted.addListener( |
712 onLsoViewRequestResponseStarted, requestFilter); | 702 onLsoViewRequestResponseStarted, requestFilter); |
713 lsoView.request.onErrorOccurred.addListener( | 703 lsoView.request.onErrorOccurred.addListener( |
714 onLsoViewErrorOccurred, requestFilter); | 704 onLsoViewErrorOccurred, requestFilter); |
715 lsoView.addEventListener('contentload', onLsoViewContentLoad); | 705 lsoView.addEventListener('contentload', onLsoViewContentLoad); |
716 | 706 |
717 var onRetry = function() { | 707 var onRetry = function() { |
718 sendNativeMessage('onRetryClicked'); | 708 sendNativeMessage('onRetryClicked'); |
719 }; | 709 }; |
720 | 710 |
721 var onSendFeedback = function() { | 711 var onSendFeedback = function() { |
722 sendNativeMessage('onSendFeedbackClicked'); | 712 sendNativeMessage('onSendFeedbackClicked'); |
723 }; | 713 }; |
724 | 714 |
725 doc.getElementById('button-retry').addEventListener('click', onRetry); | 715 doc.getElementById('button-retry').addEventListener('click', onRetry); |
726 doc.getElementById('button-send-feedback') | 716 doc.getElementById('button-send-feedback') |
727 .addEventListener('click', onSendFeedback); | 717 .addEventListener('click', onSendFeedback); |
728 doc.getElementById('overlay-close').addEventListener('click', hideOverlay); | 718 doc.getElementById('overlay-close').addEventListener('click', hideOverlay); |
729 doc.getElementById('privacy-policy-link').addEventListener( | 719 doc.getElementById('privacy-policy-link') |
730 'click', showPrivacyPolicyOverlay); | 720 .addEventListener('click', showPrivacyPolicyOverlay); |
731 | 721 |
732 var overlay = doc.getElementById('overlay-container'); | 722 var overlay = doc.getElementById('overlay-container'); |
733 appWindow.contentWindow.cr.ui.overlay.setupOverlay(overlay); | 723 appWindow.contentWindow.cr.ui.overlay.setupOverlay(overlay); |
734 appWindow.contentWindow.cr.ui.overlay.globalInitialization(); | 724 appWindow.contentWindow.cr.ui.overlay.globalInitialization(); |
735 overlay.addEventListener('cancelOverlay', hideOverlay); | 725 overlay.addEventListener('cancelOverlay', hideOverlay); |
736 | 726 |
737 connectPort(); | 727 connectPort(); |
738 }; | 728 }; |
739 | 729 |
740 var onWindowCreated = function(createdWindow) { | 730 var onWindowCreated = function(createdWindow) { |
(...skipping 14 matching lines...) Expand all Loading... |
755 // otherwise the background page would be kept alive so that the extension | 745 // otherwise the background page would be kept alive so that the extension |
756 // would not be unloaded. | 746 // would not be unloaded. |
757 port.disconnect(); | 747 port.disconnect(); |
758 port = null; | 748 port = null; |
759 }; | 749 }; |
760 | 750 |
761 var options = { | 751 var options = { |
762 'id': 'play_store_wnd', | 752 'id': 'play_store_wnd', |
763 'resizable': false, | 753 'resizable': false, |
764 'hidden': true, | 754 'hidden': true, |
765 'frame': { | 755 'frame': {type: 'chrome', color: '#ffffff'}, |
766 type: 'chrome', | 756 'innerBounds': {'width': INNER_WIDTH, 'height': INNER_HEIGHT} |
767 color: '#ffffff' | |
768 }, | |
769 'innerBounds': { | |
770 'width': INNER_WIDTH, | |
771 'height': INNER_HEIGHT | |
772 } | |
773 }; | 757 }; |
774 chrome.app.window.create('main.html', options, onWindowCreated); | 758 chrome.app.window.create('main.html', options, onWindowCreated); |
775 }); | 759 }); |
OLD | NEW |