| 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();
|
| +});
|
|
|