| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_ | 5 #ifndef CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_ |
| 6 #define CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_ | 6 #define CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_ |
| 7 | 7 |
| 8 #include "components/metrics/metrics_provider.h" | 8 #include "components/metrics/metrics_provider.h" |
| 9 | 9 |
| 10 #include <iwscapi.h> | 10 #include <iwscapi.h> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 RESULT_GENERIC_FAILURE = 1, | 51 RESULT_GENERIC_FAILURE = 1, |
| 52 RESULT_FAILED_TO_INITIALIZE_COM = 2, | 52 RESULT_FAILED_TO_INITIALIZE_COM = 2, |
| 53 RESULT_FAILED_TO_CREATE_INSTANCE = 3, | 53 RESULT_FAILED_TO_CREATE_INSTANCE = 3, |
| 54 RESULT_FAILED_TO_INITIALIZE_PRODUCT_LIST = 4, | 54 RESULT_FAILED_TO_INITIALIZE_PRODUCT_LIST = 4, |
| 55 RESULT_FAILED_TO_GET_PRODUCT_COUNT = 5, | 55 RESULT_FAILED_TO_GET_PRODUCT_COUNT = 5, |
| 56 RESULT_FAILED_TO_GET_ITEM = 6, | 56 RESULT_FAILED_TO_GET_ITEM = 6, |
| 57 RESULT_FAILED_TO_GET_PRODUCT_STATE = 7, | 57 RESULT_FAILED_TO_GET_PRODUCT_STATE = 7, |
| 58 RESULT_PRODUCT_STATE_INVALID = 8, | 58 RESULT_PRODUCT_STATE_INVALID = 8, |
| 59 RESULT_FAILED_TO_GET_PRODUCT_NAME = 9, | 59 RESULT_FAILED_TO_GET_PRODUCT_NAME = 9, |
| 60 RESULT_FAILED_TO_GET_REMEDIATION_PATH = 10, | 60 RESULT_FAILED_TO_GET_REMEDIATION_PATH = 10, |
| 61 RESULT_FAILED_TO_CONNECT_TO_WMI = 11, | 61 RESULT_COUNT = 11 |
| 62 RESULT_FAILED_TO_SET_SECURITY_BLANKET = 12, | |
| 63 RESULT_FAILED_TO_EXEC_WMI_QUERY = 13, | |
| 64 RESULT_FAILED_TO_ITERATE_RESULTS = 14, | |
| 65 RESULT_COUNT = 15 | |
| 66 }; | 62 }; |
| 67 | 63 |
| 68 typedef metrics::SystemProfileProto::AntiVirusProduct AvProduct; | 64 typedef metrics::SystemProfileProto::AntiVirusProduct AvProduct; |
| 69 | 65 |
| 70 // Query COM interface IWSCProductList for installed AV products. This | 66 static ResultCode FillAntiVirusProducts(std::vector<AvProduct>* products); |
| 71 // interface is only available on Windows 8 and above. | |
| 72 static ResultCode FillAntiVirusProductsFromWSC( | |
| 73 std::vector<AvProduct>* products); | |
| 74 // Query WMI ROOT\SecurityCenter2 for installed AV products. This interface is | |
| 75 // only available on Windows Vista and above. | |
| 76 static ResultCode FillAntiVirusProductsFromWMI( | |
| 77 std::vector<AvProduct>* products); | |
| 78 static std::vector<AvProduct> GetAntiVirusProductsOnFileThread(); | 67 static std::vector<AvProduct> GetAntiVirusProductsOnFileThread(); |
| 79 | 68 |
| 80 // Called when metrics are done being gathered from the FILE thread. | 69 // Called when metrics are done being gathered from the FILE thread. |
| 81 // |done_callback| is the callback that should be called once all metrics are | 70 // |done_callback| is the callback that should be called once all metrics are |
| 82 // gathered. | 71 // gathered. |
| 83 void GotAntiVirusProducts(const base::Closure& done_callback, | 72 void GotAntiVirusProducts(const base::Closure& done_callback, |
| 84 const std::vector<AvProduct>& av_products); | 73 const std::vector<AvProduct>& av_products); |
| 85 | 74 |
| 86 // The TaskRunner on which file operations are performed (supplied by the | 75 // The TaskRunner on which file operations are performed (supplied by the |
| 87 // embedder). | 76 // embedder). |
| 88 scoped_refptr<base::TaskRunner> task_runner_; | 77 scoped_refptr<base::TaskRunner> task_runner_; |
| 89 | 78 |
| 90 // Information on installed AntiVirus gathered. | 79 // Information on installed AntiVirus gathered. |
| 91 std::vector<AvProduct> av_products_; | 80 std::vector<AvProduct> av_products_; |
| 92 | 81 |
| 93 base::ThreadChecker thread_checker_; | 82 base::ThreadChecker thread_checker_; |
| 94 base::WeakPtrFactory<AntiVirusMetricsProvider> weak_ptr_factory_; | 83 base::WeakPtrFactory<AntiVirusMetricsProvider> weak_ptr_factory_; |
| 95 | 84 |
| 96 FRIEND_TEST_ALL_PREFIXES(AntiVirusMetricsProviderTest, GetMetricsFullName); | |
| 97 | |
| 98 DISALLOW_COPY_AND_ASSIGN(AntiVirusMetricsProvider); | 85 DISALLOW_COPY_AND_ASSIGN(AntiVirusMetricsProvider); |
| 99 }; | 86 }; |
| 100 | 87 |
| 101 #endif // CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_ | 88 #endif // CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_ |
| OLD | NEW |