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

Unified Diff: chrome/browser/resources/chromeos/login/oobe-screen.js

Issue 1179323005: Polymer upgraded to 1.0 in login flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@polymer_pre_migration
Patch Set: Comments addressed. Created 5 years, 6 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
Index: chrome/browser/resources/chromeos/login/oobe-screen.js
diff --git a/chrome/browser/resources/chromeos/login/oobe-screen.js b/chrome/browser/resources/chromeos/login/oobe-screen.js
index b8bb0e9719da2d18962f4b0ce11f1143af66fb13..b79784d145b7d88f6ab35873cf221f894bd6b3c6 100644
--- a/chrome/browser/resources/chromeos/login/oobe-screen.js
+++ b/chrome/browser/resources/chromeos/login/oobe-screen.js
@@ -1,13 +1,29 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-Polymer('oobe-screen', (function() {
+cr.define('login', function() {
/** @const */ var CALLBACK_USER_ACTED = 'userActed';
- function doNothing() {};
+ var OobeScreenBehavior = {
+ properties: {
+ /**
+ * Internal storage of |this.context|. Short name has been choosen for
+ * reason: such name doesn't take much space in HTML data bindings, which
+ * are used very often.
+ * C binded to the native part of the context, that means that all the
+ * changes in the native part appear in C automatically. Reverse is not
+ * true, you should use:
+ * this.context.set(...);
+ * this.context.commitContextChanges();
+ * to send updates to the native part.
+ * TODO(dzhioev): make binding two-way.
+ */
+ C: Object,
+
+ name: String
+ },
- return {
/**
* The login.Screen which is hosting |this|.
*/
@@ -25,23 +41,9 @@ Polymer('oobe-screen', (function() {
context: null,
/**
- * Internal storage of |this.context|. Short name has been choosen for
- * reason: such name doesn't take much space in HTML data bindings, which
- * are used very often.
- * C binded to the native part of the context, that means that all the
- * changes in the native part appear in C automatically. Reverse is not
- * true, you should use:
- * this.context.set(...);
- * this.context.commitContextChanges();
- * to send updates to the native part.
- * TODO(dzhioev): make binding two-way.
- */
- C: null,
-
- /**
* Called when the screen is being registered.
*/
- initialize: doNothing,
+ initialize: function() {},
ready: function() {
if (this.decorate_) {
@@ -51,8 +53,9 @@ Polymer('oobe-screen', (function() {
}
},
- userActed: function(_, _, source) {
- this.send(CALLBACK_USER_ACTED, source.getAttribute('action'));
+ userActed: function(e) {
+ this.send(CALLBACK_USER_ACTED,
+ e.detail.sourceEvent.target.getAttribute('action'));
},
i18n: function(args) {
@@ -79,6 +82,18 @@ Polymer('oobe-screen', (function() {
},
/**
+ * Should be called for every context field which is used in Polymer
+ * declarative data bindings (e.g. {{C.fieldName}}).
+ */
+ registerBoundContextField: function(fieldName) {
+ this.addContextObserver(fieldName, this.onContextFieldChanged_);
+ },
+
+ onContextFieldChanged_: function(_, _, fieldName) {
+ this.notifyPath('C.' + fieldName, this.C[fieldName]);
+ },
+
+ /**
* @final
*/
send: function() {
@@ -211,5 +226,9 @@ Polymer('oobe-screen', (function() {
return '';
}
};
-})());
+
+ return {
+ OobeScreenBehavior: OobeScreenBehavior
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698