| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 * @param {string} url Target URL to open in overlay dialog. | 437 * @param {string} url Target URL to open in overlay dialog. |
| 438 */ | 438 */ |
| 439 function showURLOverlay(url) { | 439 function showURLOverlay(url) { |
| 440 var doc = appWindow.contentWindow.document; | 440 var doc = appWindow.contentWindow.document; |
| 441 var overlayWebview = doc.getElementById('overlay-url'); | 441 var overlayWebview = doc.getElementById('overlay-url'); |
| 442 overlayWebview.src = url; | 442 overlayWebview.src = url; |
| 443 showOverlay('overlay-url'); | 443 showOverlay('overlay-url'); |
| 444 } | 444 } |
| 445 | 445 |
| 446 /** | 446 /** |
| 447 * Shows Google Privacy Policy in overlay dialog. Policy link is detected from |
| 448 * the content of terms view. |
| 449 */ |
| 450 function showPrivacyPolicyOverlay() { |
| 451 termsView.executeScript({code: 'getPrivacyPolicyLink();'}, function(results) { |
| 452 if (results && results.length == 1 && typeof results[0] == 'string') { |
| 453 showURLOverlay(results[0]); |
| 454 } else { |
| 455 showURLOverlay('https://www.google.com/policies/privacy/'); |
| 456 } |
| 457 }); |
| 458 } |
| 459 |
| 460 /** |
| 447 * Hides overlay dialog. | 461 * Hides overlay dialog. |
| 448 */ | 462 */ |
| 449 function hideOverlay() { | 463 function hideOverlay() { |
| 450 var doc = appWindow.contentWindow.document; | 464 var doc = appWindow.contentWindow.document; |
| 451 var overlayContainer = doc.getElementById('overlay-container'); | 465 var overlayContainer = doc.getElementById('overlay-container'); |
| 452 overlayContainer.hidden = true; | 466 overlayContainer.hidden = true; |
| 453 } | 467 } |
| 454 | 468 |
| 455 /** | 469 /** |
| 456 * Shows requested page. | 470 * Shows requested page. |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 var onSendFeedback = function() { | 672 var onSendFeedback = function() { |
| 659 sendNativeMessage('onSendFeedbackClicked'); | 673 sendNativeMessage('onSendFeedbackClicked'); |
| 660 }; | 674 }; |
| 661 | 675 |
| 662 doc.getElementById('button-agree').addEventListener('click', onAgree); | 676 doc.getElementById('button-agree').addEventListener('click', onAgree); |
| 663 doc.getElementById('button-cancel').addEventListener('click', onCancel); | 677 doc.getElementById('button-cancel').addEventListener('click', onCancel); |
| 664 doc.getElementById('button-retry').addEventListener('click', onRetry); | 678 doc.getElementById('button-retry').addEventListener('click', onRetry); |
| 665 doc.getElementById('button-send-feedback') | 679 doc.getElementById('button-send-feedback') |
| 666 .addEventListener('click', onSendFeedback); | 680 .addEventListener('click', onSendFeedback); |
| 667 doc.getElementById('overlay-close').addEventListener('click', hideOverlay); | 681 doc.getElementById('overlay-close').addEventListener('click', hideOverlay); |
| 682 doc.getElementById('privacy-policy-link').addEventListener( |
| 683 'click', showPrivacyPolicyOverlay); |
| 668 | 684 |
| 669 var overlay = doc.getElementById('overlay-container'); | 685 var overlay = doc.getElementById('overlay-container'); |
| 670 appWindow.contentWindow.cr.ui.overlay.setupOverlay(overlay); | 686 appWindow.contentWindow.cr.ui.overlay.setupOverlay(overlay); |
| 671 appWindow.contentWindow.cr.ui.overlay.globalInitialization(); | 687 appWindow.contentWindow.cr.ui.overlay.globalInitialization(); |
| 672 overlay.addEventListener('cancelOverlay', hideOverlay); | 688 overlay.addEventListener('cancelOverlay', hideOverlay); |
| 673 | 689 |
| 674 connectPort(); | 690 connectPort(); |
| 675 }; | 691 }; |
| 676 | 692 |
| 677 var onWindowCreated = function(createdWindow) { | 693 var onWindowCreated = function(createdWindow) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 703 type: 'chrome', | 719 type: 'chrome', |
| 704 color: '#ffffff' | 720 color: '#ffffff' |
| 705 }, | 721 }, |
| 706 'innerBounds': { | 722 'innerBounds': { |
| 707 'width': INNER_WIDTH, | 723 'width': INNER_WIDTH, |
| 708 'height': INNER_HEIGHT | 724 'height': INNER_HEIGHT |
| 709 } | 725 } |
| 710 }; | 726 }; |
| 711 chrome.app.window.create('main.html', options, onWindowCreated); | 727 chrome.app.window.create('main.html', options, onWindowCreated); |
| 712 }); | 728 }); |
| OLD | NEW |