forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeedback.js
42 lines (38 loc) · 1.08 KB
/
feedback.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// 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();
});