Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: remoting/tools/me2me_virtual_host.py

Issue 11566037: Increase default maximum desktop size and make it configurable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer comments. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 # Virtual Me2Me implementation. This script runs and manages the processes 6 # Virtual Me2Me implementation. This script runs and manages the processes
7 # required for a Virtual Me2Me desktop, which are: X server, X desktop 7 # required for a Virtual Me2Me desktop, which are: X server, X desktop
8 # session, and Host process. 8 # session, and Host process.
9 # This script is intended to run continuously as a background daemon 9 # This script is intended to run continuously as a background daemon
10 # process, running under an ordinary (non-root) user account. 10 # process, running under an ordinary (non-root) user account.
(...skipping 17 matching lines...) Expand all
28 # By default this script will try to determine the most appropriate X session 28 # By default this script will try to determine the most appropriate X session
29 # command for the system. To use a specific session instead, set this variable 29 # command for the system. To use a specific session instead, set this variable
30 # to the executable filename, or a list containing the executable and any 30 # to the executable filename, or a list containing the executable and any
31 # arguments, for example: 31 # arguments, for example:
32 # XSESSION_COMMAND = "/usr/bin/gnome-session-fallback" 32 # XSESSION_COMMAND = "/usr/bin/gnome-session-fallback"
33 # XSESSION_COMMAND = ["/usr/bin/gnome-session", "--session=ubuntu-2d"] 33 # XSESSION_COMMAND = ["/usr/bin/gnome-session", "--session=ubuntu-2d"]
34 XSESSION_COMMAND = None 34 XSESSION_COMMAND = None
35 35
36 LOG_FILE_ENV_VAR = "CHROME_REMOTE_DESKTOP_LOG_FILE" 36 LOG_FILE_ENV_VAR = "CHROME_REMOTE_DESKTOP_LOG_FILE"
37 37
38 # This script has a sensible default for the initial and maximum desktop size,
39 # which can be overridden either on the command-line, or via a comma-separated
40 # list of sizes in this environment variable.
41 DEFAULT_SIZES_ENV_VAR = "CHROME_REMOTE_DESKTOP_DEFAULT_DESKTOP_SIZES"
42
43 # By default, provide a relatively small size to handle the case where resize-
44 # to-client is disabled, and a much larger size to support clients with large
45 # or mulitple monitors. These defaults can be overridden in ~/.profile.
46 DEFAULT_SIZES = "1600x1200,3840x1600"
47
38 SCRIPT_PATH = sys.path[0] 48 SCRIPT_PATH = sys.path[0]
39 49
40 DEFAULT_INSTALL_PATH = "/opt/google/chrome-remote-desktop" 50 DEFAULT_INSTALL_PATH = "/opt/google/chrome-remote-desktop"
41 if SCRIPT_PATH == DEFAULT_INSTALL_PATH: 51 if SCRIPT_PATH == DEFAULT_INSTALL_PATH:
42 HOST_BINARY_NAME = "chrome-remote-desktop-host" 52 HOST_BINARY_NAME = "chrome-remote-desktop-host"
43 else: 53 else:
44 HOST_BINARY_NAME = "remoting_me2me_host" 54 HOST_BINARY_NAME = "remoting_me2me_host"
45 55
46 CHROME_REMOTING_GROUP_NAME = "chrome-remote-desktop" 56 CHROME_REMOTING_GROUP_NAME = "chrome-remote-desktop"
47 57
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 raise 751 raise
742 elif deadline > now: 752 elif deadline > now:
743 time.sleep(deadline - now) 753 time.sleep(deadline - now)
744 return (0, 0) 754 return (0, 0)
745 else: 755 else:
746 # Anything else is an unexpected error. 756 # Anything else is an unexpected error.
747 raise 757 raise
748 758
749 759
750 def main(): 760 def main():
751 DEFAULT_SIZE = "2560x1600"
752 EPILOG = """This script is not intended for use by end-users. To configure 761 EPILOG = """This script is not intended for use by end-users. To configure
753 Chrome Remote Desktop, please install the app from the Chrome 762 Chrome Remote Desktop, please install the app from the Chrome
754 Web Store: https://chrome.google.com/remotedesktop""" 763 Web Store: https://chrome.google.com/remotedesktop"""
755 parser = optparse.OptionParser( 764 parser = optparse.OptionParser(
756 usage="Usage: %prog [options] [ -- [ X server options ] ]", 765 usage="Usage: %prog [options] [ -- [ X server options ] ]",
757 epilog=EPILOG) 766 epilog=EPILOG)
758 parser.add_option("-s", "--size", dest="size", action="append", 767 parser.add_option("-s", "--size", dest="size", action="append",
759 help="Dimensions of virtual desktop (default: %s). " 768 help="Dimensions of virtual desktop. This can be specified "
760 "This can be specified multiple times to make multiple " 769 "multiple times to make multiple screen resolutions "
761 "screen resolutions available (if the Xvfb server " 770 "available (if the Xvfb server supports this).")
762 "supports this)" % DEFAULT_SIZE)
763 parser.add_option("-f", "--foreground", dest="foreground", default=False, 771 parser.add_option("-f", "--foreground", dest="foreground", default=False,
764 action="store_true", 772 action="store_true",
765 help="Don't run as a background daemon.") 773 help="Don't run as a background daemon.")
766 parser.add_option("", "--start", dest="start", default=False, 774 parser.add_option("", "--start", dest="start", default=False,
767 action="store_true", 775 action="store_true",
768 help="Start the host.") 776 help="Start the host.")
769 parser.add_option("-k", "--stop", dest="stop", default=False, 777 parser.add_option("-k", "--stop", dest="stop", default=False,
770 action="store_true", 778 action="store_true",
771 help="Stop the daemon currently running.") 779 help="Stop the daemon currently running.")
772 parser.add_option("", "--check-running", dest="check_running", default=False, 780 parser.add_option("", "--check-running", dest="check_running", default=False,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 # TODO(sergeyu): Also check RPM package version once we add RPM package. 834 # TODO(sergeyu): Also check RPM package version once we add RPM package.
827 return os.system(locate_executable(HOST_BINARY_NAME) + " --version") >> 8 835 return os.system(locate_executable(HOST_BINARY_NAME) + " --version") >> 8
828 836
829 if not options.start: 837 if not options.start:
830 # If no modal command-line options specified, print an error and exit. 838 # If no modal command-line options specified, print an error and exit.
831 print >> sys.stderr, EPILOG 839 print >> sys.stderr, EPILOG
832 return 1 840 return 1
833 841
834 # Collate the list of sizes that XRANDR should support. 842 # Collate the list of sizes that XRANDR should support.
835 if not options.size: 843 if not options.size:
836 options.size = [DEFAULT_SIZE] 844 default_sizes = DEFAULT_SIZES
845 if os.environ.has_key(DEFAULT_SIZES_ENV_VAR):
846 default_sizes = os.environ[DEFAULT_SIZES_ENV_VAR]
847 options.size = default_sizes.split(",");
837 848
838 sizes = [] 849 sizes = []
839 for size in options.size: 850 for size in options.size:
840 size_components = size.split("x") 851 size_components = size.split("x")
841 if len(size_components) != 2: 852 if len(size_components) != 2:
842 parser.error("Incorrect size format '%s', should be WIDTHxHEIGHT" % size) 853 parser.error("Incorrect size format '%s', should be WIDTHxHEIGHT" % size)
843 854
844 try: 855 try:
845 width = int(size_components[0]) 856 width = int(size_components[0])
846 height = int(size_components[1]) 857 height = int(size_components[1])
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 host_config.clear_auth() 1048 host_config.clear_auth()
1038 host_config.clear_host_info() 1049 host_config.clear_host_info()
1039 host_config.save() 1050 host_config.save()
1040 return 0 1051 return 0
1041 1052
1042 1053
1043 if __name__ == "__main__": 1054 if __name__ == "__main__":
1044 logging.basicConfig(level=logging.DEBUG, 1055 logging.basicConfig(level=logging.DEBUG,
1045 format="%(asctime)s:%(levelname)s:%(message)s") 1056 format="%(asctime)s:%(levelname)s:%(message)s")
1046 sys.exit(main()) 1057 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698