Chromium Code Reviews| Index: chrome/browser/policy/enterprise_metrics.cc |
| diff --git a/chrome/browser/policy/enterprise_metrics.cc b/chrome/browser/policy/enterprise_metrics.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ab8f2543811f7a5d0f95c4dbef44356387db62c0 |
| --- /dev/null |
| +++ b/chrome/browser/policy/enterprise_metrics.cc |
| @@ -0,0 +1,52 @@ |
| +// Copyright (c) 2011 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. |
| + |
| +#include "base/metrics/histogram.h" |
| +#include "chrome/browser/policy/enterprise_metrics.h" |
| +#include "content/browser/browser_thread.h" |
| + |
| +namespace enterprise_management { |
| + |
| +void LogTokenOperation(TokenOperationResult result) { |
| + DCHECK(result >= 0); |
| + DCHECK(result < kTokenOperationsSize); |
| + |
| + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
|
gfeher
2011/06/28 09:58:58
Are you sure this is necessary? I haven't seen thi
Joao da Silva
2011/06/30 12:57:00
After checking histogram.h it seems to me that ini
|
| + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| + NewRunnableFunction(&LogTokenOperation, result)); |
| + return; |
| + } |
| + |
| + UMA_HISTOGRAM_ENUMERATION("Enterprise.DMToken", result, kTokenOperationsSize); |
| +} |
| + |
| +void LogPolicyOperation(PolicyOperationResult result) { |
| + DCHECK(result >= 0); |
| + DCHECK(result < kPolicyOperationsSize); |
| + |
| + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| + NewRunnableFunction(&LogPolicyOperation, result)); |
| + return; |
| + } |
| + |
| + UMA_HISTOGRAM_ENUMERATION("Enterprise.Policy", result, kPolicyOperationsSize); |
| +} |
| + |
| +void LogEnrollmentOperation(EnrollmentResult result) { |
| + DCHECK(result >= 0); |
| + DCHECK(result < kEnrollmentOperationsSize); |
| + |
| + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| + BrowserThread::PostTask( |
| + BrowserThread::UI, FROM_HERE, |
| + NewRunnableFunction(&LogEnrollmentOperation, result)); |
| + return; |
| + } |
| + |
| + UMA_HISTOGRAM_ENUMERATION("Enterprise.Enrollment", result, |
| + kEnrollmentOperationsSize); |
| +} |
| + |
| +} // namespace enterprise_management |