blob: 947cfb1eed7c39ed43a9c7dc4e8284016c3140d8 [file] [log] [blame]
#!/bin/bash
#
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# If no flags are given, prints the current content shell flags.
#
# Otherwise, the given flags are used to REPLACE (not modify) the content shell
# flags. For example:
# adb_android_webview_command_line --enable-webgl
#
# To remove all content shell flags, pass an empty string for the flags:
# adb_android_webview_command_line ""
CMD_LINE_FILE=/data/local/tmp/android-webview-command-line
if [ $# -eq 0 ] ; then
# If nothing specified, print the command line (stripping off "content_shell")
tempfile=$(tempfile)
adb pull $CMD_LINE_FILE $tempfile 2>/dev/null
if [ $? -eq 0 ] ; then
rm $tempfile
adb shell cat $CMD_LINE_FILE | cut -d " " -f "2-" 2>/dev/null
fi
elif [ $# -eq 1 ] && [ "$1" = '' ] ; then
# If given an empty string, delete the command line.
set -x
adb shell rm $CMD_LINE_FILE >/dev/null
else
# Else set it.
set -x
adb shell "echo 'android_webview $*' > $CMD_LINE_FILE"
# Prevent other apps from modifying flags -- this can create security issues.
adb shell chmod 0664 $CMD_LINE_FILE
fi