OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Setup handlers for the minimize and close topbar buttons. | 6 * Setup handlers for the minimize and close topbar buttons. |
7 */ | 7 */ |
8 function initializeHandlers() { | 8 function initializeHandlers() { |
| 9 // If this dialog is using system window controls, these elements aren't |
| 10 // needed at all. |
| 11 if (window.feedbackInfo.useSystemWindowFrame) { |
| 12 $('minimize-button').hidden = true; |
| 13 $('close-button').hidden = true; |
| 14 return; |
| 15 } |
9 $('minimize-button').addEventListener('click', function(e) { | 16 $('minimize-button').addEventListener('click', function(e) { |
10 e.preventDefault(); | 17 e.preventDefault(); |
11 chrome.app.window.current().minimize(); | 18 chrome.app.window.current().minimize(); |
12 }); | 19 }); |
13 | 20 |
14 $('minimize-button').addEventListener('mousedown', function(e) { | 21 $('minimize-button').addEventListener('mousedown', function(e) { |
15 e.preventDefault(); | 22 e.preventDefault(); |
16 }); | 23 }); |
17 | 24 |
18 $('close-button').addEventListener('click', function() { | 25 $('close-button').addEventListener('click', function() { |
19 window.close(); | 26 window.close(); |
20 }); | 27 }); |
21 | 28 |
22 $('close-button').addEventListener('mousedown', function(e) { | 29 $('close-button').addEventListener('mousedown', function(e) { |
23 e.preventDefault(); | 30 e.preventDefault(); |
24 }); | 31 }); |
25 } | 32 } |
26 | 33 |
27 window.addEventListener('DOMContentLoaded', initializeHandlers); | 34 window.addEventListener('DOMContentLoaded', initializeHandlers); |
OLD | NEW |