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

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

Issue 2894483002: Migrate from ScopedComPtr::CreateInstance() to CoCreateInstance in chrome/... (Closed)
Patch Set: Fix Header Include Location Created 3 years, 7 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 #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 <objbase.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <wbemidl.h> 10 #include <wbemidl.h>
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 AntiVirusMetricsProvider::FillAntiVirusProductsFromWMI( 332 AntiVirusMetricsProvider::FillAntiVirusProductsFromWMI(
333 std::vector<AvProduct>* products) { 333 std::vector<AvProduct>* products) {
334 std::vector<AvProduct> result_list; 334 std::vector<AvProduct> result_list;
335 base::ThreadRestrictions::AssertIOAllowed(); 335 base::ThreadRestrictions::AssertIOAllowed();
336 base::win::ScopedCOMInitializer com_initializer; 336 base::win::ScopedCOMInitializer com_initializer;
337 337
338 if (!com_initializer.succeeded()) 338 if (!com_initializer.succeeded())
339 return RESULT_FAILED_TO_INITIALIZE_COM; 339 return RESULT_FAILED_TO_INITIALIZE_COM;
340 340
341 base::win::ScopedComPtr<IWbemLocator> wmi_locator; 341 base::win::ScopedComPtr<IWbemLocator> wmi_locator;
342 HRESULT hr = wmi_locator.CreateInstance(CLSID_WbemLocator, nullptr, 342 HRESULT hr =
343 CLSCTX_INPROC_SERVER); 343 ::CoCreateInstance(CLSID_WbemLocator, nullptr, CLSCTX_INPROC_SERVER,
344 IID_PPV_ARGS(&wmi_locator));
344 if (FAILED(hr)) 345 if (FAILED(hr))
345 return RESULT_FAILED_TO_CREATE_INSTANCE; 346 return RESULT_FAILED_TO_CREATE_INSTANCE;
346 347
347 base::win::ScopedComPtr<IWbemServices> wmi_services; 348 base::win::ScopedComPtr<IWbemServices> wmi_services;
348 hr = wmi_locator->ConnectServer( 349 hr = wmi_locator->ConnectServer(
349 base::win::ScopedBstr(L"ROOT\\SecurityCenter2"), nullptr, nullptr, 350 base::win::ScopedBstr(L"ROOT\\SecurityCenter2"), nullptr, nullptr,
350 nullptr, 0, nullptr, nullptr, wmi_services.GetAddressOf()); 351 nullptr, 0, nullptr, nullptr, wmi_services.GetAddressOf());
351 if (FAILED(hr)) 352 if (FAILED(hr))
352 return RESULT_FAILED_TO_CONNECT_TO_WMI; 353 return RESULT_FAILED_TO_CONNECT_TO_WMI;
353 354
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 std::string product_name("Trusteer Endpoint Protection"); 500 std::string product_name("Trusteer Endpoint Protection");
500 if (ShouldReportFullNames()) { 501 if (ShouldReportFullNames()) {
501 av_product.set_product_name(product_name); 502 av_product.set_product_name(product_name);
502 av_product.set_product_version(product_version); 503 av_product.set_product_version(product_version);
503 } 504 }
504 av_product.set_product_name_hash(metrics::HashName(product_name)); 505 av_product.set_product_name_hash(metrics::HashName(product_name));
505 av_product.set_product_version_hash(metrics::HashName(product_version)); 506 av_product.set_product_version_hash(metrics::HashName(product_version));
506 507
507 products->push_back(av_product); 508 products->push_back(av_product);
508 } 509 }
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/win/mtp_device_operations_util.cc ('k') | chrome/browser/prefs/incognito_mode_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698