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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/welcome/win10/inline.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/welcome/win10/inline.js
diff --git a/chrome/browser/resources/welcome/win10/inline.js b/chrome/browser/resources/welcome/win10/inline.js
index 35c09807a19079d1d6d3afd31e3945f553092962..cf80602b7da093fc7b087816b08b84aa8ffacfaf 100644
--- a/chrome/browser/resources/welcome/win10/inline.js
+++ b/chrome/browser/resources/welcome/win10/inline.js
@@ -2,71 +2,61 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-cr.define('inline', function() {
- 'use strict';
+Polymer({
+ is: 'welcome-win10-inline',
- function computeClasses(isCombined) {
+ properties: {
+ // Determines if the combined variant should be displayed. The combined
+ // variant includes instructions on how to pin Chrome to the taskbar.
+ isCombined: Boolean
+ },
+
+ receivePinnedState: function(isPinnedToTaskbar) {
+ this.isCombined = !isPinnedToTaskbar;
+ // Allow overriding of the result via a query parameter.
+ // TODO(pmonette): Remove these checks when they are no longer needed.
+ /** @const */
+ var VARIANT_KEY = 'variant';
+ var VariantType = {
+ DEFAULT_ONLY: 'defaultonly',
+ COMBINED: 'combined'
+ };
+ var params = new URLSearchParams(location.search.slice(1));
+ if (params.has(VARIANT_KEY)) {
+ if (params.get(VARIANT_KEY) === VariantType.DEFAULT_ONLY)
+ this.isCombined = false;
+ else if (params.get(VARIANT_KEY) === VariantType.COMBINED)
+ this.isCombined = true;
+ }
+ },
+
+ ready: function() {
+ this.isCombined = false;
+ // Asynchronously check if Chrome is pinned to the taskbar.
+ cr.sendWithPromise('getPinnedToTaskbarState').then(
+ this.receivePinnedState.bind(this));
+ },
+
+ computeClasses: function(isCombined) {
if (isCombined)
return 'section expandable expanded';
return 'section';
- }
+ },
- function onContinue() {
+ onContinue: function() {
chrome.send('handleContinue');
- }
+ },
- function onOpenSettings() {
+ onOpenSettings: function() {
chrome.send('handleSetDefaultBrowser');
- }
+ },
- function onToggle(app) {
- if (app.isCombined) {
- var sections = document.querySelectorAll('.section.expandable');
+ onToggle: function() {
+ if (this.isCombined) {
+ var sections = this.shadowRoot.querySelectorAll('.section.expandable');
sections.forEach(function(section) {
section.classList.toggle('expanded');
});
}
}
-
- function initialize() {
- var app = $('inline-app');
-
- // 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.
- /** @const */ var VARIANT_KEY = 'variant';
- var VariantType = {
- DEFAULT_ONLY: 'defaultonly',
- COMBINED: 'combined'
- };
- var params = new URLSearchParams(location.search.slice(1));
- if (params.has(VARIANT_KEY)) {
- if (params.get(VARIANT_KEY) === VariantType.DEFAULT_ONLY)
- app.isCombined = false;
- else if (params.get(VARIANT_KEY) === VariantType.COMBINED)
- app.isCombined = true;
- } else {
- app.isCombined = !isPinnedToTaskbar;
- }
- });
- }
-
- return {
- initialize: initialize
- };
});
-
-document.addEventListener('DOMContentLoaded', inline.initialize);
« 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