| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 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 # Script that can be used to register native messaging hosts in the output | 6 # Script that can be used to register native messaging hosts in the output |
| 7 # directory. | 7 # directory. |
| 8 | 8 |
| 9 set -e | 9 set -e |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 install_manifest \ | 40 install_manifest \ |
| 41 "${SRC_DIR}/remoting/host/it2me/${IT2ME_HOST_NAME}.json.jinja2" \ | 41 "${SRC_DIR}/remoting/host/it2me/${IT2ME_HOST_NAME}.json.jinja2" \ |
| 42 "${build_dir}/remote_assistance_host" \ | 42 "${build_dir}/remote_assistance_host" \ |
| 43 IT2ME_HOST_PATH "${chrome_data_dir}" | 43 IT2ME_HOST_PATH "${chrome_data_dir}" |
| 44 } | 44 } |
| 45 | 45 |
| 46 register_hosts_for_all_channels() { | 46 register_hosts_for_all_channels() { |
| 47 local build_dir="$1" | 47 local build_dir="$1" |
| 48 | 48 |
| 49 if [ $(uname -s) == "Darwin" ]; then | 49 if [ -n "$CHROME_USER_DATA_DIR" ]; then |
| 50 register_hosts "${build_dir}" \ |
| 51 "${CHROME_USER_DATA_DIR}/NativeMessagingHosts" |
| 52 elif [ $(uname -s) == "Darwin" ]; then |
| 50 register_hosts "${build_dir}" \ | 53 register_hosts "${build_dir}" \ |
| 51 "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts" | 54 "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts" |
| 52 register_hosts "${build_dir}" \ | 55 register_hosts "${build_dir}" \ |
| 53 "${HOME}/Library/Application Support/Chromium/NativeMessagingHosts" | 56 "${HOME}/Library/Application Support/Chromium/NativeMessagingHosts" |
| 54 else | 57 else |
| 55 register_hosts "${build_dir}" \ | 58 register_hosts "${build_dir}" \ |
| 56 "${HOME}/.config/google-chrome/NativeMessagingHosts" | 59 "${HOME}/.config/google-chrome/NativeMessagingHosts" |
| 57 register_hosts "${build_dir}" \ | 60 register_hosts "${build_dir}" \ |
| 58 "${HOME}/.config/google-chrome-beta/NativeMessagingHosts" | 61 "${HOME}/.config/google-chrome-beta/NativeMessagingHosts" |
| 59 register_hosts "${build_dir}" \ | 62 register_hosts "${build_dir}" \ |
| 60 "${HOME}/.config/google-chrome-unstable/NativeMessagingHosts" | 63 "${HOME}/.config/google-chrome-unstable/NativeMessagingHosts" |
| 61 register_hosts "${build_dir}" \ | 64 register_hosts "${build_dir}" \ |
| 62 "${HOME}/.config/chromium/NativeMessagingHosts" | 65 "${HOME}/.config/chromium/NativeMessagingHosts" |
| 63 fi | 66 fi |
| 64 } | 67 } |
| 65 | 68 |
| 66 unregister_hosts() { | 69 unregister_hosts() { |
| 67 local chrome_data_dir="$1" | 70 local chrome_data_dir="$1" |
| 68 | 71 |
| 69 rm -f "${chrome_data_dir}/${ME2ME_HOST_NAME}.json" | 72 rm -f "${chrome_data_dir}/${ME2ME_HOST_NAME}.json" |
| 70 rm -f "${chrome_data_dir}/${IT2ME_HOST_NAME}.json" | 73 rm -f "${chrome_data_dir}/${IT2ME_HOST_NAME}.json" |
| 71 } | 74 } |
| 72 | 75 |
| 73 unregister_hosts_for_all_channels() { | 76 unregister_hosts_for_all_channels() { |
| 74 if [ $(uname -s) == "Darwin" ]; then | 77 if [ -n "$CHROME_USER_DATA_DIR" ]; then |
| 78 unregister_hosts \ |
| 79 "${CHROME_USER_DATA_DIR}/NativeMessagingHosts" |
| 80 elif [ $(uname -s) == "Darwin" ]; then |
| 75 unregister_hosts \ | 81 unregister_hosts \ |
| 76 "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts" | 82 "${HOME}/Library/Application Support/Google/Chrome/NativeMessagingHosts" |
| 77 unregister_hosts \ | 83 unregister_hosts \ |
| 78 "${HOME}/Library/Application Support/Chromium/NativeMessagingHosts" | 84 "${HOME}/Library/Application Support/Chromium/NativeMessagingHosts" |
| 79 else | 85 else |
| 80 unregister_hosts "${HOME}/.config/google-chrome/NativeMessagingHosts" | 86 unregister_hosts "${HOME}/.config/google-chrome/NativeMessagingHosts" |
| 81 unregister_hosts "${HOME}/.config/google-chrome-beta/NativeMessagingHosts" | 87 unregister_hosts "${HOME}/.config/google-chrome-beta/NativeMessagingHosts" |
| 82 unregister_hosts \ | 88 unregister_hosts \ |
| 83 "${HOME}/.config/google-chrome-unstable/NativeMessagingHosts" | 89 "${HOME}/.config/google-chrome-unstable/NativeMessagingHosts" |
| 84 unregister_hosts "${HOME}/.config/chromium/NativeMessagingHosts" | 90 unregister_hosts "${HOME}/.config/chromium/NativeMessagingHosts" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 105 exit 0 | 111 exit 0 |
| 106 ;; | 112 ;; |
| 107 *) | 113 *) |
| 108 print_usage | 114 print_usage |
| 109 exit 1 | 115 exit 1 |
| 110 ;; | 116 ;; |
| 111 esac | 117 esac |
| 112 fi | 118 fi |
| 113 | 119 |
| 114 register_hosts_for_all_channels "${SRC_DIR}/out/${build_dir}" | 120 register_hosts_for_all_channels "${SRC_DIR}/out/${build_dir}" |
| OLD | NEW |