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

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

Issue 2733433002: [Win10 FRE] Make inlined-image more Polymer-friendly to fix <action-link> CSS inclusion. (Closed)
Patch Set: Remove .content; reorder Polymer 'properties' field. Created 3 years, 9 months 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 | « chrome/browser/resources/welcome/win10/inline.html ('k') | no next file » | 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 Polymer({
6 'use strict'; 6 is: 'welcome-win10-inline',
7 7
8 function computeClasses(isCombined) { 8 properties: {
9 // Determines if the combined variant should be displayed. The combined
10 // variant includes instructions on how to pin Chrome to the taskbar.
11 isCombined: Boolean
12 },
13
14 receivePinnedState: function(isPinnedToTaskbar) {
15 this.isCombined = !isPinnedToTaskbar;
16 // Allow overriding of the result via a query parameter.
17 // TODO(pmonette): Remove these checks when they are no longer needed.
18 /** @const */
19 var VARIANT_KEY = 'variant';
20 var VariantType = {
21 DEFAULT_ONLY: 'defaultonly',
22 COMBINED: 'combined'
23 };
24 var params = new URLSearchParams(location.search.slice(1));
25 if (params.has(VARIANT_KEY)) {
26 if (params.get(VARIANT_KEY) === VariantType.DEFAULT_ONLY)
27 this.isCombined = false;
28 else if (params.get(VARIANT_KEY) === VariantType.COMBINED)
29 this.isCombined = true;
30 }
31 },
32
33 ready: function() {
34 this.isCombined = false;
35 // Asynchronously check if Chrome is pinned to the taskbar.
36 cr.sendWithPromise('getPinnedToTaskbarState').then(
37 this.receivePinnedState.bind(this));
38 },
39
40 computeClasses: function(isCombined) {
9 if (isCombined) 41 if (isCombined)
10 return 'section expandable expanded'; 42 return 'section expandable expanded';
11 return 'section'; 43 return 'section';
12 } 44 },
13 45
14 function onContinue() { 46 onContinue: function() {
15 chrome.send('handleContinue'); 47 chrome.send('handleContinue');
16 } 48 },
17 49
18 function onOpenSettings() { 50 onOpenSettings: function() {
19 chrome.send('handleSetDefaultBrowser'); 51 chrome.send('handleSetDefaultBrowser');
20 } 52 },
21 53
22 function onToggle(app) { 54 onToggle: function() {
23 if (app.isCombined) { 55 if (this.isCombined) {
24 var sections = document.querySelectorAll('.section.expandable'); 56 var sections = this.shadowRoot.querySelectorAll('.section.expandable');
25 sections.forEach(function(section) { 57 sections.forEach(function(section) {
26 section.classList.toggle('expanded'); 58 section.classList.toggle('expanded');
27 }); 59 });
28 } 60 }
29 } 61 }
30
31 function initialize() {
32 var app = $('inline-app');
33
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;
38
39 // Set handlers.
40 app.computeClasses = computeClasses;
41 app.onContinue = onContinue;
42 app.onOpenSettings = onOpenSettings;
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 // TODO(pmonette): Remove these checks when they are no longer needed.
50 /** @const */ var VARIANT_KEY = 'variant';
51 var VariantType = {
52 DEFAULT_ONLY: 'defaultonly',
53 COMBINED: 'combined'
54 };
55 var params = new URLSearchParams(location.search.slice(1));
56 if (params.has(VARIANT_KEY)) {
57 if (params.get(VARIANT_KEY) === VariantType.DEFAULT_ONLY)
58 app.isCombined = false;
59 else if (params.get(VARIANT_KEY) === VariantType.COMBINED)
60 app.isCombined = true;
61 } else {
62 app.isCombined = !isPinnedToTaskbar;
63 }
64 });
65 }
66
67 return {
68 initialize: initialize
69 };
70 }); 62 });
71
72 document.addEventListener('DOMContentLoaded', inline.initialize);
OLDNEW
« no previous file with comments | « chrome/browser/resources/welcome/win10/inline.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698