| 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 cr.define('sectioned', function() { | 5 cr.define('sectioned', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 function computeClasses(isCombined) { | 8 function computeClasses(isCombined) { |
| 9 if (isCombined) | 9 if (isCombined) |
| 10 return 'section expandable expanded'; | 10 return 'section expandable expanded'; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 app.isCombined = false; | 43 app.isCombined = false; |
| 44 | 44 |
| 45 // Set handlers. | 45 // Set handlers. |
| 46 app.computeClasses = computeClasses; | 46 app.computeClasses = computeClasses; |
| 47 app.onContinue = onContinue; | 47 app.onContinue = onContinue; |
| 48 app.onOpenSettings = onOpenSettings; | 48 app.onOpenSettings = onOpenSettings; |
| 49 app.onToggle = onToggle.bind(this, app); | 49 app.onToggle = onToggle.bind(this, app); |
| 50 | 50 |
| 51 | 51 |
| 52 // Asynchronously check if Chrome is pinned to the taskbar. | 52 // Asynchronously check if Chrome is pinned to the taskbar. |
| 53 cr.sendWithPromise('getPinnedToTaskbarState').then( | 53 cr.sendWithPromise('getPinnedToTaskbarState') |
| 54 function(isPinnedToTaskbar) { | 54 .then(function(isPinnedToTaskbar) { |
| 55 // Allow overriding of the result via a query parameter. | 55 // Allow overriding of the result via a query parameter. |
| 56 // TODO(pmonette): Remove these checks when they are no longer needed. | 56 // TODO(pmonette): Remove these checks when they are no longer needed. |
| 57 /** @const */ var VARIANT_KEY = 'variant'; | 57 /** @const */ var VARIANT_KEY = 'variant'; |
| 58 var VariantType = { | 58 var VariantType = {DEFAULT_ONLY: 'defaultonly', COMBINED: 'combined'}; |
| 59 DEFAULT_ONLY: 'defaultonly', | 59 var params = new URLSearchParams(location.search.slice(1)); |
| 60 COMBINED: 'combined' | 60 if (params.has(VARIANT_KEY)) { |
| 61 }; | 61 if (params.get(VARIANT_KEY) === VariantType.DEFAULT_ONLY) |
| 62 var params = new URLSearchParams(location.search.slice(1)); | 62 app.isCombined = false; |
| 63 if (params.has(VARIANT_KEY)) { | 63 else if (params.get(VARIANT_KEY) === VariantType.COMBINED) |
| 64 if (params.get(VARIANT_KEY) === VariantType.DEFAULT_ONLY) | 64 app.isCombined = true; |
| 65 app.isCombined = false; | 65 } else { |
| 66 else if (params.get(VARIANT_KEY) === VariantType.COMBINED) | 66 app.isCombined = !isPinnedToTaskbar; |
| 67 app.isCombined = true; | 67 } |
| 68 } else { | 68 }); |
| 69 app.isCombined = !isPinnedToTaskbar; | |
| 70 } | |
| 71 }); | |
| 72 } | 69 } |
| 73 | 70 |
| 74 return { | 71 return {initialize: initialize}; |
| 75 initialize: initialize | |
| 76 }; | |
| 77 }); | 72 }); |
| 78 | 73 |
| 79 document.addEventListener('DOMContentLoaded', sectioned.initialize); | 74 document.addEventListener('DOMContentLoaded', sectioned.initialize); |
| OLD | NEW |