Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: chrome/browser/resources/welcome/win10/inline.js

Issue 2449853008: Determine the Win10-specific Welcome page variant to display (Closed)
Patch Set: Nits + last minute request Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/welcome/win10/sectioned.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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) {
9 if (isCombined)
10 return 'section expandable expanded';
11 return 'section';
12 }
13
8 function onContinue() { 14 function onContinue() {
9 chrome.send('handleContinue'); 15 chrome.send('handleContinue');
10 } 16 }
11 17
12 function onOpenSettings() { 18 function onOpenSettings() {
13 chrome.send('handleSetDefaultBrowser'); 19 chrome.send('handleSetDefaultBrowser');
14 } 20 }
15 21
16 function onToggle(app) { 22 function onToggle(app) {
17 if (app.isCombined) { 23 if (app.isCombined) {
18 var sections = document.querySelectorAll('.section.expandable'); 24 var sections = document.querySelectorAll('.section.expandable');
19 sections.forEach(function(section) { 25 sections.forEach(function(section) {
20 section.classList.toggle('expanded'); 26 section.classList.toggle('expanded');
21 }); 27 });
22 } 28 }
23 } 29 }
24 30
25 function computeClasses(isCombined) {
26 if (isCombined)
27 return 'section expandable expanded';
28 return 'section';
29 }
30
31 function initialize() { 31 function initialize() {
32 var app = $('inline-app'); 32 var app = $('inline-app');
33 33
34 app.isCombined = window.location.href.includes('variant=combined'); 34 // Set variables.
35 // Determines if the combined variant should be displayed. The combined
36 // variant includes instructions on how to pin Chrome to the taskbar.
37 app.isCombined = false;
35 38
36 // Set handlers. 39 // Set handlers.
37 app.computeClasses = computeClasses; 40 app.computeClasses = computeClasses;
38 app.onContinue = onContinue; 41 app.onContinue = onContinue;
39 app.onOpenSettings = onOpenSettings; 42 app.onOpenSettings = onOpenSettings;
40 app.onToggle = onToggle.bind(this, app); 43 app.onToggle = onToggle.bind(this, app);
44
45 // Asynchronously check if Chrome is pinned to the taskbar.
46 cr.sendWithPromise('getPinnedToTaskbarState').then(
47 function(isPinnedToTaskbar) {
48 // Allow overriding of the result via a query parameter.
49 if (window.location.href.includes('variant=defaultonly'))
michaelpg 2016/11/04 21:27:03 Please use URLSearchParams: https://developer.mozi
Patrick Monette 2016/11/04 22:56:12 Done.
50 app.isCombined = false;
51 else if (window.location.href.includes('variant=combined'))
52 app.isCombined = true;
53 else
54 app.isCombined = !isPinnedToTaskbar;
55 });
41 } 56 }
42 57
43 return { 58 return {
44 initialize: initialize 59 initialize: initialize
45 }; 60 };
46 }); 61 });
47 62
48 document.addEventListener('DOMContentLoaded', inline.initialize); 63 document.addEventListener('DOMContentLoaded', inline.initialize);
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/welcome/win10/sectioned.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698