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

Unified Diff: chrome/installer/util/shell_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
« no previous file with comments | « chrome/installer/util/legacy_firewall_manager_win.cc ('k') | chrome/installer/util/wmi.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/shell_util.cc
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index f1ca375fae38baa06716b83c74c38b002e879492..fc2926246ef2540d1704dcc1ee233c8598f10185 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -10,6 +10,7 @@
#include "chrome/installer/util/shell_util.h"
#include <windows.h>
+#include <objbase.h>
#include <shlobj.h>
#include <shobjidl.h>
@@ -758,7 +759,8 @@ bool LaunchDefaultAppsSettingsModernDialog(const wchar_t* protocol) {
L"!microsoft.windows.immersivecontrolpanel";
base::win::ScopedComPtr<IApplicationActivationManager> activator;
- HRESULT hr = activator.CreateInstance(CLSID_ApplicationActivationManager);
+ HRESULT hr = ::CoCreateInstance(CLSID_ApplicationActivationManager, nullptr,
+ CLSCTX_ALL, IID_PPV_ARGS(&activator));
if (SUCCEEDED(hr)) {
DWORD pid = 0;
CoAllowSetForegroundWindow(activator.Get(), nullptr);
@@ -1048,8 +1050,9 @@ ShellUtil::DefaultState ProbeCurrentDefaultHandlers(
const wchar_t* const* protocols,
size_t num_protocols) {
base::win::ScopedComPtr<IApplicationAssociationRegistration> registration;
- HRESULT hr = registration.CreateInstance(
- CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC);
+ HRESULT hr =
+ ::CoCreateInstance(CLSID_ApplicationAssociationRegistration, NULL,
+ CLSCTX_INPROC, IID_PPV_ARGS(&registration));
if (FAILED(hr))
return ShellUtil::UNKNOWN_DEFAULT;
@@ -1074,8 +1077,9 @@ ShellUtil::DefaultState ProbeAppIsDefaultHandlers(
const wchar_t* const* protocols,
size_t num_protocols) {
base::win::ScopedComPtr<IApplicationAssociationRegistration> registration;
- HRESULT hr = registration.CreateInstance(
- CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC);
+ HRESULT hr =
+ ::CoCreateInstance(CLSID_ApplicationAssociationRegistration, NULL,
+ CLSCTX_INPROC, IID_PPV_ARGS(&registration));
if (FAILED(hr))
return ShellUtil::UNKNOWN_DEFAULT;
@@ -1877,8 +1881,8 @@ bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist,
// the IApplicationAssociationRegistration interface.
VLOG(1) << "Registering Chrome as default browser on Vista.";
base::win::ScopedComPtr<IApplicationAssociationRegistration> pAAR;
- HRESULT hr = pAAR.CreateInstance(CLSID_ApplicationAssociationRegistration,
- NULL, CLSCTX_INPROC);
+ HRESULT hr = ::CoCreateInstance(CLSID_ApplicationAssociationRegistration,
+ NULL, CLSCTX_INPROC, IID_PPV_ARGS(&pAAR));
if (SUCCEEDED(hr)) {
for (int i = 0; kBrowserProtocolAssociations[i] != NULL; i++) {
hr = pAAR->SetAppAsDefault(app_name.c_str(),
@@ -1984,8 +1988,8 @@ bool ShellUtil::MakeChromeDefaultProtocolClient(
VLOG(1) << "Registering Chrome as default handler for " << protocol
<< " on Vista.";
base::win::ScopedComPtr<IApplicationAssociationRegistration> pAAR;
- HRESULT hr = pAAR.CreateInstance(CLSID_ApplicationAssociationRegistration,
- NULL, CLSCTX_INPROC);
+ HRESULT hr = ::CoCreateInstance(CLSID_ApplicationAssociationRegistration,
+ NULL, CLSCTX_INPROC, IID_PPV_ARGS(&pAAR));
if (SUCCEEDED(hr)) {
base::string16 app_name = GetApplicationName(chrome_exe);
hr = pAAR->SetAppAsDefault(app_name.c_str(), protocol.c_str(),
« no previous file with comments | « chrome/installer/util/legacy_firewall_manager_win.cc ('k') | chrome/installer/util/wmi.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698