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 #include "chrome/browser/metrics/antivirus_metrics_provider_win.h" | 5 #include "chrome/browser/metrics/antivirus_metrics_provider_win.h" |
6 | 6 |
7 #include <iwscapi.h> | 7 #include <iwscapi.h> |
| 8 #include <objbase.h> |
8 #include <stddef.h> | 9 #include <stddef.h> |
9 #include <wbemidl.h> | 10 #include <wbemidl.h> |
10 #include <windows.h> | 11 #include <windows.h> |
11 #include <wscapi.h> | 12 #include <wscapi.h> |
12 | 13 |
13 #include <algorithm> | 14 #include <algorithm> |
14 #include <string> | 15 #include <string> |
15 | 16 |
16 #include "base/bind.h" | 17 #include "base/bind.h" |
17 #include "base/callback.h" | 18 #include "base/callback.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 std::vector<AvProduct> result_list; | 233 std::vector<AvProduct> result_list; |
233 base::ThreadRestrictions::AssertIOAllowed(); | 234 base::ThreadRestrictions::AssertIOAllowed(); |
234 base::win::ScopedCOMInitializer com_initializer; | 235 base::win::ScopedCOMInitializer com_initializer; |
235 | 236 |
236 if (!com_initializer.succeeded()) | 237 if (!com_initializer.succeeded()) |
237 return RESULT_FAILED_TO_INITIALIZE_COM; | 238 return RESULT_FAILED_TO_INITIALIZE_COM; |
238 | 239 |
239 base::win::ScopedComPtr<IWSCProductList> product_list; | 240 base::win::ScopedComPtr<IWSCProductList> product_list; |
240 HRESULT result = | 241 HRESULT result = |
241 CoCreateInstance(__uuidof(WSCProductList), nullptr, CLSCTX_INPROC_SERVER, | 242 CoCreateInstance(__uuidof(WSCProductList), nullptr, CLSCTX_INPROC_SERVER, |
242 __uuidof(IWSCProductList), product_list.ReceiveVoid()); | 243 IID_PPV_ARGS(&product_list)); |
243 if (FAILED(result)) | 244 if (FAILED(result)) |
244 return RESULT_FAILED_TO_CREATE_INSTANCE; | 245 return RESULT_FAILED_TO_CREATE_INSTANCE; |
245 | 246 |
246 result = product_list->Initialize(WSC_SECURITY_PROVIDER_ANTIVIRUS); | 247 result = product_list->Initialize(WSC_SECURITY_PROVIDER_ANTIVIRUS); |
247 if (FAILED(result)) | 248 if (FAILED(result)) |
248 return RESULT_FAILED_TO_INITIALIZE_PRODUCT_LIST; | 249 return RESULT_FAILED_TO_INITIALIZE_PRODUCT_LIST; |
249 | 250 |
250 LONG product_count; | 251 LONG product_count; |
251 result = product_list->get_Count(&product_count); | 252 result = product_list->get_Count(&product_count); |
252 if (FAILED(result)) | 253 if (FAILED(result)) |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 std::string product_name("Trusteer Endpoint Protection"); | 499 std::string product_name("Trusteer Endpoint Protection"); |
499 if (ShouldReportFullNames()) { | 500 if (ShouldReportFullNames()) { |
500 av_product.set_product_name(product_name); | 501 av_product.set_product_name(product_name); |
501 av_product.set_product_version(product_version); | 502 av_product.set_product_version(product_version); |
502 } | 503 } |
503 av_product.set_product_name_hash(metrics::HashName(product_name)); | 504 av_product.set_product_name_hash(metrics::HashName(product_name)); |
504 av_product.set_product_version_hash(metrics::HashName(product_version)); | 505 av_product.set_product_version_hash(metrics::HashName(product_version)); |
505 | 506 |
506 products->push_back(av_product); | 507 products->push_back(av_product); |
507 } | 508 } |
OLD | NEW |