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('inline', function() { | 5 cr.define('inline', 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 25 matching lines...) Expand all Loading... |
36 // variant includes instructions on how to pin Chrome to the taskbar. | 36 // variant includes instructions on how to pin Chrome to the taskbar. |
37 app.isCombined = false; | 37 app.isCombined = false; |
38 | 38 |
39 // Set handlers. | 39 // Set handlers. |
40 app.computeClasses = computeClasses; | 40 app.computeClasses = computeClasses; |
41 app.onContinue = onContinue; | 41 app.onContinue = onContinue; |
42 app.onOpenSettings = onOpenSettings; | 42 app.onOpenSettings = onOpenSettings; |
43 app.onToggle = onToggle.bind(this, app); | 43 app.onToggle = onToggle.bind(this, app); |
44 | 44 |
45 // Asynchronously check if Chrome is pinned to the taskbar. | 45 // Asynchronously check if Chrome is pinned to the taskbar. |
46 cr.sendWithPromise('getPinnedToTaskbarState').then( | 46 cr.sendWithPromise('getPinnedToTaskbarState') |
47 function(isPinnedToTaskbar) { | 47 .then(function(isPinnedToTaskbar) { |
48 // Allow overriding of the result via a query parameter. | 48 // Allow overriding of the result via a query parameter. |
49 // TODO(pmonette): Remove these checks when they are no longer needed. | 49 // TODO(pmonette): Remove these checks when they are no longer needed. |
50 /** @const */ var VARIANT_KEY = 'variant'; | 50 /** @const */ var VARIANT_KEY = 'variant'; |
51 var VariantType = { | 51 var VariantType = {DEFAULT_ONLY: 'defaultonly', COMBINED: 'combined'}; |
52 DEFAULT_ONLY: 'defaultonly', | 52 var params = new URLSearchParams(location.search.slice(1)); |
53 COMBINED: 'combined' | 53 if (params.has(VARIANT_KEY)) { |
54 }; | 54 if (params.get(VARIANT_KEY) === VariantType.DEFAULT_ONLY) |
55 var params = new URLSearchParams(location.search.slice(1)); | 55 app.isCombined = false; |
56 if (params.has(VARIANT_KEY)) { | 56 else if (params.get(VARIANT_KEY) === VariantType.COMBINED) |
57 if (params.get(VARIANT_KEY) === VariantType.DEFAULT_ONLY) | 57 app.isCombined = true; |
58 app.isCombined = false; | 58 } else { |
59 else if (params.get(VARIANT_KEY) === VariantType.COMBINED) | 59 app.isCombined = !isPinnedToTaskbar; |
60 app.isCombined = true; | 60 } |
61 } else { | 61 }); |
62 app.isCombined = !isPinnedToTaskbar; | |
63 } | |
64 }); | |
65 } | 62 } |
66 | 63 |
67 return { | 64 return {initialize: initialize}; |
68 initialize: initialize | |
69 }; | |
70 }); | 65 }); |
71 | 66 |
72 document.addEventListener('DOMContentLoaded', inline.initialize); | 67 document.addEventListener('DOMContentLoaded', inline.initialize); |
OLD | NEW |