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

Unified Diff: crash_sender

Issue 3520011: crash-reporter: detect guest mode and defer crash sending (Closed) Base URL: http://git.chromium.org/git/crash-reporter.git
Patch Set: Created 10 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crash_sender
diff --git a/crash_sender b/crash_sender
index f6b3e3a58fe31a27fa66001c58b7c66b0e631ac2..c9eec0591f9d46fce8a1e9d1a1d2d6d517a859a0 100644
--- a/crash_sender
+++ b/crash_sender
@@ -31,6 +31,9 @@ HWCLASS_PATH="/sys/devices/platform/chromeos_acpi/HWID"
# Maximum crashes to send per day.
MAX_CRASH_RATE=${MAX_CRASH_RATE:-32}
+# Path to metrics_client.
+METRICS_CLIENT="/usr/bin/metrics_client"
+
# File whose existence mocks crash sending. If empty we pretend the
# crash sending was successful, otherwise unsuccessful.
MOCK_CRASH_SENDING="/tmp/mock-crash-sending"
@@ -105,11 +108,6 @@ generate_uniform_random() {
echo $((random % max))
}
-is_feedback_disabled() {
- [ -r "${CONSENT_ID}" ] && return 1
- return 0
-}
-
is_on_3g() {
# See crosbug.com/3304.
return 1
@@ -292,7 +290,12 @@ send_crashes() {
continue
fi
- if is_feedback_disabled; then
+ if ${METRICS_CLIENT} -g; then
+ lecho "Guest mode has been entered. Delaying crash sending until exited."
+ return 0
+ fi
+
+ if ! ${METRICS_CLIENT} -c; then
lecho "Uploading is disabled. Removing crash."
remove_report "${meta_path}"
continue
@@ -347,10 +350,12 @@ main() {
check_not_already_running
- if [ ! -x "${FIND}" ]; then
- lecho "Fatal: Crash sending disabled: ${FIND} not found."
- exit 1
- fi
+ for dependency in "${FIND}" "${METRICS_CLIENT}"; do
+ if [ ! -x "${dependency}" ]; then
+ lecho "Fatal: Crash sending disabled: ${dependency} not found."
+ exit 1
+ fi
+ done
TMP_DIR="$(mktemp -d /tmp/crash_sender.XXXX)"
« 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