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