Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: chrome/browser/metrics/antivirus_metrics_provider_win.h

Issue 2064313004: Add support for obtaining AV products on Win7. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_COUNT = 11 61 RESULT_FAILED_TO_CONNECT_TO_WMI = 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
62 }; 66 };
63 67
64 typedef metrics::SystemProfileProto::AntiVirusProduct AvProduct; 68 typedef metrics::SystemProfileProto::AntiVirusProduct AvProduct;
65 69
66 static ResultCode FillAntiVirusProducts(std::vector<AvProduct>* products); 70 // Query COM interface IWSCProductList for installed AV products. This
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);
67 static std::vector<AvProduct> GetAntiVirusProductsOnFileThread(); 78 static std::vector<AvProduct> GetAntiVirusProductsOnFileThread();
68 79
69 // Called when metrics are done being gathered from the FILE thread. 80 // Called when metrics are done being gathered from the FILE thread.
70 // |done_callback| is the callback that should be called once all metrics are 81 // |done_callback| is the callback that should be called once all metrics are
71 // gathered. 82 // gathered.
72 void GotAntiVirusProducts(const base::Closure& done_callback, 83 void GotAntiVirusProducts(const base::Closure& done_callback,
73 const std::vector<AvProduct>& av_products); 84 const std::vector<AvProduct>& av_products);
74 85
75 // The TaskRunner on which file operations are performed (supplied by the 86 // The TaskRunner on which file operations are performed (supplied by the
76 // embedder). 87 // embedder).
77 scoped_refptr<base::TaskRunner> task_runner_; 88 scoped_refptr<base::TaskRunner> task_runner_;
78 89
79 // Information on installed AntiVirus gathered. 90 // Information on installed AntiVirus gathered.
80 std::vector<AvProduct> av_products_; 91 std::vector<AvProduct> av_products_;
81 92
82 base::ThreadChecker thread_checker_; 93 base::ThreadChecker thread_checker_;
83 base::WeakPtrFactory<AntiVirusMetricsProvider> weak_ptr_factory_; 94 base::WeakPtrFactory<AntiVirusMetricsProvider> weak_ptr_factory_;
84 95
96 FRIEND_TEST_ALL_PREFIXES(AntiVirusMetricsProviderTest, GetMetricsFullName);
97
85 DISALLOW_COPY_AND_ASSIGN(AntiVirusMetricsProvider); 98 DISALLOW_COPY_AND_ASSIGN(AntiVirusMetricsProvider);
86 }; 99 };
87 100
88 #endif // CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_ 101 #endif // CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698