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 | 9 // If this dialog is using system window controls, these elements aren't |
10 // needed at all. | 10 // needed at all. |
11 if (window.feedbackInfo.useSystemWindowFrame) { | 11 if (window.feedbackInfo.useSystemWindowFrame) { |
12 $('minimize-button').hidden = true; | 12 $('minimize-button').hidden = true; |
13 $('close-button').hidden = true; | 13 $('close-button').hidden = true; |
14 return; | 14 return; |
15 } | 15 } |
16 $('minimize-button').addEventListener('click', function(e) { | 16 $('minimize-button').addEventListener('click', function(e) { |
17 e.preventDefault(); | 17 e.preventDefault(); |
18 chrome.app.window.current().minimize(); | 18 chrome.app.window.current().minimize(); |
19 }); | 19 }); |
20 | 20 |
21 $('minimize-button').addEventListener('mousedown', function(e) { | 21 $('minimize-button').addEventListener('mousedown', function(e) { |
22 e.preventDefault(); | 22 e.preventDefault(); |
23 }); | 23 }); |
24 | 24 |
25 $('close-button').addEventListener('click', function() { | 25 $('close-button').addEventListener('click', function() { |
26 window.close(); | 26 scheduleWindowClose(); |
27 }); | 27 }); |
28 | 28 |
29 $('close-button').addEventListener('mousedown', function(e) { | 29 $('close-button').addEventListener('mousedown', function(e) { |
30 e.preventDefault(); | 30 e.preventDefault(); |
31 }); | 31 }); |
32 } | 32 } |
33 | 33 |
34 window.addEventListener('DOMContentLoaded', initializeHandlers); | 34 window.addEventListener('DOMContentLoaded', initializeHandlers); |
OLD | NEW |