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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 cr.define('feedback', function() {
6 'use strict';
afakhry 2016/09/14 01:48:15 No word from dbeam yet?
apacible 2016/09/14 17:53:20 He commented right after your's last set of commen
afakhry 2016/09/14 18:07:37 Thanks! I hope it doesn't cause you trouble with t
apacible 2016/09/14 18:12:11 Got it working, there were just a few small tweaks
7
8 /**
9 * The feedback-container element. Initialized after Polymer is ready.
10 * @type {?FeedbackContainer}
11 */
12 var container = null;
13
14 /**
15 * Initialize the Feedback WebUI by requesting data to populate the current
16 * feedback form.
17 */
18 function initialize() {
19 container = /** @type {!FeedbackContainerElement} */
20 ($('container'));
21
22 feedback.browserApi.requestData();
23 }
24
25 return {
26 initialize: initialize,
27 };
28 });
29
30 // API invoked by the browser MdFeedbackWebUIMessageHandler to communicate
31 // with this UI.
32 cr.define('feedback.ui', function() {
33 'use strict';
34
35 /**
36 * Populates the feedback form with data.
37 *
38 * @param {{email: string|undefined,
39 * url: string|undefined}} data
40 * Parameters in data:
41 * email - user's email, if available.
42 * url - url of the tab the user was on before triggering feedback.
43 */
44 function setData(data) {
45 container.email = data['email'];
46 container.url = data['url'];
47 }
48
49 return {
50 setData: setData,
51 };
52 });
53
54 // API invoked by this UI to communicate with the browser WebUI message
55 // handler.
56 cr.define('feedback.browserApi', function() {
57 'use strict';
58
59 /**
60 * Requests data to initialize the WebUI with.
61 * The data will be returned via feedback.ui.setData.
62 */
63 function requestData() {
64 chrome.send('requestData');
65 }
66
67 return {
68 requestData: requestData,
69 };
70 });
71
72 window.addEventListener('DOMContentLoaded', feedback.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698