| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 * @param {string} url Target URL to open in overlay dialog. | 399 * @param {string} url Target URL to open in overlay dialog. |
| 400 */ | 400 */ |
| 401 function showURLOverlay(url) { | 401 function showURLOverlay(url) { |
| 402 var doc = appWindow.contentWindow.document; | 402 var doc = appWindow.contentWindow.document; |
| 403 var overlayWebview = doc.getElementById('overlay-url'); | 403 var overlayWebview = doc.getElementById('overlay-url'); |
| 404 overlayWebview.src = url; | 404 overlayWebview.src = url; |
| 405 showOverlay('overlay-url'); | 405 showOverlay('overlay-url'); |
| 406 } | 406 } |
| 407 | 407 |
| 408 /** | 408 /** |
| 409 * Shows Google Privacy Policy in overlay dialog. Policy link is detected from |
| 410 * the content of terms view. |
| 411 */ |
| 412 function showPrivacyPolicyOverlay() { |
| 413 termsView.executeScript({code: 'getPrivacyPolicyLink();'}, function(results) { |
| 414 if (results && results.length == 1 && typeof results[0] == 'string') { |
| 415 showURLOverlay(results[0]); |
| 416 } else { |
| 417 showURLOverlay('https://www.google.com/policies/privacy/'); |
| 418 } |
| 419 }); |
| 420 } |
| 421 |
| 422 /** |
| 409 * Hides overlay dialog. | 423 * Hides overlay dialog. |
| 410 */ | 424 */ |
| 411 function hideOverlay() { | 425 function hideOverlay() { |
| 412 var doc = appWindow.contentWindow.document; | 426 var doc = appWindow.contentWindow.document; |
| 413 var overlayContainer = doc.getElementById('overlay-container'); | 427 var overlayContainer = doc.getElementById('overlay-container'); |
| 414 overlayContainer.hidden = true; | 428 overlayContainer.hidden = true; |
| 415 } | 429 } |
| 416 | 430 |
| 417 | 431 |
| 418 /** | 432 /** |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 | 637 |
| 624 var onSendFeedback = function() { | 638 var onSendFeedback = function() { |
| 625 sendNativeMessage('onSendFeedbackClicked'); | 639 sendNativeMessage('onSendFeedbackClicked'); |
| 626 }; | 640 }; |
| 627 | 641 |
| 628 doc.getElementById('button-agree').addEventListener('click', onAgree); | 642 doc.getElementById('button-agree').addEventListener('click', onAgree); |
| 629 doc.getElementById('button-cancel').addEventListener('click', onCancel); | 643 doc.getElementById('button-cancel').addEventListener('click', onCancel); |
| 630 doc.getElementById('button-retry').addEventListener('click', onRetry); | 644 doc.getElementById('button-retry').addEventListener('click', onRetry); |
| 631 doc.getElementById('button-send-feedback') | 645 doc.getElementById('button-send-feedback') |
| 632 .addEventListener('click', onSendFeedback); | 646 .addEventListener('click', onSendFeedback); |
| 633 doc.getElementById('overlay-close').addEventListener('click', | 647 doc.getElementById('overlay-close').addEventListener('click', hideOverlay); |
| 634 hideOverlay); | 648 doc.getElementById('privacy-policy-link').addEventListener( |
| 649 'click', showPrivacyPolicyOverlay); |
| 635 | 650 |
| 636 var overlay = doc.getElementById('overlay-container'); | 651 var overlay = doc.getElementById('overlay-container'); |
| 637 appWindow.contentWindow.cr.ui.overlay.setupOverlay(overlay); | 652 appWindow.contentWindow.cr.ui.overlay.setupOverlay(overlay); |
| 638 appWindow.contentWindow.cr.ui.overlay.globalInitialization(); | 653 appWindow.contentWindow.cr.ui.overlay.globalInitialization(); |
| 639 overlay.addEventListener('cancelOverlay', hideOverlay); | 654 overlay.addEventListener('cancelOverlay', hideOverlay); |
| 640 | 655 |
| 641 connectPort(); | 656 connectPort(); |
| 642 }; | 657 }; |
| 643 | 658 |
| 644 var onWindowCreated = function(createdWindow) { | 659 var onWindowCreated = function(createdWindow) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 670 type: 'chrome', | 685 type: 'chrome', |
| 671 color: '#ffffff' | 686 color: '#ffffff' |
| 672 }, | 687 }, |
| 673 'innerBounds': { | 688 'innerBounds': { |
| 674 'width': INNER_WIDTH, | 689 'width': INNER_WIDTH, |
| 675 'height': INNER_HEIGHT | 690 'height': INNER_HEIGHT |
| 676 } | 691 } |
| 677 }; | 692 }; |
| 678 chrome.app.window.create('main.html', options, onWindowCreated); | 693 chrome.app.window.create('main.html', options, onWindowCreated); |
| 679 }); | 694 }); |
| OLD | NEW |