Chromium Code Reviews| 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 * UI Pages. Note the order must be in sync with the ArcAuthService::UIPage | 6 * UI Pages. Note the order must be in sync with the ArcAuthService::UIPage |
| 7 * enum. | 7 * enum. |
| 8 * @type {Array<string>} | 8 * @type {Array<string>} |
| 9 */ | 9 */ |
| 10 var UI_PAGES = ['none', | 10 var UI_PAGES = ['none', |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 if (!appWindow) { | 477 if (!appWindow) { |
| 478 return; | 478 return; |
| 479 } | 479 } |
| 480 | 480 |
| 481 if (UI_PAGES[pageId] == 'terms-loading') { | 481 if (UI_PAGES[pageId] == 'terms-loading') { |
| 482 termsAccepted = arcManaged; | 482 termsAccepted = arcManaged; |
| 483 if (termsAccepted) { | 483 if (termsAccepted) { |
| 484 showPage('terms'); | 484 showPage('terms'); |
| 485 return; | 485 return; |
| 486 } | 486 } |
| 487 loadInitialTerms(); | 487 loadTerms(); |
| 488 } else { | 488 } else { |
| 489 // Explicit request to start not from start page. Assume terms are | 489 // Explicit request to start not from start page. Assume terms are |
| 490 // accepted in this case. | 490 // accepted in this case. |
| 491 termsAccepted = true; | 491 termsAccepted = true; |
| 492 } | 492 } |
| 493 | 493 |
| 494 if (UI_PAGES[pageId] == 'error' || | 494 if (UI_PAGES[pageId] == 'error' || |
| 495 UI_PAGES[pageId] == 'error-with-feedback') { | 495 UI_PAGES[pageId] == 'error-with-feedback') { |
| 496 setErrorMessage(status); | 496 setErrorMessage(status); |
| 497 } | 497 } |
| 498 showPage(UI_PAGES[pageId]); | 498 showPage(UI_PAGES[pageId]); |
| 499 } | 499 } |
| 500 | 500 |
| 501 /** | 501 /** |
| 502 * Loads initial Play Store terms. | 502 * Loads Play Store terms. |
| 503 */ | 503 */ |
| 504 function loadInitialTerms() { | 504 function loadTerms() { |
| 505 termsView.src = 'https://play.google.com/about/play-terms.html'; | 505 if (termsView.src) { |
|
khmel
2016/10/26 20:35:20
This might be dangerous. Assume ToS decides to red
hidehiko
2016/10/27 04:01:48
I don't think the old code handles the case, becau
khmel
2016/10/27 14:40:57
Sorry, don't get what do you mean? Old code has si
hidehiko
2016/10/27 16:41:01
Sorry, I still am confused.
"ToS decides to redir
| |
| 506 // This is reloading the page, typically clicked RETRY on error page. | |
| 507 termsView.reload(); | |
| 508 } else { | |
| 509 // This is first loading case so set the URL explicitly. | |
| 510 termsView.src = 'https://play.google.com/about/play-terms.html'; | |
| 511 } | |
| 506 } | 512 } |
| 507 | 513 |
| 508 function setWindowBounds() { | 514 function setWindowBounds() { |
| 509 if (!appWindow) { | 515 if (!appWindow) { |
| 510 return; | 516 return; |
| 511 } | 517 } |
| 512 | 518 |
| 513 var decorationWidth = appWindow.outerBounds.width - | 519 var decorationWidth = appWindow.outerBounds.width - |
| 514 appWindow.innerBounds.width; | 520 appWindow.innerBounds.width; |
| 515 var decorationHeight = appWindow.outerBounds.height - | 521 var decorationHeight = appWindow.outerBounds.height - |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 appWindow.close(); | 664 appWindow.close(); |
| 659 } | 665 } |
| 660 }; | 666 }; |
| 661 | 667 |
| 662 var onRetry = function() { | 668 var onRetry = function() { |
| 663 if (termsAccepted) { | 669 if (termsAccepted) { |
| 664 // Reuse the onAgree() in case that the user has already accepted | 670 // Reuse the onAgree() in case that the user has already accepted |
| 665 // the ToS. | 671 // the ToS. |
| 666 onAgree(); | 672 onAgree(); |
| 667 } else { | 673 } else { |
| 668 loadInitialTerms(); | 674 loadTerms(); |
|
hidehiko
2016/10/26 13:33:54
Note: Typically, this is the reload case. However,
| |
| 669 } | 675 } |
| 670 }; | 676 }; |
| 671 | 677 |
| 672 var onSendFeedback = function() { | 678 var onSendFeedback = function() { |
| 673 sendNativeMessage('onSendFeedbackClicked'); | 679 sendNativeMessage('onSendFeedbackClicked'); |
| 674 }; | 680 }; |
| 675 | 681 |
| 676 doc.getElementById('button-agree').addEventListener('click', onAgree); | 682 doc.getElementById('button-agree').addEventListener('click', onAgree); |
| 677 doc.getElementById('button-cancel').addEventListener('click', onCancel); | 683 doc.getElementById('button-cancel').addEventListener('click', onCancel); |
| 678 doc.getElementById('button-retry').addEventListener('click', onRetry); | 684 doc.getElementById('button-retry').addEventListener('click', onRetry); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 719 type: 'chrome', | 725 type: 'chrome', |
| 720 color: '#ffffff' | 726 color: '#ffffff' |
| 721 }, | 727 }, |
| 722 'innerBounds': { | 728 'innerBounds': { |
| 723 'width': INNER_WIDTH, | 729 'width': INNER_WIDTH, |
| 724 'height': INNER_HEIGHT | 730 'height': INNER_HEIGHT |
| 725 } | 731 } |
| 726 }; | 732 }; |
| 727 chrome.app.window.create('main.html', options, onWindowCreated); | 733 chrome.app.window.create('main.html', options, onWindowCreated); |
| 728 }); | 734 }); |
| OLD | NEW |