summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-02 13:03:18 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-02 13:03:18 +0000
commita61dba9411c218c80d8bfd07a9db1501244063d6 (patch)
treebaf55b536881a247df7d0631db7020afbf9b2d71
parent29dfddcb67be67a7729b2be43476234070dbe629 (diff)
downloadchromium_src-a61dba9411c218c80d8bfd07a9db1501244063d6.zip
chromium_src-a61dba9411c218c80d8bfd07a9db1501244063d6.tar.gz
chromium_src-a61dba9411c218c80d8bfd07a9db1501244063d6.tar.bz2
Remove 'using' declaration of ScopedHGlobal from scoped_handle_win.h
BUG=None TEST=trybots Review URL: http://codereview.chromium.org/6058007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70371 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--app/clipboard/clipboard_util_win.cc21
-rw-r--r--app/os_exchange_data_provider_win.cc7
-rw-r--r--app/os_exchange_data_win_unittest.cc15
-rw-r--r--base/scoped_handle_win.h1
-rw-r--r--printing/backend/print_backend_win.cc3
5 files changed, 24 insertions, 23 deletions
diff --git a/app/clipboard/clipboard_util_win.cc b/app/clipboard/clipboard_util_win.cc
index a775980..3554002 100644
--- a/app/clipboard/clipboard_util_win.cc
+++ b/app/clipboard/clipboard_util_win.cc
@@ -13,6 +13,7 @@
#include "base/scoped_handle.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "base/win/scoped_hglobal.h"
namespace {
@@ -72,7 +73,7 @@ bool GetFileUrl(IDataObject* data_object, std::wstring* url,
bool success = false;
{
// filename using unicode
- ScopedHGlobal<wchar_t> data(store.hGlobal);
+ base::win::ScopedHGlobal<wchar_t> data(store.hGlobal);
if (data.get() && data.get()[0] &&
(PathFileExists(data.get()) || PathIsUNC(data.get()))) {
wchar_t file_url[INTERNET_MAX_URL_LENGTH];
@@ -95,7 +96,7 @@ bool GetFileUrl(IDataObject* data_object, std::wstring* url,
bool success = false;
{
// filename using ascii
- ScopedHGlobal<char> data(store.hGlobal);
+ base::win::ScopedHGlobal<char> data(store.hGlobal);
if (data.get() && data.get()[0] && (PathFileExistsA(data.get()) ||
PathIsUNCA(data.get()))) {
char file_url[INTERNET_MAX_URL_LENGTH];
@@ -247,7 +248,7 @@ bool ClipboardUtil::GetUrl(IDataObject* data_object,
SUCCEEDED(data_object->GetData(GetUrlWFormat(), &store))) {
{
// Mozilla URL format or unicode URL
- ScopedHGlobal<wchar_t> data(store.hGlobal);
+ base::win::ScopedHGlobal<wchar_t> data(store.hGlobal);
SplitUrlAndTitle(data.get(), url, title);
}
ReleaseStgMedium(&store);
@@ -257,7 +258,7 @@ bool ClipboardUtil::GetUrl(IDataObject* data_object,
if (SUCCEEDED(data_object->GetData(GetUrlFormat(), &store))) {
{
// URL using ascii
- ScopedHGlobal<char> data(store.hGlobal);
+ base::win::ScopedHGlobal<char> data(store.hGlobal);
SplitUrlAndTitle(UTF8ToWide(data.get()), url, title);
}
ReleaseStgMedium(&store);
@@ -311,7 +312,7 @@ bool ClipboardUtil::GetPlainText(IDataObject* data_object,
if (SUCCEEDED(data_object->GetData(GetPlainTextWFormat(), &store))) {
{
// Unicode text
- ScopedHGlobal<wchar_t> data(store.hGlobal);
+ base::win::ScopedHGlobal<wchar_t> data(store.hGlobal);
plain_text->assign(data.get());
}
ReleaseStgMedium(&store);
@@ -321,7 +322,7 @@ bool ClipboardUtil::GetPlainText(IDataObject* data_object,
if (SUCCEEDED(data_object->GetData(GetPlainTextFormat(), &store))) {
{
// ascii text
- ScopedHGlobal<char> data(store.hGlobal);
+ base::win::ScopedHGlobal<char> data(store.hGlobal);
plain_text->assign(UTF8ToWide(data.get()));
}
ReleaseStgMedium(&store);
@@ -343,7 +344,7 @@ bool ClipboardUtil::GetHtml(IDataObject* data_object,
SUCCEEDED(data_object->GetData(GetHtmlFormat(), &store))) {
{
// MS CF html
- ScopedHGlobal<char> data(store.hGlobal);
+ base::win::ScopedHGlobal<char> data(store.hGlobal);
std::string html_utf8;
CFHtmlToHtml(std::string(data.get(), data.Size()), &html_utf8, base_url);
@@ -361,7 +362,7 @@ bool ClipboardUtil::GetHtml(IDataObject* data_object,
{
// text/html
- ScopedHGlobal<wchar_t> data(store.hGlobal);
+ base::win::ScopedHGlobal<wchar_t> data(store.hGlobal);
html->assign(data.get());
}
ReleaseStgMedium(&store);
@@ -380,7 +381,7 @@ bool ClipboardUtil::GetFileContents(IDataObject* data_object,
// |data_object|.
if (SUCCEEDED(data_object->GetData(GetFileContentFormatZero(), &content))) {
if (TYMED_HGLOBAL == content.tymed) {
- ScopedHGlobal<char> data(content.hGlobal);
+ base::win::ScopedHGlobal<char> data(content.hGlobal);
file_contents->assign(data.get(), data.Size());
}
ReleaseStgMedium(&content);
@@ -390,7 +391,7 @@ bool ClipboardUtil::GetFileContents(IDataObject* data_object,
if (SUCCEEDED(data_object->GetData(GetFileDescriptorFormat(),
&description))) {
{
- ScopedHGlobal<FILEGROUPDESCRIPTOR> fgd(description.hGlobal);
+ base::win::ScopedHGlobal<FILEGROUPDESCRIPTOR> fgd(description.hGlobal);
// We expect there to be at least one file in here.
DCHECK_GE(fgd->cItems, 1u);
filename->assign(fgd->fgd[0].cFileName);
diff --git a/app/os_exchange_data_provider_win.cc b/app/os_exchange_data_provider_win.cc
index 21136c8..032380a 100644
--- a/app/os_exchange_data_provider_win.cc
+++ b/app/os_exchange_data_provider_win.cc
@@ -13,6 +13,7 @@
#include "base/scoped_handle.h"
#include "base/stl_util-inl.h"
#include "base/utf_string_conversions.h"
+#include "base/win/scoped_hglobal.h"
#include "googleurl/src/gurl.h"
#include "grit/app_strings.h"
#include "net/base/net_util.h"
@@ -400,7 +401,7 @@ bool OSExchangeDataProviderWin::GetPickledData(CLIPFORMAT format,
STGMEDIUM medium;
if (SUCCEEDED(source_object_->GetData(&format_etc, &medium))) {
if (medium.tymed & TYMED_HGLOBAL) {
- ScopedHGlobal<char> c_data(medium.hGlobal);
+ base::win::ScopedHGlobal<char> c_data(medium.hGlobal);
DCHECK(c_data.Size() > 0);
// Need to subtract 1 as SetPickledData adds an extra byte to the end.
*data = Pickle(c_data.get(), static_cast<int>(c_data.Size() - 1));
@@ -787,7 +788,7 @@ ULONG DataObjectImpl::Release() {
static STGMEDIUM* GetStorageForBytes(const char* data, size_t bytes) {
HANDLE handle = GlobalAlloc(GPTR, static_cast<int>(bytes));
- ScopedHGlobal<char> scoped(handle);
+ base::win::ScopedHGlobal<char> scoped(handle);
size_t allocated = static_cast<size_t>(GlobalSize(handle));
memcpy(scoped.get(), data, allocated);
@@ -864,7 +865,7 @@ static STGMEDIUM* GetStorageForFileName(const std::wstring& full_path) {
kDropSize + (full_path.length() + 2) * sizeof(wchar_t);
HANDLE hdata = GlobalAlloc(GMEM_MOVEABLE, kTotalBytes);
- ScopedHGlobal<DROPFILES> locked_mem(hdata);
+ base::win::ScopedHGlobal<DROPFILES> locked_mem(hdata);
DROPFILES* drop_files = locked_mem.get();
drop_files->pFiles = sizeof(DROPFILES);
drop_files->fWide = TRUE;
diff --git a/app/os_exchange_data_win_unittest.cc b/app/os_exchange_data_win_unittest.cc
index cebf641..e76a52b 100644
--- a/app/os_exchange_data_win_unittest.cc
+++ b/app/os_exchange_data_win_unittest.cc
@@ -10,6 +10,7 @@
#include "base/scoped_handle.h"
#include "base/scoped_ptr.h"
#include "base/utf_string_conversions.h"
+#include "base/win/scoped_hglobal.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -57,7 +58,7 @@ TEST(OSExchangeDataTest, StringDataAccessViaCOM) {
STGMEDIUM medium;
EXPECT_EQ(S_OK, com_data->GetData(&format_etc, &medium));
std::wstring output =
- ScopedHGlobal<wchar_t>(medium.hGlobal).get();
+ base::win::ScopedHGlobal<wchar_t>(medium.hGlobal).get();
EXPECT_EQ(input, output);
ReleaseStgMedium(&medium);
}
@@ -79,7 +80,7 @@ TEST(OSExchangeDataTest, StringDataWritingViaCOM) {
HGLOBAL glob = GlobalAlloc(GPTR, sizeof(wchar_t) * (input.size() + 1));
size_t stringsz = input.size();
SIZE_T sz = GlobalSize(glob);
- ScopedHGlobal<wchar_t> global_lock(glob);
+ base::win::ScopedHGlobal<wchar_t> global_lock(glob);
wchar_t* buffer_handle = global_lock.get();
wcscpy_s(buffer_handle, input.size() + 1, input.c_str());
medium.hGlobal = glob;
@@ -112,7 +113,7 @@ TEST(OSExchangeDataTest, URLDataAccessViaCOM) {
STGMEDIUM medium;
EXPECT_EQ(S_OK, com_data->GetData(&format_etc, &medium));
std::wstring output =
- ScopedHGlobal<wchar_t>(medium.hGlobal).get();
+ base::win::ScopedHGlobal<wchar_t>(medium.hGlobal).get();
EXPECT_EQ(url.spec(), WideToUTF8(output));
ReleaseStgMedium(&medium);
}
@@ -139,7 +140,7 @@ TEST(OSExchangeDataTest, MultipleFormatsViaCOM) {
STGMEDIUM medium;
EXPECT_EQ(S_OK, com_data->GetData(&url_format_etc, &medium));
std::wstring output_url =
- ScopedHGlobal<wchar_t>(medium.hGlobal).get();
+ base::win::ScopedHGlobal<wchar_t>(medium.hGlobal).get();
EXPECT_EQ(url.spec(), WideToUTF8(output_url));
ReleaseStgMedium(&medium);
@@ -147,7 +148,7 @@ TEST(OSExchangeDataTest, MultipleFormatsViaCOM) {
// |text|! This is because the URL is added first and thus takes precedence!
EXPECT_EQ(S_OK, com_data->GetData(&text_format_etc, &medium));
std::wstring output_text =
- ScopedHGlobal<wchar_t>(medium.hGlobal).get();
+ base::win::ScopedHGlobal<wchar_t>(medium.hGlobal).get();
EXPECT_EQ(url_spec, WideToUTF8(output_text));
ReleaseStgMedium(&medium);
}
@@ -275,7 +276,7 @@ TEST(OSExchangeDataTest, TestURLExchangeFormats) {
STGMEDIUM medium;
EXPECT_EQ(S_OK, com_data->GetData(&format_etc, &medium));
- ScopedHGlobal<char> glob(medium.hGlobal);
+ base::win::ScopedHGlobal<char> glob(medium.hGlobal);
std::string output(glob.get(), glob.Size());
std::string file_contents = "[InternetShortcut]\r\nURL=";
file_contents += url_spec;
@@ -347,7 +348,7 @@ TEST(OSExchangeDataTest, Html) {
IDataObject* data_object = OSExchangeDataProviderWin::GetIDataObject(data);
EXPECT_EQ(S_OK,
data_object->GetData(ClipboardUtil::GetHtmlFormat(), &medium));
- ScopedHGlobal<char> glob(medium.hGlobal);
+ base::win::ScopedHGlobal<char> glob(medium.hGlobal);
std::string output(glob.get(), glob.Size());
EXPECT_EQ(expected_cf_html, output);
ReleaseStgMedium(&medium);
diff --git a/base/scoped_handle_win.h b/base/scoped_handle_win.h
index 8ec4862..8060f6c 100644
--- a/base/scoped_handle_win.h
+++ b/base/scoped_handle_win.h
@@ -12,4 +12,3 @@
using base::win::ScopedBitmap;
using base::win::ScopedHandle;
-using base::win::ScopedHGlobal;
diff --git a/printing/backend/print_backend_win.cc b/printing/backend/print_backend_win.cc
index 909904b..ba71da0 100644
--- a/printing/backend/print_backend_win.cc
+++ b/printing/backend/print_backend_win.cc
@@ -18,7 +18,6 @@
using base::win::ScopedBstr;
using base::win::ScopedComPtr;
-using base::win::ScopedHGlobal;
namespace {
@@ -29,7 +28,7 @@ HRESULT StreamOnHGlobalToString(IStream* stream, std::string* out) {
HRESULT hr = GetHGlobalFromStream(stream, &hdata);
if (SUCCEEDED(hr)) {
DCHECK(hdata);
- ScopedHGlobal<char> locked_data(hdata);
+ base::win::ScopedHGlobal<char> locked_data(hdata);
out->assign(locked_data.release(), locked_data.Size());
}
return hr;