Commit fba5c5c1 authored by ellyjones's avatar ellyjones Committed by Commit bot

feedback UI: use native window controls on Mac

This CL adds a member to FeedbackInfo which instructs the feedback dialog
to use native window controls and implements support for it in the
feedback dialog's JS.

BUG=553991
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2295793002
Cr-Commit-Position: refs/heads/master@{#415396}
parent 259c0188
...@@ -130,6 +130,11 @@ void FeedbackPrivateAPI::RequestFeedbackForFlow( ...@@ -130,6 +130,11 @@ void FeedbackPrivateAPI::RequestFeedbackForFlow(
info.trace_id.reset(new int(manager->RequestTrace())); info.trace_id.reset(new int(manager->RequestTrace()));
} }
info.flow = flow; info.flow = flow;
#if defined(OS_MACOSX)
info.use_system_window_frame = true;
#else
info.use_system_window_frame = false;
#endif
std::unique_ptr<base::ListValue> args = std::unique_ptr<base::ListValue> args =
feedback_private::OnFeedbackRequested::Create(info); feedback_private::OnFeedbackRequested::Create(info);
......
...@@ -260,7 +260,7 @@ function startFeedbackUI(feedbackInfo) { ...@@ -260,7 +260,7 @@ function startFeedbackUI(feedbackInfo) {
return; return;
} }
chrome.app.window.create('html/default.html', { chrome.app.window.create('html/default.html', {
frame: 'none', frame: feedbackInfo.useSystemWindowFrame ? 'chrome' : 'none',
id: FEEDBACK_DEFAULT_WINDOW_ID, id: FEEDBACK_DEFAULT_WINDOW_ID,
width: FEEDBACK_WIDTH, width: FEEDBACK_WIDTH,
height: FEEDBACK_HEIGHT, height: FEEDBACK_HEIGHT,
......
...@@ -6,6 +6,13 @@ ...@@ -6,6 +6,13 @@
* Setup handlers for the minimize and close topbar buttons. * Setup handlers for the minimize and close topbar buttons.
*/ */
function initializeHandlers() { function initializeHandlers() {
// If this dialog is using system window controls, these elements aren't
// needed at all.
if (window.feedbackInfo.useSystemWindowFrame) {
$('minimize-button').hidden = true;
$('close-button').hidden = true;
return;
}
$('minimize-button').addEventListener('click', function(e) { $('minimize-button').addEventListener('click', function(e) {
e.preventDefault(); e.preventDefault();
chrome.app.window.current().minimize(); chrome.app.window.current().minimize();
......
...@@ -71,6 +71,9 @@ namespace feedbackPrivate { ...@@ -71,6 +71,9 @@ namespace feedbackPrivate {
// Used internally to store the blob uuid after parameter customization. // Used internally to store the blob uuid after parameter customization.
DOMString? attachedFileBlobUuid; DOMString? attachedFileBlobUuid;
DOMString? screenshotBlobUuid; DOMString? screenshotBlobUuid;
// Whether to use the system-provided window frame or custom frame controls.
boolean useSystemWindowFrame;
}; };
// Status of the sending of a feedback report. // Status of the sending of a feedback report.
......
...@@ -23,7 +23,8 @@ chrome.test.runTests([ ...@@ -23,7 +23,8 @@ chrome.test.runTests([
function sendFeedbackTest() { function sendFeedbackTest() {
var feedbackInfo = { var feedbackInfo = {
description: 'This is a test description', description: 'This is a test description',
sendHistograms: false sendHistograms: false,
useSystemWindowFrame: false
}; };
chrome.feedbackPrivate.sendFeedback( chrome.feedbackPrivate.sendFeedback(
feedbackInfo, chrome.test.callbackPass(function(response) { feedbackInfo, chrome.test.callbackPass(function(response) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment