diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 19:13:13 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 19:13:13 +0000 |
commit | f71e72699d8535e85fc47c6c2b63f84f796bef71 (patch) | |
tree | b01d1d452ee5a460326a2cbfa642d876830d2120 /app | |
parent | 957b7b518251ba16abca74ff04e370564a826a74 (diff) | |
download | chromium_src-f71e72699d8535e85fc47c6c2b63f84f796bef71.zip chromium_src-f71e72699d8535e85fc47c6c2b63f84f796bef71.tar.gz chromium_src-f71e72699d8535e85fc47c6c2b63f84f796bef71.tar.bz2 |
Remove even more ATL dependencies.
Review URL: http://codereview.chromium.org/115309
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16088 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/os_exchange_data.h | 4 | ||||
-rw-r--r-- | app/os_exchange_data_win.cc | 2 | ||||
-rw-r--r-- | app/os_exchange_data_win_unittest.cc | 28 |
3 files changed, 14 insertions, 20 deletions
diff --git a/app/os_exchange_data.h b/app/os_exchange_data.h index 5fcb3d1..2400266 100644 --- a/app/os_exchange_data.h +++ b/app/os_exchange_data.h @@ -8,8 +8,8 @@ #include "build/build_config.h" #if defined(OS_WIN) -#include <atlbase.h> #include <objidl.h> +#include "base/scoped_comptr_win.h" #endif #include <string> @@ -154,7 +154,7 @@ class OSExchangeData { typedef std::vector<StoredDataInfo*> StoredData; StoredData contents_; - CComPtr<IDataObject> source_object_; + ScopedComPtr<IDataObject> source_object_; LONG ref_count_; #endif diff --git a/app/os_exchange_data_win.cc b/app/os_exchange_data_win.cc index c9e2311..e27c6fd 100644 --- a/app/os_exchange_data_win.cc +++ b/app/os_exchange_data_win.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <shlobj.h> - #include "app/os_exchange_data.h" #include "app/l10n_util.h" diff --git a/app/os_exchange_data_win_unittest.cc b/app/os_exchange_data_win_unittest.cc index 13a28a9..981a8d1 100644 --- a/app/os_exchange_data_win_unittest.cc +++ b/app/os_exchange_data_win_unittest.cc @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <atlbase.h> -#include <shlobj.h> - #include "app/os_exchange_data.h" #include "base/clipboard_util.h" #include "base/pickle.h" @@ -42,7 +39,7 @@ TEST(OSExchangeDataTest, StringDataAccessViaCOM) { OSExchangeData* data = new OSExchangeData; std::wstring input = L"O hai googlz."; data->SetString(input); - CComPtr<IDataObject> com_data(data); + ScopedComPtr<IDataObject> com_data(data); FORMATETC format_etc = { CF_UNICODETEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; @@ -54,8 +51,6 @@ TEST(OSExchangeDataTest, StringDataAccessViaCOM) { ScopedHGlobal<wchar_t>(medium.hGlobal).get(); EXPECT_EQ(input, output); ReleaseStgMedium(&medium); - - // data is freed automatically by CComPtr. } // Test setting using the IDataObject COM API @@ -63,7 +58,7 @@ TEST(OSExchangeDataTest, StringDataWritingViaCOM) { OSExchangeData* data = new OSExchangeData; std::wstring input = L"http://www.google.com/"; - CComPtr<IDataObject> com_data(data); + ScopedComPtr<IDataObject> com_data(data); // Store data in the object using the COM SetData API. CLIPFORMAT cfstr_ineturl = RegisterClipboardFormat(CFSTR_INETURL); @@ -98,7 +93,7 @@ TEST(OSExchangeDataTest, URLDataAccessViaCOM) { OSExchangeData* data = new OSExchangeData; GURL url("http://www.google.com/"); data->SetURL(url, L""); - CComPtr<IDataObject> com_data(data); + ScopedComPtr<IDataObject> com_data(data); CLIPFORMAT cfstr_ineturl = RegisterClipboardFormat(CFSTR_INETURL); FORMATETC format_etc = @@ -121,7 +116,7 @@ TEST(OSExchangeDataTest, MultipleFormatsViaCOM) { data->SetURL(url, L"Google"); data->SetString(text); - CComPtr<IDataObject> com_data(data); + ScopedComPtr<IDataObject> com_data(data); CLIPFORMAT cfstr_ineturl = RegisterClipboardFormat(CFSTR_INETURL); FORMATETC url_format_etc = @@ -156,9 +151,10 @@ TEST(OSExchangeDataTest, EnumerationViaCOM) { RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR); CLIPFORMAT text_x_moz_url = RegisterClipboardFormat(L"text/x-moz-url"); - CComPtr<IDataObject> com_data(data); - CComPtr<IEnumFORMATETC> enumerator; - EXPECT_EQ(S_OK, com_data->EnumFormatEtc(DATADIR_GET, &enumerator)); + ScopedComPtr<IDataObject> com_data(data); + ScopedComPtr<IEnumFORMATETC> enumerator; + EXPECT_EQ(S_OK, com_data.get()->EnumFormatEtc(DATADIR_GET, + enumerator.Receive())); // Test that we can get one item. { @@ -210,9 +206,9 @@ TEST(OSExchangeDataTest, EnumerationViaCOM) { { EXPECT_EQ(S_OK, enumerator->Reset()); EXPECT_EQ(S_OK, enumerator->Skip(1)); - CComPtr<IEnumFORMATETC> cloned_enumerator; - EXPECT_EQ(S_OK, enumerator->Clone(&cloned_enumerator)); - EXPECT_EQ(S_OK, enumerator->Reset()); + ScopedComPtr<IEnumFORMATETC> cloned_enumerator; + EXPECT_EQ(S_OK, enumerator.get()->Clone(cloned_enumerator.Receive())); + EXPECT_EQ(S_OK, enumerator.get()->Reset()); { ULONG retrieved = 0; @@ -257,7 +253,7 @@ TEST(OSExchangeDataTest, TestURLExchangeFormats) { EXPECT_EQ(url_spec, WideToUTF8(output_string)); // File contents access via COM - CComPtr<IDataObject> com_data(data); + ScopedComPtr<IDataObject> com_data(data); { CLIPFORMAT cfstr_file_contents = RegisterClipboardFormat(CFSTR_FILECONTENTS); |