Chromium Code Reviews| Index: content/browser/bluetooth/bluetooth_metrics.h |
| diff --git a/content/browser/bluetooth/bluetooth_metrics.h b/content/browser/bluetooth/bluetooth_metrics.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..88f0feaa1ae377a0321bb8d3a0323bc44dfce654 |
| --- /dev/null |
| +++ b/content/browser/bluetooth/bluetooth_metrics.h |
| @@ -0,0 +1,121 @@ |
| +// Copyright 2015 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. |
| + |
| +#ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
| +#define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
| + |
| +#include <map> |
|
Jeffrey Yasskin
2015/08/13 21:08:38
<map> and <set> aren't used in this file.
ortuno
2015/08/13 23:04:24
Done.
|
| +#include <set> |
| +#include <vector> |
| +// #include "content/browser/bluetooth/bluetooth_dispatcher_host.h" |
|
Jeffrey Yasskin
2015/08/13 21:08:38
Remember to delete the commented code. :)
ortuno
2015/08/13 23:04:24
Done.
|
| + |
| +namespace base { |
| +class TimeDelta; |
| +} |
| + |
| +namespace device { |
| +class BluetoothUUID; |
| +} |
| + |
| +namespace content { |
| +struct BluetoothScanFilter; |
| + |
| +class BluetoothMetrics { |
|
Jeffrey Yasskin
2015/08/13 21:08:38
Don't use classes for this sort of namespace. I th
ortuno
2015/08/13 23:04:24
Done.
|
| + public: |
| + // General |
| + enum class UMAWebBluetoothFunction { |
| + REQUEST_DEVICE = 0, |
| + CONNECT_GATT = 1, |
| + GET_PRIMARY_SERVICE = 2, |
| + GET_CHARACTERISTIC = 3, |
| + CHARACTERISTIC_READ_VALUE = 4, |
| + CHARACTERISTIC_WRITE_VALUE = 5, |
| + // NOTE: Add new actions immediately above this line. Make sure to update |
| + // the enum list in tools/metrics/histograms/histograms.xml accordingly. |
| + COUNT |
| + }; |
| + static void RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction function); |
| + |
| + // requestDevice() |
| + enum class UMARequestDeviceOutcome { |
| + SUCCESS = 0, |
| + NO_BLUETOOTH_ADAPTER = 1, |
| + NO_RENDER_FRAME = 2, |
| + DISCOVERY_START_FAILED = 3, |
| + DISCOVERY_STOP_FAILED = 4, |
| + NO_MATCHING_DEVICES_FOUND = 5, |
| + BLUETOOTH_ADAPTER_NOT_PRESENT = 6, |
| + BLUETOOTH_ADAPTER_OFF = 7, |
| + // NOTE: Add new requestDevice() outcomes immediately above this line. Make |
| + // sure to update the enum list in |
| + // tools/metrics/histograms/histograms.xml accordingly. |
| + COUNT |
| + }; |
| + static void RecordRequestDeviceOutcome(UMARequestDeviceOutcome outcome); |
|
Jeffrey Yasskin
2015/08/13 21:08:38
I'm feeling guilty having no comments for these fu
ortuno
2015/08/13 23:04:24
Done.
|
| + static void RecordRequestDeviceFilters( |
|
Jeffrey Yasskin
2015/08/13 21:08:38
Maybe combine these three into a RecordRequestDevi
ortuno
2015/08/13 23:04:24
Done.
|
| + const std::vector<content::BluetoothScanFilter>& filters); |
| + static void RecordRequestDeviceOptionalServices( |
| + const std::vector<device::BluetoothUUID>& optional_services); |
| + static void RecordUnionOfServices( |
| + const std::vector<content::BluetoothScanFilter>& filters, |
| + const std::vector<device::BluetoothUUID>& optional_services); |
| + |
| + // connectGATT() |
| + enum class UMAConnectGATTOutcome { |
| + SUCCESS = 0, |
| + NO_DEVICE = 1, |
| + UNKNOWN = 2, |
| + IN_PROGRESS = 3, |
| + FAILED = 4, |
| + AUTH_FAILED = 5, |
| + AUTH_CANCELED = 6, |
| + AUTH_REJECTED = 7, |
| + AUTH_TIMEOUT = 8, |
| + UNSUPPORTED_DEVICE = 9, |
| + // Note: Add new ConnectGATT outcomes immediately above this line. Make sure |
| + // to update the enum list in tools/metrics/histograms/histograms.xml |
| + // accordingly. |
| + COUNT |
| + }; |
| + static void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome); |
| + static void RecordConnectGATTTimeSuccess(const base::TimeDelta& duration); |
| + static void RecordConnectGATTTimeFailed(const base::TimeDelta& duration); |
| + |
| + // getPrimaryService() |
| + enum class UMAGetPrimaryServiceOutcome { |
| + SUCCESS = 0, |
| + NO_DEVICE = 1, |
| + NOT_FOUND = 2, |
| + // Note: Add new GetPrimaryService outcomes immediately above this line. |
| + // Make sure to update the enum list in |
| + // tools/metrics/histograms/histograms.xml accordingly. |
| + COUNT |
| + }; |
| + static void RecordGetPrimaryServiceService( |
| + const device::BluetoothUUID& service); |
| + static void RecordGetPrimaryServiceOutcome( |
| + UMAGetPrimaryServiceOutcome outcome); |
| + |
| + // read/write characteristics |
| + // TODO(ortuno): For now we are just copying over the code to record these |
| + // errors but a follow up CL will add a function for each operation. |
| + |
| + // These types of errors aren't as common. We log them to understand |
| + // how common they are and if we need to investigate more. |
| + enum class UMAGATTError { |
| + UNKNOWN = 0, |
| + FAILED = 1, |
| + IN_PROGRESS = 2, |
| + NOT_PAIRED = 3, |
| + // Note: Add new GATT Errors immediately above this line. |
| + // Make sure to update the enum list in |
| + // tools/metrics/histograms/histograms.xml accordingly. |
| + MAX_ERROR, |
| + }; |
| + static void RecordGATTError(UMAGATTError error); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |