| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 4 '''This is a simple helper script to shut down the Chrome Frame helper process. | 5 """This is a simple helper script to shut down the Chrome Frame helper process. |
| 5 It needs the Python Win32 extensions.''' | 6 |
| 7 Requires Python Win32 extensions. |
| 8 """ |
| 6 | 9 |
| 7 import pywintypes | 10 import pywintypes |
| 8 import sys | 11 import sys |
| 9 import win32gui | 12 import win32gui |
| 10 import win32con | 13 import win32con |
| 11 | 14 |
| 15 |
| 12 def main(): | 16 def main(): |
| 13 exit_code = 0 | 17 exit_code = 0 |
| 14 window = win32gui.FindWindow('ChromeFrameHelperWindowClass', | 18 window = win32gui.FindWindow('ChromeFrameHelperWindowClass', |
| 15 'ChromeFrameHelperWindowName') | 19 'ChromeFrameHelperWindowName') |
| 16 if not window: | 20 if not window: |
| 17 print 'Chrome Frame helper process not running.' | 21 print 'Chrome Frame helper process not running.' |
| 18 else: | 22 else: |
| 19 try: | 23 try: |
| 20 win32gui.PostMessage(window, win32con.WM_CLOSE, 0, 0) | 24 win32gui.PostMessage(window, win32con.WM_CLOSE, 0, 0) |
| 21 print 'Chrome Frame helper process shut down.' | 25 print 'Chrome Frame helper process shut down.' |
| 22 except pywintypes.error as ex: | 26 except pywintypes.error as ex: |
| 23 print 'Failed to shutdown Chrome Frame helper process: ' | 27 print 'Failed to shutdown Chrome Frame helper process: ' |
| 24 print ex | 28 print ex |
| 25 exit_code = 1 | 29 exit_code = 1 |
| 30 return exit_code |
| 26 | 31 |
| 27 return exit_code | |
| 28 | 32 |
| 29 if __name__ == '__main__': | 33 if __name__ == '__main__': |
| 30 sys.exit(main()) | 34 sys.exit(main()) |
| OLD | NEW |