summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-04 20:04:07 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-04 20:04:07 +0000
commit530f43f302f1eef9d3530767015891f1db1f1272 (patch)
tree2006b20ca4022116b5d8c04784cec8802fb4d262
parent0b9158f07ac7c5ed1dc1c166e4a1513d6fbbb9e9 (diff)
downloadchromium_src-530f43f302f1eef9d3530767015891f1db1f1272.zip
chromium_src-530f43f302f1eef9d3530767015891f1db1f1272.tar.gz
chromium_src-530f43f302f1eef9d3530767015891f1db1f1272.tar.bz2
Use ScopedComPtr instead of CComPtr to reduce a dependency on ATL.
BUG=5027 TEST=none Review URL: http://codereview.chromium.org/201012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25498 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/autocomplete_accessibility.cc4
-rw-r--r--chrome/browser/autocomplete/autocomplete_accessibility.h3
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc17
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.h5
-rw-r--r--chrome/browser/browser_accessibility_manager.cc3
-rw-r--r--chrome/browser/first_run_win.cc5
-rw-r--r--chrome/browser/google_update.cc15
-rw-r--r--chrome/browser/importer/ie_importer.cc30
-rw-r--r--chrome/browser/importer/importer_unittest.cc27
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc3
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.h3
-rw-r--r--chrome/browser/views/shell_dialogs_win.cc8
-rw-r--r--chrome/common/platform_util_win.cc7
-rw-r--r--chrome/common/win_safe_util.cc6
14 files changed, 71 insertions, 65 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_accessibility.cc b/chrome/browser/autocomplete/autocomplete_accessibility.cc
index 4583ab5..5a9c3c6 100644
--- a/chrome/browser/autocomplete/autocomplete_accessibility.cc
+++ b/chrome/browser/autocomplete/autocomplete_accessibility.cc
@@ -21,8 +21,8 @@ HRESULT AutocompleteAccessibility::Initialize(
// Create a default accessible object for this instance.
return CreateStdAccessibleObject(edit_box_->m_hWnd, OBJID_CLIENT,
- IID_IAccessible, reinterpret_cast<void **>
- (&default_accessibility_server_));
+ IID_IAccessible,
+ reinterpret_cast<void **>(default_accessibility_server_.Receive()));
}
STDMETHODIMP AutocompleteAccessibility::get_accChildCount(LONG* child_count) {
diff --git a/chrome/browser/autocomplete/autocomplete_accessibility.h b/chrome/browser/autocomplete/autocomplete_accessibility.h
index 8671c1f..48b938d 100644
--- a/chrome/browser/autocomplete/autocomplete_accessibility.h
+++ b/chrome/browser/autocomplete/autocomplete_accessibility.h
@@ -10,6 +10,7 @@
#include <oleacc.h>
#include "base/basictypes.h"
+#include "base/scoped_comptr_win.h"
class AutocompleteEditViewWin;
@@ -103,7 +104,7 @@ class ATL_NO_VTABLE AutocompleteAccessibility
// A pointer containing the Windows' default IAccessible implementation for
// this object. Used where it is acceptable to return default MSAA
// information.
- CComPtr<IAccessible> default_accessibility_server_;
+ ScopedComPtr<IAccessible> default_accessibility_server_;
private:
const AutocompleteEditViewWin* edit_box_;
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 329e4dd..5fe2ba0 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -713,7 +713,7 @@ IAccessible* AutocompleteEditViewWin::GetIAccessible() {
return NULL;
// Wrap the created object in a smart pointer so it won't leak.
- CComPtr<IAccessible> accessibility_comptr(accessibility);
+ ScopedComPtr<IAccessible> accessibility_comptr(accessibility);
if (!SUCCEEDED(accessibility->Initialize(this)))
return NULL;
@@ -1222,7 +1222,7 @@ LRESULT AutocompleteEditViewWin::OnGetObject(UINT uMsg,
if (autocomplete_accessibility_) {
return LresultFromObject(IID_IAccessible, wparam,
- autocomplete_accessibility_.p);
+ autocomplete_accessibility_);
}
}
return 0;
@@ -1878,8 +1878,8 @@ void AutocompleteEditViewWin::GetSelection(CHARRANGE& sel) const {
ITextDocument* const text_object_model = GetTextObjectModel();
if (!text_object_model)
return;
- CComPtr<ITextSelection> selection;
- const HRESULT hr = text_object_model->GetSelection(&selection);
+ ScopedComPtr<ITextSelection> selection;
+ const HRESULT hr = text_object_model->GetSelection(selection.Receive());
DCHECK(hr == S_OK);
long flags;
selection->GetFlags(&flags);
@@ -1908,8 +1908,8 @@ void AutocompleteEditViewWin::SetSelection(LONG start, LONG end) {
ITextDocument* const text_object_model = GetTextObjectModel();
if (!text_object_model)
return;
- CComPtr<ITextSelection> selection;
- const HRESULT hr = text_object_model->GetSelection(&selection);
+ ScopedComPtr<ITextSelection> selection;
+ const HRESULT hr = text_object_model->GetSelection(selection.Receive());
DCHECK(hr == S_OK);
selection->SetFlags(tomSelStartActive);
}
@@ -2220,9 +2220,10 @@ ITextDocument* AutocompleteEditViewWin::GetTextObjectModel() const {
if (!text_object_model_) {
// This is lazily initialized, instead of being initialized in the
// constructor, in order to avoid hurting startup performance.
- CComPtr<IRichEditOle> ole_interface;
+ ScopedComPtr<IRichEditOle, NULL> ole_interface;
ole_interface.Attach(GetOleInterface());
- text_object_model_ = ole_interface;
+ if (ole_interface)
+ text_object_model_.QueryFrom(ole_interface);
}
return text_object_model_;
}
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.h b/chrome/browser/autocomplete/autocomplete_edit_view_win.h
index 9f5dc95..2f64f84 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.h
@@ -13,6 +13,7 @@
#include <tom.h> // For ITextDocument, a COM interface to CRichEditCtrl.
#include "app/gfx/font.h"
+#include "base/scoped_comptr_win.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
@@ -474,14 +475,14 @@ class AutocompleteEditViewWin
ToolbarModel::SecurityLevel scheme_security_level_;
// This interface is useful for accessing the CRichEditCtrl at a low level.
- mutable CComQIPtr<ITextDocument> text_object_model_;
+ mutable ScopedComPtr<ITextDocument> text_object_model_;
// This contains the scheme char start and stop indexes that should be
// striken-out when displaying an insecure scheme.
url_parse::Component insecure_scheme_component_;
// Instance of accessibility information and handling.
- mutable CComPtr<IAccessible> autocomplete_accessibility_;
+ mutable ScopedComPtr<IAccessible> autocomplete_accessibility_;
DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewWin);
};
diff --git a/chrome/browser/browser_accessibility_manager.cc b/chrome/browser/browser_accessibility_manager.cc
index f710629..ccbf5b8 100644
--- a/chrome/browser/browser_accessibility_manager.cc
+++ b/chrome/browser/browser_accessibility_manager.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/browser_accessibility_manager.h"
+#include "base/scoped_comptr_win.h"
#include "chrome/browser/browser_accessibility.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -43,7 +44,7 @@ STDMETHODIMP BrowserAccessibilityManager::CreateAccessibilityInstance(
if (!instance)
return E_FAIL;
- CComPtr<IAccessible> accessibility_instance(instance);
+ ScopedComPtr<IAccessible> accessibility_instance(instance);
// Set class member variables.
instance->Initialize(acc_obj_id, routing_id, process_id, parent_hwnd);
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index 6ee44d6..6a9c534 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -23,6 +23,7 @@
#include "base/process.h"
#include "base/process_util.h"
#include "base/registry.h"
+#include "base/scoped_comptr_win.h"
#include "base/string_util.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -93,8 +94,8 @@ FilePath GetDefaultPrefFilePath(bool create_profile_dir,
}
bool InvokeGoogleUpdateForRename() {
- CComPtr<IProcessLauncher> ipl;
- if (!FAILED(ipl.CoCreateInstance(__uuidof(ProcessLauncherClass)))) {
+ ScopedComPtr<IProcessLauncher> ipl;
+ if (!FAILED(ipl.CreateInstance(__uuidof(ProcessLauncherClass)))) {
ULONG_PTR phandle = NULL;
DWORD id = GetCurrentProcessId();
if (!FAILED(ipl->LaunchCmdElevated(google_update::kChromeGuid,
diff --git a/chrome/browser/google_update.cc b/chrome/browser/google_update.cc
index 773c105..83b8c14 100644
--- a/chrome/browser/google_update.cc
+++ b/chrome/browser/google_update.cc
@@ -9,6 +9,7 @@
#include "base/message_loop.h"
#include "base/path_service.h"
+#include "base/scoped_comptr_win.h"
#include "base/string_util.h"
#include "base/task.h"
#include "base/thread.h"
@@ -192,7 +193,7 @@ class GoogleUpdateJobObserver
// Allows us control the upgrade process to a small degree. After OnComplete
// has been called, this object can not be used.
- CComPtr<IProgressWndEvents> event_sink_;
+ ScopedComPtr<IProgressWndEvents> event_sink_;
};
////////////////////////////////////////////////////////////////////////////////
@@ -259,18 +260,18 @@ bool GoogleUpdate::InitiateGoogleUpdateCheck(bool install_if_newer,
main_loop);
}
- CComPtr<IJobObserver> job_holder(job_observer);
+ ScopedComPtr<IJobObserver> job_holder(job_observer);
- CComPtr<IGoogleUpdate> on_demand;
+ ScopedComPtr<IGoogleUpdate> on_demand;
if (InstallUtil::IsPerUserInstall(chrome_exe_path.c_str())) {
- hr = on_demand.CoCreateInstance(CLSID_OnDemandUserAppsClass);
+ hr = on_demand.CreateInstance(CLSID_OnDemandUserAppsClass);
} else {
// The Update operation needs Admin privileges for writing
// to %ProgramFiles%. On Vista we need to elevate before instantiating
// the updater instance.
if (!install_if_newer) {
- hr = on_demand.CoCreateInstance(CLSID_OnDemandMachineAppsClass);
+ hr = on_demand.CreateInstance(CLSID_OnDemandMachineAppsClass);
} else {
HWND foreground_hwnd = NULL;
if (window != NULL) {
@@ -278,8 +279,8 @@ bool GoogleUpdate::InitiateGoogleUpdateCheck(bool install_if_newer,
}
hr = CoCreateInstanceAsAdmin(CLSID_OnDemandMachineAppsClass,
- IID_IGoogleUpdate, foreground_hwnd,
- reinterpret_cast<void**>(&on_demand));
+ IID_IGoogleUpdate, foreground_hwnd,
+ reinterpret_cast<void**>(on_demand.Receive()));
}
}
diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc
index ac345a7..1a0d86a 100644
--- a/chrome/browser/importer/ie_importer.cc
+++ b/chrome/browser/importer/ie_importer.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/importer/ie_importer.h"
-#include <atlbase.h>
#include <intshcut.h>
#include <pstore.h>
#include <shlobj.h>
@@ -17,6 +16,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/registry.h"
+#include "base/scoped_comptr_win.h"
#include "base/string_util.h"
#include "base/time.h"
#include "base/win_util.h"
@@ -142,8 +142,8 @@ void IEImporter::ImportPasswordsIE6() {
return;
}
- CComPtr<IPStore> pstore;
- HRESULT result = PStoreCreateInstance(&pstore, 0, 0, 0);
+ ScopedComPtr<IPStore, &IID_IPStore> pstore;
+ HRESULT result = PStoreCreateInstance(pstore.Receive(), 0, 0, 0);
if (result != S_OK) {
FreeLibrary(pstorec_dll);
return;
@@ -152,9 +152,9 @@ void IEImporter::ImportPasswordsIE6() {
std::vector<AutoCompleteInfo> ac_list;
// Enumerates AutoComplete items in the protected database.
- CComPtr<IEnumPStoreItems> item;
+ ScopedComPtr<IEnumPStoreItems, &IID_IEnumPStoreItems> item;
result = pstore->EnumItems(0, &AutocompleteGUID,
- &AutocompleteGUID, 0, &item);
+ &AutocompleteGUID, 0, item.Receive());
if (result != PST_E_OK) {
pstore.Release();
FreeLibrary(pstorec_dll);
@@ -282,14 +282,14 @@ void IEImporter::ImportHistory() {
chrome::kFileScheme};
int total_schemes = arraysize(kSchemes);
- CComPtr<IUrlHistoryStg2> url_history_stg2;
+ ScopedComPtr<IUrlHistoryStg2> url_history_stg2;
HRESULT result;
- result = url_history_stg2.CoCreateInstance(CLSID_CUrlHistory, NULL,
- CLSCTX_INPROC_SERVER);
+ result = url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL,
+ CLSCTX_INPROC_SERVER);
if (FAILED(result))
return;
- CComPtr<IEnumSTATURL> enum_url;
- if (SUCCEEDED(result = url_history_stg2->EnumUrls(&enum_url))) {
+ ScopedComPtr<IEnumSTATURL> enum_url;
+ if (SUCCEEDED(result = url_history_stg2->EnumUrls(enum_url.Receive()))) {
std::vector<history::URLRow> rows;
STATURL stat_url;
ULONG fetched;
@@ -541,14 +541,14 @@ void IEImporter::ParseFavoritesFolder(const FavoritesInfo& info,
std::wstring IEImporter::ResolveInternetShortcut(const std::wstring& file) {
win_util::CoMemReleaser<wchar_t> url;
- CComPtr<IUniformResourceLocator> url_locator;
- HRESULT result = url_locator.CoCreateInstance(CLSID_InternetShortcut, NULL,
- CLSCTX_INPROC_SERVER);
+ ScopedComPtr<IUniformResourceLocator> url_locator;
+ HRESULT result = url_locator.CreateInstance(CLSID_InternetShortcut, NULL,
+ CLSCTX_INPROC_SERVER);
if (FAILED(result))
return std::wstring();
- CComPtr<IPersistFile> persist_file;
- result = url_locator.QueryInterface(&persist_file);
+ ScopedComPtr<IPersistFile> persist_file;
+ result = persist_file.QueryFrom(url_locator);
if (FAILED(result))
return std::wstring();
diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc
index 6fb452f..20581a1 100644
--- a/chrome/browser/importer/importer_unittest.cc
+++ b/chrome/browser/importer/importer_unittest.cc
@@ -4,7 +4,6 @@
#include "testing/gtest/include/gtest/gtest.h"
-#include <atlbase.h>
#include <windows.h>
#include <unknwn.h>
#include <intshcut.h>
@@ -17,6 +16,7 @@
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/path_service.h"
+#include "base/scoped_comptr_win.h"
#include "base/stl_util-inl.h"
#include "chrome/browser/importer/ie_importer.h"
#include "chrome/browser/importer/importer.h"
@@ -258,14 +258,13 @@ class TestObserver : public ProfileWriter,
};
bool CreateUrlFile(std::wstring file, std::wstring url) {
- CComPtr<IUniformResourceLocator> locator;
- HRESULT result = locator.CoCreateInstance(CLSID_InternetShortcut, NULL,
- CLSCTX_INPROC_SERVER);
+ ScopedComPtr<IUniformResourceLocator> locator;
+ HRESULT result = locator.CreateInstance(CLSID_InternetShortcut, NULL,
+ CLSCTX_INPROC_SERVER);
if (FAILED(result))
return false;
- CComPtr<IPersistFile> persist_file;
- result = locator->QueryInterface(IID_IPersistFile,
- reinterpret_cast<void**>(&persist_file));
+ ScopedComPtr<IPersistFile> persist_file;
+ result = persist_file.QueryFrom(locator);
if (FAILED(result))
return false;
result = locator->SetURL(url.c_str(), 0);
@@ -278,8 +277,8 @@ bool CreateUrlFile(std::wstring file, std::wstring url) {
}
void ClearPStoreType(IPStore* pstore, const GUID* type, const GUID* subtype) {
- CComPtr<IEnumPStoreItems> item;
- HRESULT result = pstore->EnumItems(0, type, subtype, 0, &item);
+ ScopedComPtr<IEnumPStoreItems, NULL> item;
+ HRESULT result = pstore->EnumItems(0, type, subtype, 0, item.Receive());
if (result == PST_E_OK) {
wchar_t* item_name;
while (SUCCEEDED(item->Next(1, &item_name, 0))) {
@@ -347,7 +346,7 @@ TEST_F(ImporterTest, IEImporter) {
// Sets up dummy password data.
HRESULT res;
#if 0 // This part of the test is disabled. See bug #2466
- CComPtr<IPStore> pstore;
+ ScopedComPtr<IPStore> pstore;
HMODULE pstorec_dll;
GUID type = IEImporter::kUnittestGUID;
GUID subtype = IEImporter::kUnittestGUID;
@@ -357,7 +356,7 @@ TEST_F(ImporterTest, IEImporter) {
pstorec_dll = LoadLibrary(L"pstorec.dll");
PStoreCreateFunc PStoreCreateInstance =
(PStoreCreateFunc)GetProcAddress(pstorec_dll, "PStoreCreateInstance");
- res = PStoreCreateInstance(&pstore, 0, 0, 0);
+ res = PStoreCreateInstance(pstore.Receive(), 0, 0, 0);
ASSERT_TRUE(res == S_OK);
ClearPStoreType(pstore, &type, &subtype);
PST_TYPEINFO type_info;
@@ -370,9 +369,9 @@ TEST_F(ImporterTest, IEImporter) {
#endif
// Sets up a special history link.
- CComPtr<IUrlHistoryStg2> url_history_stg2;
- res = url_history_stg2.CoCreateInstance(CLSID_CUrlHistory, NULL,
- CLSCTX_INPROC_SERVER);
+ ScopedComPtr<IUrlHistoryStg2> url_history_stg2;
+ res = url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL,
+ CLSCTX_INPROC_SERVER);
ASSERT_TRUE(res == S_OK);
res = url_history_stg2->AddUrl(kIEIdentifyUrl, kIEIdentifyTitle, 0);
ASSERT_TRUE(res == S_OK);
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index 6838e08..bdcafe5 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -1221,7 +1221,8 @@ LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam,
IID_IAccessible, 1000,
render_widget_host_->routing_id(),
render_widget_host_->process()->id(),
- m_hWnd, reinterpret_cast<void **>(&browser_accessibility_root_));
+ m_hWnd,
+ reinterpret_cast<void **>(browser_accessibility_root_.Receive()));
if (!browser_accessibility_root_) {
// No valid root found, return with failure.
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h
index 5bfbd86..ae6be008 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.h
@@ -10,6 +10,7 @@
#include <atlcrack.h>
#include <atlmisc.h>
+#include "base/scoped_comptr_win.h"
#include "base/task.h"
#include "chrome/browser/ime_input.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
@@ -271,7 +272,7 @@ class RenderWidgetHostViewWin :
// Instance of accessibility information for the root of the MSAA
// tree representation of the WebKit render tree.
- CComPtr<IAccessible> browser_accessibility_root_;
+ ScopedComPtr<IAccessible> browser_accessibility_root_;
// The time at which this view started displaying white pixels as a result of
// not having anything to paint (empty backing store from renderer). This
diff --git a/chrome/browser/views/shell_dialogs_win.cc b/chrome/browser/views/shell_dialogs_win.cc
index df15034..5c5b1f9 100644
--- a/chrome/browser/views/shell_dialogs_win.cc
+++ b/chrome/browser/views/shell_dialogs_win.cc
@@ -7,7 +7,6 @@
#include <windows.h>
#include <commdlg.h>
#include <shlobj.h>
-#include <atlbase.h>
#include <algorithm>
#include <set>
@@ -17,6 +16,7 @@
#include "app/win_util.h"
#include "base/file_util.h"
#include "base/registry.h"
+#include "base/scoped_comptr_win.h"
#include "base/string_util.h"
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
@@ -453,10 +453,10 @@ bool SelectFileDialogImpl::RunSelectFolderDialog(const std::wstring& title,
STRRET out_dir_buffer;
ZeroMemory(&out_dir_buffer, sizeof(out_dir_buffer));
out_dir_buffer.uType = STRRET_WSTR;
- CComPtr<IShellFolder> shell_folder = NULL;
- if (SHGetDesktopFolder (&shell_folder) == NOERROR) {
+ ScopedComPtr<IShellFolder> shell_folder;
+ if (SHGetDesktopFolder(shell_folder.Receive()) == NOERROR) {
HRESULT hr = shell_folder->GetDisplayNameOf(list, SHGDN_FORPARSING,
- &out_dir_buffer);
+ &out_dir_buffer);
if (SUCCEEDED(hr) && out_dir_buffer.uType == STRRET_WSTR) {
*path = FilePath(out_dir_buffer.pOleStr);
CoTaskMemFree(out_dir_buffer.pOleStr);
diff --git a/chrome/common/platform_util_win.cc b/chrome/common/platform_util_win.cc
index b602388..68cc839 100644
--- a/chrome/common/platform_util_win.cc
+++ b/chrome/common/platform_util_win.cc
@@ -4,8 +4,6 @@
#include "chrome/common/platform_util.h"
-#include <atlbase.h>
-#include <atlapp.h>
#include <commdlg.h>
#include <dwmapi.h>
#include <shellapi.h>
@@ -17,6 +15,7 @@
#include "base/gfx/native_widget_types.h"
#include "base/logging.h"
#include "base/registry.h"
+#include "base/scoped_comptr_win.h"
#include "base/string_util.h"
#include "googleurl/src/gurl.h"
@@ -58,8 +57,8 @@ void ShowItemInFolder(const FilePath& full_path) {
return;
}
- CComPtr<IShellFolder> desktop;
- HRESULT hr = SHGetDesktopFolder(&desktop);
+ ScopedComPtr<IShellFolder> desktop;
+ HRESULT hr = SHGetDesktopFolder(desktop.Receive());
if (FAILED(hr))
return;
diff --git a/chrome/common/win_safe_util.cc b/chrome/common/win_safe_util.cc
index 53cc9b2..f215566 100644
--- a/chrome/common/win_safe_util.cc
+++ b/chrome/common/win_safe_util.cc
@@ -4,7 +4,6 @@
#include <shlobj.h>
#include <shobjidl.h>
-#include <atlcomcli.h>
#include "chrome/common/win_safe_util.h"
@@ -12,6 +11,7 @@
#include "base/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
+#include "base/scoped_comptr_win.h"
#include "base/string_util.h"
namespace win_util {
@@ -24,8 +24,8 @@ namespace win_util {
bool SaferOpenItemViaShell(HWND hwnd, const std::wstring& window_title,
const FilePath& full_path,
const std::wstring& source_url) {
- ATL::CComPtr<IAttachmentExecute> attachment_services;
- HRESULT hr = attachment_services.CoCreateInstance(CLSID_AttachmentServices);
+ ScopedComPtr<IAttachmentExecute> attachment_services;
+ HRESULT hr = attachment_services.CreateInstance(CLSID_AttachmentServices);
if (FAILED(hr)) {
// We don't have Attachment Execution Services, it must be a pre-XP.SP2
// Windows installation, or the thread does not have COM initialized.