| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import logging | 5 import logging |
| 6 import sys | 6 import sys |
| 7 | 7 |
| 8 from metrics import Metric | |
| 9 from telemetry.util.mac import keychain_helper | 8 from telemetry.util.mac import keychain_helper |
| 10 from telemetry.value import histogram_util | 9 from telemetry.value import histogram_util |
| 11 from telemetry.value import scalar | 10 from telemetry.value import scalar |
| 12 | 11 |
| 12 from metrics import Metric |
| 13 |
| 13 | 14 |
| 14 class KeychainMetric(Metric): | 15 class KeychainMetric(Metric): |
| 15 """KeychainMetric gathers keychain statistics from the browser object. | 16 """KeychainMetric gathers keychain statistics from the browser object. |
| 16 | 17 |
| 17 This includes the number of times that the keychain was accessed. | 18 This includes the number of times that the keychain was accessed. |
| 18 """ | 19 """ |
| 19 | 20 |
| 20 DISPLAY_NAME = 'OSX_Keychain_Access' | 21 DISPLAY_NAME = 'OSX_Keychain_Access' |
| 21 HISTOGRAM_NAME = 'OSX.Keychain.Access' | 22 HISTOGRAM_NAME = 'OSX.Keychain.Access' |
| 22 | 23 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 """Adds the number of times that the keychain was accessed to |results|. | 66 """Adds the number of times that the keychain was accessed to |results|. |
| 66 Has no effect on non-Mac platforms.""" | 67 Has no effect on non-Mac platforms.""" |
| 67 if sys.platform != 'darwin': | 68 if sys.platform != 'darwin': |
| 68 return | 69 return |
| 69 | 70 |
| 70 access_count = histogram_util.GetHistogramSum( | 71 access_count = histogram_util.GetHistogramSum( |
| 71 histogram_util.BROWSER_HISTOGRAM, KeychainMetric.HISTOGRAM_NAME, tab) | 72 histogram_util.BROWSER_HISTOGRAM, KeychainMetric.HISTOGRAM_NAME, tab) |
| 72 results.AddValue(scalar.ScalarValue( | 73 results.AddValue(scalar.ScalarValue( |
| 73 results.current_page, KeychainMetric.DISPLAY_NAME, 'count', | 74 results.current_page, KeychainMetric.DISPLAY_NAME, 'count', |
| 74 access_count)) | 75 access_count)) |
| OLD | NEW |