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

Unified Diff: chrome/browser/media_galleries/win/mtp_device_operations_util.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media_galleries/win/mtp_device_operations_util.cc
diff --git a/chrome/browser/media_galleries/win/mtp_device_operations_util.cc b/chrome/browser/media_galleries/win/mtp_device_operations_util.cc
index 893a64609d7d7cc545a041a40ab740ef044bd7c9..ec3ceefc2c6eed6006e27e32452ce7c04392724d 100644
--- a/chrome/browser/media_galleries/win/mtp_device_operations_util.cc
+++ b/chrome/browser/media_galleries/win/mtp_device_operations_util.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/media_galleries/win/mtp_device_operations_util.h"
+#include <objbase.h>
#include <portabledevice.h>
#include <stdint.h>
@@ -33,8 +34,9 @@ bool GetClientInformation(
base::win::ScopedComPtr<IPortableDeviceValues>* client_info) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(client_info);
- HRESULT hr = client_info->CreateInstance(__uuidof(PortableDeviceValues),
- NULL, CLSCTX_INPROC_SERVER);
+ HRESULT hr = ::CoCreateInstance(__uuidof(PortableDeviceValues), NULL,
+ CLSCTX_INPROC_SERVER,
+ IID_PPV_ARGS(client_info->GetAddressOf()));
if (FAILED(hr)) {
DPLOG(ERROR) << "Failed to create an instance of IPortableDeviceValues";
return false;
@@ -191,9 +193,9 @@ bool GetObjectDetails(IPortableDevice* device,
return false;
base::win::ScopedComPtr<IPortableDeviceKeyCollection> properties_to_read;
- hr = properties_to_read.CreateInstance(__uuidof(PortableDeviceKeyCollection),
- NULL,
- CLSCTX_INPROC_SERVER);
+ hr = ::CoCreateInstance(__uuidof(PortableDeviceKeyCollection), NULL,
+ CLSCTX_INPROC_SERVER,
+ IID_PPV_ARGS(&properties_to_read));
if (FAILED(hr))
return false;
@@ -310,8 +312,8 @@ base::win::ScopedComPtr<IPortableDevice> OpenDevice(
if (!GetClientInformation(&client_info))
return base::win::ScopedComPtr<IPortableDevice>();
base::win::ScopedComPtr<IPortableDevice> device;
- HRESULT hr = device.CreateInstance(__uuidof(PortableDevice), NULL,
- CLSCTX_INPROC_SERVER);
+ HRESULT hr = ::CoCreateInstance(__uuidof(PortableDevice), NULL,
+ CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&device));
if (FAILED(hr))
return base::win::ScopedComPtr<IPortableDevice>();

Powered by Google App Engine
This is Rietveld 408576698