| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
| 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ | 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj
om.h" |
| 12 |
| 11 namespace base { | 13 namespace base { |
| 12 class TimeDelta; | 14 class TimeDelta; |
| 13 } | 15 } |
| 14 | 16 |
| 15 namespace device { | 17 namespace device { |
| 16 class BluetoothUUID; | 18 class BluetoothUUID; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace content { | 21 namespace content { |
| 20 struct BluetoothScanFilter; | 22 struct BluetoothScanFilter; |
| 21 | 23 |
| 22 // General Metrics | 24 // General Metrics |
| 23 | 25 |
| 24 // Enumaration of each Web Bluetooth API entry point. | 26 // Enumaration of each Web Bluetooth API entry point. |
| 25 enum class UMAWebBluetoothFunction { | 27 enum class UMAWebBluetoothFunction { |
| 26 REQUEST_DEVICE = 0, | 28 REQUEST_DEVICE = 0, |
| 27 CONNECT_GATT = 1, | 29 CONNECT_GATT = 1, |
| 28 GET_PRIMARY_SERVICE = 2, | 30 GET_PRIMARY_SERVICE = 2, |
| 29 GET_CHARACTERISTIC = 3, | 31 SERVICE_GET_CHARACTERISTIC = 3, |
| 30 CHARACTERISTIC_READ_VALUE = 4, | 32 CHARACTERISTIC_READ_VALUE = 4, |
| 31 CHARACTERISTIC_WRITE_VALUE = 5, | 33 CHARACTERISTIC_WRITE_VALUE = 5, |
| 32 CHARACTERISTIC_START_NOTIFICATIONS = 6, | 34 CHARACTERISTIC_START_NOTIFICATIONS = 6, |
| 33 CHARACTERISTIC_STOP_NOTIFICATIONS = 7, | 35 CHARACTERISTIC_STOP_NOTIFICATIONS = 7, |
| 34 REMOTE_GATT_SERVER_DISCONNECT = 8, | 36 REMOTE_GATT_SERVER_DISCONNECT = 8, |
| 35 SERVICE_GET_CHARACTERISTICS = 9, | 37 SERVICE_GET_CHARACTERISTICS = 9, |
| 36 // NOTE: Add new actions immediately above this line. Make sure to update | 38 // NOTE: Add new actions immediately above this line. Make sure to update |
| 37 // the enum list in tools/metrics/histograms/histograms.xml accordingly. | 39 // the enum list in tools/metrics/histograms/histograms.xml accordingly. |
| 38 COUNT | 40 COUNT |
| 39 }; | 41 }; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // Record the service uuid used when calling getPrimaryService. | 142 // Record the service uuid used when calling getPrimaryService. |
| 141 void RecordGetPrimaryServiceService(const device::BluetoothUUID& service); | 143 void RecordGetPrimaryServiceService(const device::BluetoothUUID& service); |
| 142 // There should be a call to this function for every call to | 144 // There should be a call to this function for every call to |
| 143 // Send(BluetoothMsg_GetPrimaryServiceSuccess) and | 145 // Send(BluetoothMsg_GetPrimaryServiceSuccess) and |
| 144 // Send(BluetoothMsg_GetPrimaryServiceError). | 146 // Send(BluetoothMsg_GetPrimaryServiceError). |
| 145 void RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome outcome); | 147 void RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome outcome); |
| 146 // Records the outcome of the cache query for getPrimaryService. Should only be | 148 // Records the outcome of the cache query for getPrimaryService. Should only be |
| 147 // called if QueryCacheForDevice fails. | 149 // called if QueryCacheForDevice fails. |
| 148 void RecordGetPrimaryServiceOutcome(CacheQueryOutcome outcome); | 150 void RecordGetPrimaryServiceOutcome(CacheQueryOutcome outcome); |
| 149 | 151 |
| 150 // getCharacteristic() Metrics | 152 // getCharacteristic() and getCharacteristics() Metrics |
| 151 enum class UMAGetCharacteristicOutcome { | 153 enum class UMAGetCharacteristicOutcome { |
| 152 SUCCESS = 0, | 154 SUCCESS = 0, |
| 153 NO_DEVICE = 1, | 155 NO_DEVICE = 1, |
| 154 NO_SERVICE = 2, | 156 NO_SERVICE = 2, |
| 155 NOT_FOUND = 3, | 157 NOT_FOUND = 3, |
| 156 BLACKLISTED = 4, | 158 BLACKLISTED = 4, |
| 157 NO_CHARACTERISTICS = 5, | 159 NO_CHARACTERISTICS = 5, |
| 158 // Note: Add new outcomes immediately above this line. | 160 // Note: Add new outcomes immediately above this line. |
| 159 // Make sure to update the enum list in | 161 // Make sure to update the enum list in |
| 160 // tools/metrisc/histogram/histograms.xml accordingly. | 162 // tools/metrisc/histogram/histograms.xml accordingly. |
| 161 COUNT | 163 COUNT |
| 162 }; | 164 }; |
| 163 // There should be a call to this function for every call to | |
| 164 // Send(BluetoothMsg_GetCharacteristicSuccess) and | |
| 165 // Send(BluetoothMsg_GetCharacteristicError). | |
| 166 void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome); | |
| 167 // Records the outcome of the cache query for getCharacteristic. Should only be | |
| 168 // called if QueryCacheForService fails. | |
| 169 void RecordGetCharacteristicOutcome(CacheQueryOutcome outcome); | |
| 170 // Records the UUID of the characteristic used when calling getCharacteristic. | |
| 171 void RecordGetCharacteristicCharacteristic(const std::string& characteristic); | |
| 172 | 165 |
| 173 // getCharacteristics() Metrics | 166 // There should be a call to this function whenever |
| 174 // There should be a call to this function for every call to | 167 // RemoteServiceGetCharacteristicsCallback is run. |
| 175 // Send(BluetoothMsg_GetCharacteristicsSuccess) and | 168 // Pass blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE for |
| 176 // Send(BluetoothMsg_GetCharacteristicsError). | 169 // getCharacteristic. |
| 177 void RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome outcome); | 170 // Pass blink::mojom::WebBluetoothGATTQueryQuantity::MULTIPLE for |
| 171 // getCharacteristics. |
| 172 void RecordGetCharacteristicsOutcome( |
| 173 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
| 174 UMAGetCharacteristicOutcome outcome); |
| 178 // Records the outcome of the cache query for getCharacteristics. Should only be | 175 // Records the outcome of the cache query for getCharacteristics. Should only be |
| 179 // called if QueryCacheForService fails. | 176 // called if QueryCacheForService fails. |
| 180 void RecordGetCharacteristicsOutcome(CacheQueryOutcome outcome); | 177 void RecordGetCharacteristicsOutcome( |
| 178 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
| 179 CacheQueryOutcome outcome); |
| 181 // Records the UUID of the characteristic used when calling getCharacteristic. | 180 // Records the UUID of the characteristic used when calling getCharacteristic. |
| 182 void RecordGetCharacteristicsCharacteristic(const std::string& characteristic); | 181 void RecordGetCharacteristicsCharacteristic( |
| 182 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
| 183 const std::string& characteristic); |
| 183 | 184 |
| 184 // GATT Operations Metrics | 185 // GATT Operations Metrics |
| 185 | 186 |
| 186 // These are the possible outcomes when performing GATT operations i.e. | 187 // These are the possible outcomes when performing GATT operations i.e. |
| 187 // characteristic.readValue/writeValue descriptor.readValue/writeValue. | 188 // characteristic.readValue/writeValue descriptor.readValue/writeValue. |
| 188 enum UMAGATTOperationOutcome { | 189 enum UMAGATTOperationOutcome { |
| 189 SUCCESS = 0, | 190 SUCCESS = 0, |
| 190 NO_DEVICE = 1, | 191 NO_DEVICE = 1, |
| 191 NO_SERVICE = 2, | 192 NO_SERVICE = 2, |
| 192 NO_CHARACTERISTIC = 3, | 193 NO_CHARACTERISTIC = 3, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // Send(BluetoothMsg_StartNotificationsSuccess) and | 244 // Send(BluetoothMsg_StartNotificationsSuccess) and |
| 244 // Send(BluetoothMsg_StopNotificationsError). | 245 // Send(BluetoothMsg_StopNotificationsError). |
| 245 void RecordStartNotificationsOutcome(UMAGATTOperationOutcome outcome); | 246 void RecordStartNotificationsOutcome(UMAGATTOperationOutcome outcome); |
| 246 // Records the outcome of a cache query for startNotifications. Should only be | 247 // Records the outcome of a cache query for startNotifications. Should only be |
| 247 // called if QueryCacheForCharacteristic fails. | 248 // called if QueryCacheForCharacteristic fails. |
| 248 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome); | 249 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome); |
| 249 | 250 |
| 250 } // namespace content | 251 } // namespace content |
| 251 | 252 |
| 252 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ | 253 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_METRICS_H_ |
| OLD | NEW |