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

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

Issue 2132693002: Merge M53: Add support for obtaining AV products on Win7. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/metrics/antivirus_metrics_provider_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_WSC_NOT_AVAILABLE = 15,
66 RESULT_COUNT = 16
62 }; 67 };
63 68
64 typedef metrics::SystemProfileProto::AntiVirusProduct AvProduct; 69 typedef metrics::SystemProfileProto::AntiVirusProduct AvProduct;
65 70
66 static ResultCode FillAntiVirusProducts(std::vector<AvProduct>* products); 71 // Query COM interface IWSCProductList for installed AV products. This
72 // interface is only available on Windows 8 and above.
73 static ResultCode FillAntiVirusProductsFromWSC(
74 std::vector<AvProduct>* products);
75 // Query WMI ROOT\SecurityCenter2 for installed AV products. This interface is
76 // only available on Windows Vista and above.
77 static ResultCode FillAntiVirusProductsFromWMI(
78 std::vector<AvProduct>* products);
67 static std::vector<AvProduct> GetAntiVirusProductsOnFileThread(); 79 static std::vector<AvProduct> GetAntiVirusProductsOnFileThread();
68 80
69 // Called when metrics are done being gathered from the FILE thread. 81 // 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 82 // |done_callback| is the callback that should be called once all metrics are
71 // gathered. 83 // gathered.
72 void GotAntiVirusProducts(const base::Closure& done_callback, 84 void GotAntiVirusProducts(const base::Closure& done_callback,
73 const std::vector<AvProduct>& av_products); 85 const std::vector<AvProduct>& av_products);
74 86
75 // The TaskRunner on which file operations are performed (supplied by the 87 // The TaskRunner on which file operations are performed (supplied by the
76 // embedder). 88 // embedder).
77 scoped_refptr<base::TaskRunner> task_runner_; 89 scoped_refptr<base::TaskRunner> task_runner_;
78 90
79 // Information on installed AntiVirus gathered. 91 // Information on installed AntiVirus gathered.
80 std::vector<AvProduct> av_products_; 92 std::vector<AvProduct> av_products_;
81 93
82 base::ThreadChecker thread_checker_; 94 base::ThreadChecker thread_checker_;
83 base::WeakPtrFactory<AntiVirusMetricsProvider> weak_ptr_factory_; 95 base::WeakPtrFactory<AntiVirusMetricsProvider> weak_ptr_factory_;
84 96
97 FRIEND_TEST_ALL_PREFIXES(AntiVirusMetricsProviderTest, GetMetricsFullName);
98
85 DISALLOW_COPY_AND_ASSIGN(AntiVirusMetricsProvider); 99 DISALLOW_COPY_AND_ASSIGN(AntiVirusMetricsProvider);
86 }; 100 };
87 101
88 #endif // CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_ 102 #endif // CHROME_BROWSER_METRICS_ANTIVIRUS_METRICS_PROVIDER_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/antivirus_metrics_provider_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698