Chromium Code Reviews| Index: chrome/browser/resources/welcome/win10/sectioned.js |
| diff --git a/chrome/browser/resources/welcome/win10/sectioned.js b/chrome/browser/resources/welcome/win10/sectioned.js |
| index 32407dab1e23e4d78218f4ec2a79c3a3cd6b48e0..8ec59d265d4c9107d7fc47342071a7a7e831f919 100644 |
| --- a/chrome/browser/resources/welcome/win10/sectioned.js |
| +++ b/chrome/browser/resources/welcome/win10/sectioned.js |
| @@ -5,6 +5,12 @@ |
| cr.define('sectioned', function() { |
| 'use strict'; |
| + function computeClasses(isCombined) { |
| + if (isCombined) |
| + return 'section expandable expanded'; |
| + return 'section'; |
| + } |
| + |
| function onContinue() { |
| chrome.send('handleContinue'); |
| } |
| @@ -28,22 +34,36 @@ cr.define('sectioned', function() { |
| } |
| } |
| - function computeClasses(isCombined) { |
| - if (isCombined) |
| - return 'section expandable expanded'; |
| - return 'section'; |
| - } |
| - |
| function initialize() { |
| var app = $('sectioned-app'); |
| - app.isCombined = window.location.href.includes('variant=combined'); |
| + // Set variables. |
| + // Determines if the combined variant should be displayed. The combined |
| + // variant includes instructions on how to pin Chrome to the taskbar. |
| + app.isCombined = false; |
| // Set handlers. |
| app.computeClasses = computeClasses; |
| app.onContinue = onContinue; |
| app.onOpenSettings = onOpenSettings; |
| app.onToggle = onToggle.bind(this, app); |
| + |
| + |
| + // Asynchronously check if Chrome is pinned to the taskbar. |
| + cr.sendWithPromise('getPinnedToTaskbarState').then( |
| + function(isPinnedToTaskbar) { |
| + // Allow overriding of the result via a query parameter. |
| + // TODO(pmonette): Remove these checks when they are no longer needed. |
| + var params = new URLSearchParams(location.search.slice(1)); |
| + if (params.has('variant')) { |
| + if (params.get('variant') === 'defaultonly') |
| + app.isCombined = false; |
| + if (params.get('variant') === 'combined') |
|
michaelpg
2016/11/04 23:59:24
(same)
|
| + app.isCombined = true; |
| + } else { |
| + app.isCombined = !isPinnedToTaskbar; |
| + } |
| + }); |
| } |
| return { |