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

Unified Diff: ui/login/screen.js

Issue 763563002: Implemented event-dispatching for button clicks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/login/screen.js
diff --git a/ui/login/screen.js b/ui/login/screen.js
index 93efd73e2455b7acac1b62e70e860871ed0218dd..dc8849c9a33877074b144f8735a1078f609541be 100644
--- a/ui/login/screen.js
+++ b/ui/login/screen.js
@@ -6,8 +6,9 @@
* @fileoverview Base class for all login WebUI screens.
*/
cr.define('login', function() {
- /** @const */ var CALLBACK_USER_ACTED = 'userActed';
+ /** @const */ var CALLBACK_BUTTON_CLICKED = 'buttonClicked';
/** @const */ var CALLBACK_CONTEXT_CHANGED = 'contextChanged';
+ /** @const */ var CALLBACK_USER_ACTED = 'userActed';
function doNothing() {};
@@ -97,6 +98,22 @@ cr.define('login', function() {
},
/**
+ * @final
+ */
+ declareButton: function(id) {
+ var self = this;
+ var button = this.ownerDocument.createElement('button');
+ button.id = id;
+
+ button.addEventListener('click', function(e) {
+ self.sendImpl_(CALLBACK_BUTTON_CLICKED, id);
+ e.stopPropagation();
+ });
+
+ return button;
+ },
+
+ /**
* @override
* @final
*/

Powered by Google App Engine
This is Rietveld 408576698