| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # 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 |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import logging | 7 import logging |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 from devtoolslib import shell_arguments | 10 from devtoolslib import shell_arguments |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 "<mojo-app-url>" | 23 "<mojo-app-url>" |
| 24 "<mojo-app-url> <arguments>" | 24 "<mojo-app-url> <arguments>" |
| 25 | 25 |
| 26 The value of <handlers> is a comma separated list like: | 26 The value of <handlers> is a comma separated list like: |
| 27 text/html,mojo:html_viewer,application/javascript,mojo:js_content_handler | 27 text/html,mojo:html_viewer,application/javascript,mojo:js_content_handler |
| 28 """ | 28 """ |
| 29 | 29 |
| 30 # Port on which the mojo:debugger http server will be available on the host | 30 # Port on which the mojo:debugger http server will be available on the host |
| 31 # machine. | 31 # machine. |
| 32 _MOJO_DEBUGGER_PORT = 7777 | 32 _MOJO_DEBUGGER_PORT = 7777 |
| 33 _DEFAULT_WM = 'https://core.mojoapps.io/kiosk_wm.mojo' | 33 _DEFAULT_WM = 'mojo:kiosk_wm' |
| 34 | 34 |
| 35 _LEGACY_WM_URL = 'mojo:window_manager' | 35 _WM_URL = 'mojo:window_manager' |
| 36 _WM_URL = 'https://core.mojoapps.io/window_manager.mojo' | |
| 37 _DEBUGGER_URL = 'https://core.mojoapps.io/debugger.mojo' | 36 _DEBUGGER_URL = 'https://core.mojoapps.io/debugger.mojo' |
| 38 | 37 |
| 39 | 38 |
| 40 def _configure_debugger(shell): | 39 def _configure_debugger(shell): |
| 41 """Configures debugger.mojo to run and sets up port forwarding for its http | 40 """Configures debugger.mojo to run and sets up port forwarding for its http |
| 42 server if the shell is running on a device. | 41 server if the shell is running on a device. |
| 43 | 42 |
| 44 Returns: | 43 Returns: |
| 45 Arguments that need to be appended to the shell argument list in order to | 44 Arguments that need to be appended to the shell argument list in order to |
| 46 run with the debugger. | 45 run with the debugger. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 69 script_args, shell_args = parser.parse_known_args() | 68 script_args, shell_args = parser.parse_known_args() |
| 70 | 69 |
| 71 try: | 70 try: |
| 72 config = shell_config.get_shell_config(script_args) | 71 config = shell_config.get_shell_config(script_args) |
| 73 shell, shell_args = shell_arguments.get_shell(config, shell_args) | 72 shell, shell_args = shell_arguments.get_shell(config, shell_args) |
| 74 except shell_config.ShellConfigurationException as e: | 73 except shell_config.ShellConfigurationException as e: |
| 75 print e | 74 print e |
| 76 return 1 | 75 return 1 |
| 77 | 76 |
| 78 shell_args = shell_arguments.append_to_argument(shell_args, '--url-mappings=', | 77 shell_args = shell_arguments.append_to_argument(shell_args, '--url-mappings=', |
| 79 '%s=%s' % (_LEGACY_WM_URL, | |
| 80 script_args.window_manager)) | |
| 81 shell_args = shell_arguments.append_to_argument(shell_args, '--url-mappings=', | |
| 82 '%s=%s' % (_WM_URL, | 78 '%s=%s' % (_WM_URL, |
| 83 script_args.window_manager)) | 79 script_args.window_manager)) |
| 84 | 80 |
| 85 if script_args.embed: | 81 if script_args.embed: |
| 86 shell_args.append('%s %s' % (script_args.window_manager, script_args.embed)) | 82 shell_args.append('%s %s' % (script_args.window_manager, script_args.embed)) |
| 87 | 83 |
| 88 if script_args.debugger: | 84 if script_args.debugger: |
| 89 if script_args.verbose: | 85 if script_args.verbose: |
| 90 print 'Spawning mojo:debugger, use `mojo_debug` to inspect the shell.' | 86 print 'Spawning mojo:debugger, use `mojo_debug` to inspect the shell.' |
| 91 print 'Note that mojo:debugger will prevent the shell from terminating,' | 87 print 'Note that mojo:debugger will prevent the shell from terminating,' |
| 92 print ' pass --no-debugger to skip spawning mojo:debugger.' | 88 print ' pass --no-debugger to skip spawning mojo:debugger.' |
| 93 shell_args.extend(_configure_debugger(shell)) | 89 shell_args.extend(_configure_debugger(shell)) |
| 94 | 90 |
| 95 if script_args.verbose: | 91 if script_args.verbose: |
| 96 print "Shell arguments: " + str(shell_args) | 92 print "Shell arguments: " + str(shell_args) |
| 97 | 93 |
| 98 shell.run(shell_args) | 94 shell.run(shell_args) |
| 99 return 0 | 95 return 0 |
| 100 | 96 |
| 101 | 97 |
| 102 if __name__ == "__main__": | 98 if __name__ == "__main__": |
| 103 sys.exit(main()) | 99 sys.exit(main()) |
| OLD | NEW |