OLD | NEW |
(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 var Feedback = {}; |
| 6 |
| 7 /** |
| 8 * API invoked by the browser MdFeedbackWebUIMessageHandler to communicate |
| 9 * with this UI. |
| 10 */ |
| 11 Feedback.UI = class { |
| 12 |
| 13 /** |
| 14 * Populates the feedback form with data. |
| 15 * |
| 16 * @param {{email: string|undefined, |
| 17 * url: string|undefined}} data |
| 18 * Parameters in data: |
| 19 * email - user's email, if available. |
| 20 * url - url of the tab the user was on before triggering feedback. |
| 21 */ |
| 22 static setData(data) { |
| 23 $('container').email = data['email']; |
| 24 $('container').url = data['url']; |
| 25 } |
| 26 }; |
| 27 |
| 28 /** API invoked by this UI to communicate with the browser WebUI message |
| 29 * handler. |
| 30 */ |
| 31 Feedback.BrowserApi = class { |
| 32 /** |
| 33 * Requests data to initialize the WebUI with. |
| 34 * The data will be returned via Feedback.UI.setData. |
| 35 */ |
| 36 static requestData() { |
| 37 chrome.send('requestData'); |
| 38 } |
| 39 }; |
| 40 |
| 41 window.addEventListener('DOMContentLoaded', function() { |
| 42 Feedback.BrowserApi.requestData(); |
| 43 }); |
OLD | NEW |