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

Unified Diff: chrome/browser/resources/md_feedback/feedback.js

Issue 2190653003: [Md Feedback] Add initial data population for dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per afakhry@'s comments (Rebase). Created 4 years, 3 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/md_feedback/feedback.js
diff --git a/chrome/browser/resources/md_feedback/feedback.js b/chrome/browser/resources/md_feedback/feedback.js
new file mode 100644
index 0000000000000000000000000000000000000000..d36aab512e793a19a951db8c31e7197ac20fd371
--- /dev/null
+++ b/chrome/browser/resources/md_feedback/feedback.js
@@ -0,0 +1,43 @@
+// Copyright 2016 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.
+
+var Feedback = {};
+
+/**
+ * API invoked by the browser MdFeedbackWebUIMessageHandler to communicate
+ * with this UI.
+ */
+Feedback.UI = class {
+
+ /**
+ * Populates the feedback form with data.
+ *
+ * @param {{email: string|undefined,
+ * url: string|undefined}} data
+ * Parameters in data:
+ * email - user's email, if available.
+ * url - url of the tab the user was on before triggering feedback.
+ */
+ static setData(data) {
+ $('container').email = data['email'];
+ $('container').url = data['url'];
+ }
+};
+
+/** API invoked by this UI to communicate with the browser WebUI message
+ * handler.
+ */
+Feedback.BrowserApi = class {
+ /**
+ * Requests data to initialize the WebUI with.
+ * The data will be returned via Feedback.UI.setData.
+ */
+ static requestData() {
+ chrome.send('requestData');
+ }
+};
+
+window.addEventListener('DOMContentLoaded', function() {
+ Feedback.BrowserApi.requestData();
+});
« no previous file with comments | « chrome/browser/resources/md_feedback/feedback.html ('k') | chrome/browser/resources/md_feedback/feedback_container.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698