Commit 461e1d7d authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[base] Prepare //ui for base::string16 switch

This change prepares several Windows-only sections of //ui for the
switch of base::string16 to std::u16string.

Bug: 911896
Change-Id: Ic4b707c19f0a53d4d11ff9b5cb1be0afacafd711
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2434343Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813508}
parent 75806b4e
...@@ -135,7 +135,7 @@ std::string ClipboardFormatType::GetName() const { ...@@ -135,7 +135,7 @@ std::string ClipboardFormatType::GetName() const {
return std::string(); return std::string();
} }
return base::UTF16ToUTF8(base::string16(name_buffer->data(), name_size)); return base::WideToUTF8(std::wstring(name_buffer->data(), name_size));
} }
bool ClipboardFormatType::operator<(const ClipboardFormatType& other) const { bool ClipboardFormatType::operator<(const ClipboardFormatType& other) const {
...@@ -157,7 +157,7 @@ ClipboardFormatType ClipboardFormatType::GetType( ...@@ -157,7 +157,7 @@ ClipboardFormatType ClipboardFormatType::GetType(
return ClipboardFormatType(it->second); return ClipboardFormatType(it->second);
return ClipboardFormatType( return ClipboardFormatType(
::RegisterClipboardFormat(base::ASCIIToUTF16(format_string).c_str())); ::RegisterClipboardFormat(base::ASCIIToWide(format_string).c_str()));
} }
// The following formats can be referenced by ClipboardUtilWin::GetPlainText. // The following formats can be referenced by ClipboardUtilWin::GetPlainText.
......
...@@ -67,9 +67,9 @@ bool GetUrlFromHDrop(IDataObject* data_object, ...@@ -67,9 +67,9 @@ bool GetUrlFromHDrop(IDataObject* data_object,
if (0 == _wcsicmp(PathFindExtensionW(filename), L".url") && if (0 == _wcsicmp(PathFindExtensionW(filename), L".url") &&
GetPrivateProfileStringW(L"InternetShortcut", L"url", 0, url_buffer, GetPrivateProfileStringW(L"InternetShortcut", L"url", 0, url_buffer,
base::size(url_buffer), filename)) { base::size(url_buffer), filename)) {
*url = GURL(url_buffer); *url = GURL(base::AsStringPiece16(url_buffer));
PathRemoveExtension(filename); PathRemoveExtension(filename);
title->assign(PathFindFileName(filename)); title->assign(base::as_u16cstr(PathFindFileName(filename)));
success = url->is_valid(); success = url->is_valid();
} }
} }
...@@ -112,7 +112,7 @@ bool ContainsFilePathCaseInsensitive( ...@@ -112,7 +112,7 @@ bool ContainsFilePathCaseInsensitive(
// emails with the same subject line are dragged out of Outlook.exe). // emails with the same subject line are dragged out of Outlook.exe).
// |uniquifier| is incremented on encountering a non-unique file name. // |uniquifier| is incremented on encountering a non-unique file name.
base::FilePath GetUniqueVirtualFilename( base::FilePath GetUniqueVirtualFilename(
const base::string16& candidate_name, const std::wstring& candidate_name,
const std::vector<base::FilePath>& existing_filenames, const std::vector<base::FilePath>& existing_filenames,
unsigned int* uniquifier) { unsigned int* uniquifier) {
// Remove any possible filepath components/separators that drag source may // Remove any possible filepath components/separators that drag source may
...@@ -122,9 +122,9 @@ base::FilePath GetUniqueVirtualFilename( ...@@ -122,9 +122,9 @@ base::FilePath GetUniqueVirtualFilename(
// To mitigate against running up against MAX_PATH limitations (temp files // To mitigate against running up against MAX_PATH limitations (temp files
// failing to be created), truncate the display name. // failing to be created), truncate the display name.
const size_t kTruncatedDisplayNameLength = 128; const size_t kTruncatedDisplayNameLength = 128;
const base::string16 extension = unique_name.Extension(); const std::wstring extension = unique_name.Extension();
unique_name = unique_name.RemoveExtension(); unique_name = unique_name.RemoveExtension();
base::string16 truncated = unique_name.value(); std::wstring truncated = unique_name.value();
if (truncated.length() > kTruncatedDisplayNameLength) { if (truncated.length() > kTruncatedDisplayNameLength) {
truncated.erase(kTruncatedDisplayNameLength); truncated.erase(kTruncatedDisplayNameLength);
unique_name = base::FilePath(truncated); unique_name = base::FilePath(truncated);
...@@ -133,7 +133,7 @@ base::FilePath GetUniqueVirtualFilename( ...@@ -133,7 +133,7 @@ base::FilePath GetUniqueVirtualFilename(
// Replace any file name illegal characters. // Replace any file name illegal characters.
unique_name = net::GenerateFileName(GURL(), std::string(), std::string(), unique_name = net::GenerateFileName(GURL(), std::string(), std::string(),
base::UTF16ToUTF8(unique_name.value()), base::WideToUTF8(unique_name.value()),
std::string(), std::string()); std::string(), std::string());
// Make the file name unique. This is more involved than just marching through // Make the file name unique. This is more involved than just marching through
...@@ -348,11 +348,11 @@ HGLOBAL CopyFileContentsToHGlobal(IDataObject* data_object, LONG index) { ...@@ -348,11 +348,11 @@ HGLOBAL CopyFileContentsToHGlobal(IDataObject* data_object, LONG index) {
return hdata; return hdata;
} }
base::string16 ConvertString(const char* string) { std::wstring ConvertString(const char* string) {
return base::UTF8ToWide(string); return base::UTF8ToWide(string);
} }
base::string16 ConvertString(const wchar_t* string) { std::wstring ConvertString(const wchar_t* string) {
return string; return string;
} }
...@@ -424,7 +424,7 @@ bool GetVirtualFilenames(IDataObject* data_object, ...@@ -424,7 +424,7 @@ bool GetVirtualFilenames(IDataObject* data_object,
template <typename FileGroupDescriptorType> template <typename FileGroupDescriptorType>
bool GetFileNameFromFirstDescriptor(IDataObject* data_object, bool GetFileNameFromFirstDescriptor(IDataObject* data_object,
base::string16* filename) { std::wstring* filename) {
STGMEDIUM medium; STGMEDIUM medium;
if (!FileGroupDescriptorData<FileGroupDescriptorType>::get(data_object, if (!FileGroupDescriptorData<FileGroupDescriptorType>::get(data_object,
...@@ -505,7 +505,7 @@ bool ClipboardUtil::GetUrl(IDataObject* data_object, ...@@ -505,7 +505,7 @@ bool ClipboardUtil::GetUrl(IDataObject* data_object,
{ {
// Mozilla URL format or Unicode URL // Mozilla URL format or Unicode URL
base::win::ScopedHGlobal<wchar_t*> data(store.hGlobal); base::win::ScopedHGlobal<wchar_t*> data(store.hGlobal);
SplitUrlAndTitle(data.get(), url, title); SplitUrlAndTitle(base::WideToUTF16(data.get()), url, title);
} }
ReleaseStgMedium(&store); ReleaseStgMedium(&store);
return url->is_valid(); return url->is_valid();
...@@ -515,14 +515,14 @@ bool ClipboardUtil::GetUrl(IDataObject* data_object, ...@@ -515,14 +515,14 @@ bool ClipboardUtil::GetUrl(IDataObject* data_object,
{ {
// URL using ASCII // URL using ASCII
base::win::ScopedHGlobal<char*> data(store.hGlobal); base::win::ScopedHGlobal<char*> data(store.hGlobal);
SplitUrlAndTitle(base::UTF8ToWide(data.get()), url, title); SplitUrlAndTitle(base::UTF8ToUTF16(data.get()), url, title);
} }
ReleaseStgMedium(&store); ReleaseStgMedium(&store);
return url->is_valid(); return url->is_valid();
} }
if (convert_filenames) { if (convert_filenames) {
std::vector<base::string16> filenames; std::vector<std::wstring> filenames;
if (!GetFilenames(data_object, &filenames)) if (!GetFilenames(data_object, &filenames))
return false; return false;
DCHECK_GT(filenames.size(), 0U); DCHECK_GT(filenames.size(), 0U);
...@@ -534,7 +534,7 @@ bool ClipboardUtil::GetUrl(IDataObject* data_object, ...@@ -534,7 +534,7 @@ bool ClipboardUtil::GetUrl(IDataObject* data_object,
} }
bool ClipboardUtil::GetFilenames(IDataObject* data_object, bool ClipboardUtil::GetFilenames(IDataObject* data_object,
std::vector<base::string16>* filenames) { std::vector<std::wstring>* filenames) {
DCHECK(data_object && filenames); DCHECK(data_object && filenames);
if (!HasFilenames(data_object)) if (!HasFilenames(data_object))
return false; return false;
...@@ -646,7 +646,7 @@ bool ClipboardUtil::GetPlainText(IDataObject* data_object, ...@@ -646,7 +646,7 @@ bool ClipboardUtil::GetPlainText(IDataObject* data_object,
{ {
// Unicode text // Unicode text
base::win::ScopedHGlobal<wchar_t*> data(store.hGlobal); base::win::ScopedHGlobal<wchar_t*> data(store.hGlobal);
plain_text->assign(data.get()); plain_text->assign(base::as_u16cstr(data.get()));
} }
ReleaseStgMedium(&store); ReleaseStgMedium(&store);
return true; return true;
...@@ -656,7 +656,7 @@ bool ClipboardUtil::GetPlainText(IDataObject* data_object, ...@@ -656,7 +656,7 @@ bool ClipboardUtil::GetPlainText(IDataObject* data_object,
{ {
// ASCII text // ASCII text
base::win::ScopedHGlobal<char*> data(store.hGlobal); base::win::ScopedHGlobal<char*> data(store.hGlobal);
plain_text->assign(base::UTF8ToWide(data.get())); plain_text->assign(base::UTF8ToUTF16(data.get()));
} }
ReleaseStgMedium(&store); ReleaseStgMedium(&store);
return true; return true;
...@@ -686,7 +686,7 @@ bool ClipboardUtil::GetHtml(IDataObject* data_object, ...@@ -686,7 +686,7 @@ bool ClipboardUtil::GetHtml(IDataObject* data_object,
std::string html_utf8; std::string html_utf8;
CFHtmlToHtml(std::string(data.get(), data.Size()), &html_utf8, base_url); CFHtmlToHtml(std::string(data.get(), data.Size()), &html_utf8, base_url);
html->assign(base::UTF8ToWide(html_utf8)); html->assign(base::UTF8ToUTF16(html_utf8));
} }
ReleaseStgMedium(&store); ReleaseStgMedium(&store);
return true; return true;
...@@ -701,14 +701,14 @@ bool ClipboardUtil::GetHtml(IDataObject* data_object, ...@@ -701,14 +701,14 @@ bool ClipboardUtil::GetHtml(IDataObject* data_object,
{ {
// text/html // text/html
base::win::ScopedHGlobal<wchar_t*> data(store.hGlobal); base::win::ScopedHGlobal<wchar_t*> data(store.hGlobal);
html->assign(data.get()); html->assign(base::as_u16cstr(data.get()));
} }
ReleaseStgMedium(&store); ReleaseStgMedium(&store);
return true; return true;
} }
bool ClipboardUtil::GetFileContents(IDataObject* data_object, bool ClipboardUtil::GetFileContents(IDataObject* data_object,
base::string16* filename, std::wstring* filename,
std::string* file_contents) { std::string* file_contents) {
DCHECK(data_object && filename && file_contents); DCHECK(data_object && filename && file_contents);
if (!HasFileContents(data_object)) if (!HasFileContents(data_object))
......
...@@ -45,7 +45,7 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD) ClipboardUtil { ...@@ -45,7 +45,7 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD) ClipboardUtil {
bool convert_filenames); bool convert_filenames);
// Only returns true if |*filenames| is not empty. // Only returns true if |*filenames| is not empty.
static bool GetFilenames(IDataObject* data_object, static bool GetFilenames(IDataObject* data_object,
std::vector<base::string16>* filenames); std::vector<std::wstring>* filenames);
// Fills a vector of display names of "virtual files" in the data store, but // Fills a vector of display names of "virtual files" in the data store, but
// does not actually retrieve the file contents. Display names are assured to // does not actually retrieve the file contents. Display names are assured to
...@@ -78,7 +78,7 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD) ClipboardUtil { ...@@ -78,7 +78,7 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD) ClipboardUtil {
base::string16* text_html, base::string16* text_html,
std::string* base_url); std::string* base_url);
static bool GetFileContents(IDataObject* data_object, static bool GetFileContents(IDataObject* data_object,
base::string16* filename, std::wstring* filename,
std::string* file_contents); std::string* file_contents);
// This represents custom MIME types a web page might set to transport its // This represents custom MIME types a web page might set to transport its
// own types of data for drag and drop. It is sandboxed in its own CLIPFORMAT // own types of data for drag and drop. It is sandboxed in its own CLIPFORMAT
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "base/notreached.h" #include "base/notreached.h"
#include "base/pickle.h" #include "base/pickle.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/win/scoped_hdc.h" #include "base/win/scoped_hdc.h"
#include "base/win/scoped_hglobal.h" #include "base/win/scoped_hglobal.h"
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
#include "ui/base/clipboard/clipboard_util_win.h" #include "ui/base/clipboard/clipboard_util_win.h"
#include "ui/base/dragdrop/file_info/file_info.h" #include "ui/base/dragdrop/file_info/file_info.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
#include "ui/gfx/skbitmap_operations.h" #include "ui/gfx/skbitmap_operations.h"
...@@ -64,8 +66,8 @@ const ClipboardFormatType& GetRendererTaintFormatType(); ...@@ -64,8 +66,8 @@ const ClipboardFormatType& GetRendererTaintFormatType();
// Creates the contents of an Internet Shortcut file for the given URL. // Creates the contents of an Internet Shortcut file for the given URL.
std::string GetInternetShortcutFileContents(const GURL& url); std::string GetInternetShortcutFileContents(const GURL& url);
// Creates a valid file name given a suggested title and URL. // Creates a valid file name given a suggested title and URL.
base::string16 CreateValidFileNameFromTitle(const GURL& url, std::wstring CreateValidFileNameFromTitle(const GURL& url,
const base::string16& title); const std::wstring& title);
} // namespace } // namespace
...@@ -329,7 +331,8 @@ void OSExchangeDataProviderWin::SetURL(const GURL& url, ...@@ -329,7 +331,8 @@ void OSExchangeDataProviderWin::SetURL(const GURL& url,
ClipboardFormatType::GetMozUrlType().ToFormatEtc(), storage)); ClipboardFormatType::GetMozUrlType().ToFormatEtc(), storage));
// Add a .URL shortcut file for dragging to Explorer. // Add a .URL shortcut file for dragging to Explorer.
base::string16 valid_file_name = CreateValidFileNameFromTitle(url, title); std::wstring valid_file_name =
CreateValidFileNameFromTitle(url, base::AsWString(title));
std::string shortcut_url_file_contents = GetInternetShortcutFileContents(url); std::string shortcut_url_file_contents = GetInternetShortcutFileContents(url);
SetFileContents(base::FilePath(valid_file_name), shortcut_url_file_contents); SetFileContents(base::FilePath(valid_file_name), shortcut_url_file_contents);
...@@ -400,7 +403,7 @@ void OSExchangeDataProviderWin::SetVirtualFileContentsForTesting( ...@@ -400,7 +403,7 @@ void OSExchangeDataProviderWin::SetVirtualFileContentsForTesting(
for (size_t i = 0; i < num_files; i++) { for (size_t i = 0; i < num_files; i++) {
// Fill in each FILEDESCRIPTORW with file name. // Fill in each FILEDESCRIPTORW with file name.
descriptor->fgd[i].dwFlags |= FD_UNICODE; descriptor->fgd[i].dwFlags |= FD_UNICODE;
base::string16 file_name = filenames_and_contents[i].first.value(); std::wstring file_name = filenames_and_contents[i].first.value();
wcsncpy_s(descriptor->fgd[i].cFileName, MAX_PATH, file_name.c_str(), wcsncpy_s(descriptor->fgd[i].cFileName, MAX_PATH, file_name.c_str(),
std::min(file_name.size(), static_cast<size_t>(MAX_PATH - 1u))); std::min(file_name.size(), static_cast<size_t>(MAX_PATH - 1u)));
...@@ -544,7 +547,7 @@ bool OSExchangeDataProviderWin::GetURLAndTitle(FilenameToURLPolicy policy, ...@@ -544,7 +547,7 @@ bool OSExchangeDataProviderWin::GetURLAndTitle(FilenameToURLPolicy policy,
} }
bool OSExchangeDataProviderWin::GetFilename(base::FilePath* path) const { bool OSExchangeDataProviderWin::GetFilename(base::FilePath* path) const {
std::vector<base::string16> filenames; std::vector<std::wstring> filenames;
bool success = ClipboardUtil::GetFilenames(source_object_.Get(), &filenames); bool success = ClipboardUtil::GetFilenames(source_object_.Get(), &filenames);
if (success) if (success)
*path = base::FilePath(filenames[0]); *path = base::FilePath(filenames[0]);
...@@ -553,11 +556,11 @@ bool OSExchangeDataProviderWin::GetFilename(base::FilePath* path) const { ...@@ -553,11 +556,11 @@ bool OSExchangeDataProviderWin::GetFilename(base::FilePath* path) const {
bool OSExchangeDataProviderWin::GetFilenames( bool OSExchangeDataProviderWin::GetFilenames(
std::vector<FileInfo>* filenames) const { std::vector<FileInfo>* filenames) const {
std::vector<base::string16> filenames_local; std::vector<std::wstring> filenames_local;
bool success = bool success =
ClipboardUtil::GetFilenames(source_object_.Get(), &filenames_local); ClipboardUtil::GetFilenames(source_object_.Get(), &filenames_local);
if (success) { if (success) {
for (const base::string16& filename_local : filenames_local) for (const std::wstring& filename_local : filenames_local)
filenames->push_back( filenames->push_back(
FileInfo(base::FilePath(filename_local), base::FilePath())); FileInfo(base::FilePath(filename_local), base::FilePath()));
} }
...@@ -619,7 +622,7 @@ bool OSExchangeDataProviderWin::GetPickledData( ...@@ -619,7 +622,7 @@ bool OSExchangeDataProviderWin::GetPickledData(
bool OSExchangeDataProviderWin::GetFileContents( bool OSExchangeDataProviderWin::GetFileContents(
base::FilePath* filename, base::FilePath* filename,
std::string* file_contents) const { std::string* file_contents) const {
base::string16 filename_str; std::wstring filename_str;
if (!ClipboardUtil::GetFileContents(source_object_.Get(), &filename_str, if (!ClipboardUtil::GetFileContents(source_object_.Get(), &filename_str,
file_contents)) { file_contents)) {
return false; return false;
...@@ -1212,7 +1215,7 @@ STGMEDIUM CreateIdListStorageForFileName(const base::FilePath& path) { ...@@ -1212,7 +1215,7 @@ STGMEDIUM CreateIdListStorageForFileName(const base::FilePath& path) {
} }
STGMEDIUM CreateStorageForFileDescriptor(const base::FilePath& path) { STGMEDIUM CreateStorageForFileDescriptor(const base::FilePath& path) {
base::string16 file_name = path.value(); std::wstring file_name = path.value();
DCHECK(!file_name.empty()); DCHECK(!file_name.empty());
HANDLE hdata = GlobalAlloc(GPTR, sizeof(FILEGROUPDESCRIPTORW)); HANDLE hdata = GlobalAlloc(GPTR, sizeof(FILEGROUPDESCRIPTORW));
base::win::ScopedHGlobal<FILEGROUPDESCRIPTORW*> locked_mem(hdata); base::win::ScopedHGlobal<FILEGROUPDESCRIPTORW*> locked_mem(hdata);
...@@ -1241,16 +1244,16 @@ std::string GetInternetShortcutFileContents(const GURL& url) { ...@@ -1241,16 +1244,16 @@ std::string GetInternetShortcutFileContents(const GURL& url) {
return kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; return kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd;
} }
base::string16 CreateValidFileNameFromTitle(const GURL& url, std::wstring CreateValidFileNameFromTitle(const GURL& url,
const base::string16& title) { const std::wstring& title) {
base::string16 validated; std::wstring validated;
if (title.empty()) { if (title.empty()) {
if (url.is_valid()) { if (url.is_valid()) {
validated = net::GetSuggestedFilename(url, "", "", "", "", std::string()); validated = base::AsWString(
net::GetSuggestedFilename(url, "", "", "", "", std::string()));
} else { } else {
// Nothing else can be done, just use a default. // Nothing else can be done, just use a default.
validated = validated = l10n_util::GetWideString(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME);
l10n_util::GetStringUTF16(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME);
} }
} else { } else {
validated = title; validated = title;
......
...@@ -67,14 +67,14 @@ bool IsLocaleSupportedByOS(const std::string& locale) { ...@@ -67,14 +67,14 @@ bool IsLocaleSupportedByOS(const std::string& locale) {
return true; return true;
} }
bool NeedOverrideDefaultUIFont(base::string16* override_font_family, bool NeedOverrideDefaultUIFont(std::wstring* override_font_family,
double* font_size_scaler) { double* font_size_scaler) {
// This is rather simple-minded to deal with the UI font size // This is rather simple-minded to deal with the UI font size
// issue for some Indian locales (ml, bn, hi) for which // issue for some Indian locales (ml, bn, hi) for which
// the default Windows fonts are too small to be legible. For those // the default Windows fonts are too small to be legible. For those
// locales, IDS_UI_FONT_FAMILY is set to an actual font family to // locales, IDS_UI_FONT_FAMILY is set to an actual font family to
// use while for other locales, it's set to 'default'. // use while for other locales, it's set to 'default'.
base::string16 ui_font_family = GetStringUTF16(IDS_UI_FONT_FAMILY); std::wstring ui_font_family = GetWideString(IDS_UI_FONT_FAMILY);
int scaler100; int scaler100;
if (!base::StringToInt(l10n_util::GetStringUTF16(IDS_UI_FONT_SIZE_SCALER), if (!base::StringToInt(l10n_util::GetStringUTF16(IDS_UI_FONT_SIZE_SCALER),
&scaler100)) &scaler100))
...@@ -97,12 +97,12 @@ bool NeedOverrideDefaultUIFont(base::string16* override_font_family, ...@@ -97,12 +97,12 @@ bool NeedOverrideDefaultUIFont(base::string16* override_font_family,
} }
void OverrideLocaleWithUILanguageList() { void OverrideLocaleWithUILanguageList() {
std::vector<base::string16> ui_languages; std::vector<std::wstring> ui_languages;
if (base::win::i18n::GetThreadPreferredUILanguageList(&ui_languages)) { if (base::win::i18n::GetThreadPreferredUILanguageList(&ui_languages)) {
std::vector<std::string> ascii_languages; std::vector<std::string> ascii_languages;
ascii_languages.reserve(ui_languages.size()); ascii_languages.reserve(ui_languages.size());
std::transform(ui_languages.begin(), ui_languages.end(), std::transform(ui_languages.begin(), ui_languages.end(),
std::back_inserter(ascii_languages), &base::UTF16ToASCII); std::back_inserter(ascii_languages), &base::WideToASCII);
override_locale_holder.Get().swap_value(&ascii_languages); override_locale_holder.Get().swap_value(&ascii_languages);
} else { } else {
NOTREACHED() << "Failed to determine the UI language for locale override."; NOTREACHED() << "Failed to determine the UI language for locale override.";
...@@ -113,4 +113,8 @@ const std::vector<std::string>& GetLocaleOverrides() { ...@@ -113,4 +113,8 @@ const std::vector<std::string>& GetLocaleOverrides() {
return override_locale_holder.Get().value(); return override_locale_holder.Get().value();
} }
std::wstring GetWideString(int message_id) {
return base::UTF16ToWide(GetStringUTF16(message_id));
}
} // namespace l10n_util } // namespace l10n_util
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <vector> #include <vector>
#include "base/component_export.h" #include "base/component_export.h"
#include "base/strings/string16.h"
namespace l10n_util { namespace l10n_util {
...@@ -41,7 +40,7 @@ COMPONENT_EXPORT(UI_BASE) void HWNDSetRTLLayout(HWND hwnd); ...@@ -41,7 +40,7 @@ COMPONENT_EXPORT(UI_BASE) void HWNDSetRTLLayout(HWND hwnd);
// filled with the font family name and the size scaler. The output // filled with the font family name and the size scaler. The output
// parameters are not modified if the return value is false. // parameters are not modified if the return value is false.
COMPONENT_EXPORT(UI_BASE) COMPONENT_EXPORT(UI_BASE)
bool NeedOverrideDefaultUIFont(base::string16* override_font_family, bool NeedOverrideDefaultUIFont(std::wstring* override_font_family,
double* font_size_scaler); double* font_size_scaler);
// Allow processes to override the configured locale with the user's Windows UI // Allow processes to override the configured locale with the user's Windows UI
...@@ -53,6 +52,9 @@ COMPONENT_EXPORT(UI_BASE) void OverrideLocaleWithUILanguageList(); ...@@ -53,6 +52,9 @@ COMPONENT_EXPORT(UI_BASE) void OverrideLocaleWithUILanguageList();
// or failed to be overridden. // or failed to be overridden.
COMPONENT_EXPORT(UI_BASE) const std::vector<std::string>& GetLocaleOverrides(); COMPONENT_EXPORT(UI_BASE) const std::vector<std::string>& GetLocaleOverrides();
// Pulls resource string from the string bundle and returns it.
COMPONENT_EXPORT(UI_BASE) std::wstring GetWideString(int message_id);
} // namespace l10n_util } // namespace l10n_util
#endif // UI_BASE_L10N_L10N_UTIL_WIN_H_ #endif // UI_BASE_L10N_L10N_UTIL_WIN_H_
...@@ -85,7 +85,7 @@ base::FilePath GetResourcesPakFilePath(const std::string& pak_name) { ...@@ -85,7 +85,7 @@ base::FilePath GetResourcesPakFilePath(const std::string& pak_name) {
// Return just the name of the pak file. // Return just the name of the pak file.
#if defined(OS_WIN) #if defined(OS_WIN)
return base::FilePath(base::ASCIIToUTF16(pak_name)); return base::FilePath(base::ASCIIToWide(pak_name));
#else #else
return base::FilePath(pak_name.c_str()); return base::FilePath(pak_name.c_str());
#endif // OS_WIN #endif // OS_WIN
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#include "ui/base/win/message_box_win.h" #include "ui/base/win/message_box_win.h"
#include "base/i18n/rtl.h" #include "base/i18n/rtl.h"
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
namespace ui { namespace ui {
...@@ -12,20 +15,20 @@ namespace ui { ...@@ -12,20 +15,20 @@ namespace ui {
// RTL locale, we need to make sure that LTR strings are rendered correctly by // RTL locale, we need to make sure that LTR strings are rendered correctly by
// adding the appropriate Unicode directionality marks. // adding the appropriate Unicode directionality marks.
int MessageBox(HWND hwnd, int MessageBox(HWND hwnd,
const base::string16& text, const std::wstring& text,
const base::string16& caption, const std::wstring& caption,
UINT flags) { UINT flags) {
UINT actual_flags = flags; UINT actual_flags = flags;
if (base::i18n::IsRTL()) if (base::i18n::IsRTL())
actual_flags |= MB_RIGHT | MB_RTLREADING; actual_flags |= MB_RIGHT | MB_RTLREADING;
base::string16 localized_text = text; base::string16 localized_text = base::WideToUTF16(text);
base::i18n::AdjustStringForLocaleDirection(&localized_text); base::i18n::AdjustStringForLocaleDirection(&localized_text);
const wchar_t* text_ptr = localized_text.c_str(); const wchar_t* text_ptr = base::as_wcstr(localized_text);
base::string16 localized_caption = caption; base::string16 localized_caption = base::WideToUTF16(caption);
base::i18n::AdjustStringForLocaleDirection(&localized_caption); base::i18n::AdjustStringForLocaleDirection(&localized_caption);
const wchar_t* caption_ptr = localized_caption.c_str(); const wchar_t* caption_ptr = base::as_wcstr(localized_caption);
return ::MessageBox(hwnd, text_ptr, caption_ptr, actual_flags); return ::MessageBox(hwnd, text_ptr, caption_ptr, actual_flags);
} }
......
...@@ -7,8 +7,9 @@ ...@@ -7,8 +7,9 @@
#include <windows.h> #include <windows.h>
#include <string>
#include "base/component_export.h" #include "base/component_export.h"
#include "base/strings/string16.h"
namespace ui { namespace ui {
...@@ -18,8 +19,8 @@ namespace ui { ...@@ -18,8 +19,8 @@ namespace ui {
// right-to-left locale. // right-to-left locale.
COMPONENT_EXPORT(UI_BASE) COMPONENT_EXPORT(UI_BASE)
int MessageBox(HWND hwnd, int MessageBox(HWND hwnd,
const base::string16& text, const std::wstring& text,
const base::string16& caption, const std::wstring& caption,
UINT flags); UINT flags);
} // namespace ui } // namespace ui
......
...@@ -39,10 +39,10 @@ namespace { ...@@ -39,10 +39,10 @@ namespace {
const DWORD kDefaultShellExecuteFlags = SEE_MASK_NOASYNC; const DWORD kDefaultShellExecuteFlags = SEE_MASK_NOASYNC;
// Invokes ShellExecuteExW() with the given parameters. // Invokes ShellExecuteExW() with the given parameters.
bool InvokeShellExecute(const base::string16 path, bool InvokeShellExecute(const std::wstring& path,
const base::string16 working_directory, const std::wstring& working_directory,
const base::string16 args, const std::wstring& args,
const base::string16 verb, const std::wstring& verb,
DWORD mask) { DWORD mask) {
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::WILL_BLOCK); base::BlockingType::WILL_BLOCK);
...@@ -67,7 +67,7 @@ bool InvokeShellExecute(const base::string16 path, ...@@ -67,7 +67,7 @@ bool InvokeShellExecute(const base::string16 path,
bool OpenFileViaShell(const base::FilePath& full_path) { bool OpenFileViaShell(const base::FilePath& full_path) {
// Invoke the default verb on the file with no arguments. // Invoke the default verb on the file with no arguments.
return InvokeShellExecute(full_path.value(), full_path.DirName().value(), return InvokeShellExecute(full_path.value(), full_path.DirName().value(),
base::string16(), base::string16(), std::wstring(), std::wstring(),
kDefaultShellExecuteFlags); kDefaultShellExecuteFlags);
} }
...@@ -75,7 +75,7 @@ bool OpenFolderViaShell(const base::FilePath& full_path) { ...@@ -75,7 +75,7 @@ bool OpenFolderViaShell(const base::FilePath& full_path) {
// The "explore" verb causes the folder at |full_path| to be displayed in a // The "explore" verb causes the folder at |full_path| to be displayed in a
// file browser. This will fail if |full_path| is not a directory. // file browser. This will fail if |full_path| is not a directory.
return InvokeShellExecute(full_path.value(), full_path.value(), return InvokeShellExecute(full_path.value(), full_path.value(),
base::string16(), L"explore", std::wstring(), L"explore",
kDefaultShellExecuteFlags); kDefaultShellExecuteFlags);
} }
...@@ -92,11 +92,11 @@ bool PreventWindowFromPinning(HWND hwnd) { ...@@ -92,11 +92,11 @@ bool PreventWindowFromPinning(HWND hwnd) {
// TODO(calamity): investigate moving this out of the UI thread as COM // TODO(calamity): investigate moving this out of the UI thread as COM
// operations may spawn nested run loops which can cause issues. // operations may spawn nested run loops which can cause issues.
void SetAppDetailsForWindow(const base::string16& app_id, void SetAppDetailsForWindow(const std::wstring& app_id,
const base::FilePath& app_icon_path, const base::FilePath& app_icon_path,
int app_icon_index, int app_icon_index,
const base::string16& relaunch_command, const std::wstring& relaunch_command,
const base::string16& relaunch_display_name, const std::wstring& relaunch_display_name,
HWND hwnd) { HWND hwnd) {
DCHECK(hwnd); DCHECK(hwnd);
...@@ -127,23 +127,23 @@ void SetAppDetailsForWindow(const base::string16& app_id, ...@@ -127,23 +127,23 @@ void SetAppDetailsForWindow(const base::string16& app_id,
} }
} }
void SetAppIdForWindow(const base::string16& app_id, HWND hwnd) { void SetAppIdForWindow(const std::wstring& app_id, HWND hwnd) {
SetAppDetailsForWindow(app_id, base::FilePath(), 0, base::string16(), SetAppDetailsForWindow(app_id, base::FilePath(), 0, std::wstring(),
base::string16(), hwnd); std::wstring(), hwnd);
} }
void SetAppIconForWindow(const base::FilePath& app_icon_path, void SetAppIconForWindow(const base::FilePath& app_icon_path,
int app_icon_index, int app_icon_index,
HWND hwnd) { HWND hwnd) {
SetAppDetailsForWindow(base::string16(), app_icon_path, app_icon_index, SetAppDetailsForWindow(std::wstring(), app_icon_path, app_icon_index,
base::string16(), base::string16(), hwnd); std::wstring(), std::wstring(), hwnd);
} }
void SetRelaunchDetailsForWindow(const base::string16& relaunch_command, void SetRelaunchDetailsForWindow(const std::wstring& relaunch_command,
const base::string16& display_name, const std::wstring& display_name,
HWND hwnd) { HWND hwnd) {
SetAppDetailsForWindow(base::string16(), base::FilePath(), 0, SetAppDetailsForWindow(std::wstring(), base::FilePath(), 0, relaunch_command,
relaunch_command, display_name, hwnd); display_name, hwnd);
} }
void ClearWindowPropertyStore(HWND hwnd) { void ClearWindowPropertyStore(HWND hwnd) {
......
...@@ -23,14 +23,14 @@ BOOL CALLBACK EnumMonitorForProfilePathCallback(HMONITOR monitor, ...@@ -23,14 +23,14 @@ BOOL CALLBACK EnumMonitorForProfilePathCallback(HMONITOR monitor,
HDC input_hdc, HDC input_hdc,
LPRECT rect, LPRECT rect,
LPARAM data) { LPARAM data) {
base::string16 device_name; std::wstring device_name;
MONITORINFOEX monitor_info; MONITORINFOEX monitor_info;
::ZeroMemory(&monitor_info, sizeof(monitor_info)); ::ZeroMemory(&monitor_info, sizeof(monitor_info));
monitor_info.cbSize = sizeof(monitor_info); monitor_info.cbSize = sizeof(monitor_info);
::GetMonitorInfo(monitor, &monitor_info); ::GetMonitorInfo(monitor, &monitor_info);
device_name = base::string16(monitor_info.szDevice); device_name = std::wstring(monitor_info.szDevice);
base::string16 profile_path; std::wstring profile_path;
HDC hdc = ::CreateDC(monitor_info.szDevice, NULL, NULL, NULL); HDC hdc = ::CreateDC(monitor_info.szDevice, NULL, NULL, NULL);
if (hdc) { if (hdc) {
DWORD path_length = MAX_PATH; DWORD path_length = MAX_PATH;
...@@ -38,11 +38,11 @@ BOOL CALLBACK EnumMonitorForProfilePathCallback(HMONITOR monitor, ...@@ -38,11 +38,11 @@ BOOL CALLBACK EnumMonitorForProfilePathCallback(HMONITOR monitor,
BOOL result = ::GetICMProfile(hdc, &path_length, path); BOOL result = ::GetICMProfile(hdc, &path_length, path);
::DeleteDC(hdc); ::DeleteDC(hdc);
if (result) if (result)
profile_path = base::string16(path); profile_path = std::wstring(path);
} }
std::map<base::string16, base::string16>* device_to_path_map = std::map<std::wstring, std::wstring>* device_to_path_map =
reinterpret_cast<std::map<base::string16, base::string16>*>(data); reinterpret_cast<std::map<std::wstring, std::wstring>*>(data);
(*device_to_path_map)[device_name] = profile_path; (*device_to_path_map)[device_name] = profile_path;
return TRUE; return TRUE;
} }
...@@ -113,8 +113,8 @@ ColorProfileReader::ReadProfilesOnBackgroundThread( ...@@ -113,8 +113,8 @@ ColorProfileReader::ReadProfilesOnBackgroundThread(
DeviceToPathMap new_device_to_path_map) { DeviceToPathMap new_device_to_path_map) {
DeviceToDataMap new_device_to_data_map; DeviceToDataMap new_device_to_data_map;
for (auto entry : new_device_to_path_map) { for (auto entry : new_device_to_path_map) {
const base::string16& device_name = entry.first; const std::wstring& device_name = entry.first;
const base::string16& profile_path = entry.second; const std::wstring& profile_path = entry.second;
std::string profile_data; std::string profile_data;
base::ReadFileToString(base::FilePath(profile_path), &profile_data); base::ReadFileToString(base::FilePath(profile_path), &profile_data);
new_device_to_data_map[device_name] = profile_data; new_device_to_data_map[device_name] = profile_data;
...@@ -129,7 +129,7 @@ void ColorProfileReader::ReadProfilesCompleted( ...@@ -129,7 +129,7 @@ void ColorProfileReader::ReadProfilesCompleted(
display_id_to_profile_map_.clear(); display_id_to_profile_map_.clear();
for (auto entry : device_to_data_map) { for (auto entry : device_to_data_map) {
const base::string16& device_name = entry.first; const std::wstring& device_name = entry.first;
const std::string& profile_data = entry.second; const std::string& profile_data = entry.second;
if (!profile_data.empty()) { if (!profile_data.empty()) {
int64_t display_id = int64_t display_id =
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "ui/display/display_export.h" #include "ui/display/display_export.h"
#include "ui/gfx/icc_profile.h" #include "ui/gfx/icc_profile.h"
...@@ -42,8 +41,8 @@ class DISPLAY_EXPORT ColorProfileReader { ...@@ -42,8 +41,8 @@ class DISPLAY_EXPORT ColorProfileReader {
gfx::ColorSpace GetDisplayColorSpace(int64_t id) const; gfx::ColorSpace GetDisplayColorSpace(int64_t id) const;
private: private:
typedef std::map<base::string16, base::string16> DeviceToPathMap; typedef std::map<std::wstring, std::wstring> DeviceToPathMap;
typedef std::map<base::string16, std::string> DeviceToDataMap; typedef std::map<std::wstring, std::string> DeviceToDataMap;
// Enumerate displays and return a map to their ICC profile path. This // Enumerate displays and return a map to their ICC profile path. This
// needs to be run off of the main thread. // needs to be run off of the main thread.
......
...@@ -13,7 +13,7 @@ namespace win { ...@@ -13,7 +13,7 @@ namespace win {
// Represents an optional override of system font and scale. // Represents an optional override of system font and scale.
struct FontAdjustment { struct FontAdjustment {
base::string16 font_family_override; std::wstring font_family_override;
double font_scale = 1.0; double font_scale = 1.0;
}; };
......
...@@ -173,9 +173,10 @@ base::string16 ElideFilename(const base::FilePath& filename, ...@@ -173,9 +173,10 @@ base::string16 ElideFilename(const base::FilePath& filename,
const FontList& font_list, const FontList& font_list,
float available_pixel_width) { float available_pixel_width) {
#if defined(OS_WIN) #if defined(OS_WIN)
base::string16 filename_utf16 = filename.value(); base::string16 filename_utf16 = WideToUTF16(filename.value());
base::string16 extension = filename.Extension(); base::string16 extension = WideToUTF16(filename.Extension());
base::string16 rootname = filename.BaseName().RemoveExtension().value(); base::string16 rootname =
WideToUTF16(filename.BaseName().RemoveExtension().value());
#elif defined(OS_POSIX) || defined(OS_FUCHSIA) #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
base::string16 filename_utf16 = WideToUTF16(base::SysNativeMBToWide( base::string16 filename_utf16 = WideToUTF16(base::SysNativeMBToWide(
filename.value())); filename.value()));
......
...@@ -6,9 +6,10 @@ ...@@ -6,9 +6,10 @@
#include <wrl/client.h> #include <wrl/client.h>
#include <string>
#include "base/debug/alias.h" #include "base/debug/alias.h"
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
...@@ -110,7 +111,7 @@ IDWriteFactory* GetDirectWriteFactory() { ...@@ -110,7 +111,7 @@ IDWriteFactory* GetDirectWriteFactory() {
base::Optional<std::string> RetrieveLocalizedString( base::Optional<std::string> RetrieveLocalizedString(
IDWriteLocalizedStrings* names, IDWriteLocalizedStrings* names,
const std::string& locale) { const std::string& locale) {
base::string16 locale_wide = base::UTF8ToUTF16(locale); std::wstring locale_wide = base::UTF8ToWide(locale);
// If locale is empty, index 0 will be used. Otherwise, the locale name must // If locale is empty, index 0 will be used. Otherwise, the locale name must
// be found and must exist. // be found and must exist.
...@@ -129,7 +130,7 @@ base::Optional<std::string> RetrieveLocalizedString( ...@@ -129,7 +130,7 @@ base::Optional<std::string> RetrieveLocalizedString(
// The output buffer length needs to be one larger to receive the NUL // The output buffer length needs to be one larger to receive the NUL
// character. // character.
base::string16 buffer; std::wstring buffer;
buffer.resize(length + 1); buffer.resize(length + 1);
if (FAILED(names->GetString(index, &buffer[0], buffer.size()))) if (FAILED(names->GetString(index, &buffer[0], buffer.size())))
return base::nullopt; return base::nullopt;
...@@ -137,7 +138,7 @@ base::Optional<std::string> RetrieveLocalizedString( ...@@ -137,7 +138,7 @@ base::Optional<std::string> RetrieveLocalizedString(
// Shrink the string to fit the actual length. // Shrink the string to fit the actual length.
buffer.resize(length); buffer.resize(length);
return base::UTF16ToUTF8(buffer); return base::WideToUTF8(buffer);
} }
base::Optional<std::string> RetrieveLocalizedFontName( base::Optional<std::string> RetrieveLocalizedFontName(
...@@ -153,7 +154,7 @@ base::Optional<std::string> RetrieveLocalizedFontName( ...@@ -153,7 +154,7 @@ base::Optional<std::string> RetrieveLocalizedFontName(
UINT32 index = 0; UINT32 index = 0;
BOOL exists; BOOL exists;
base::string16 font_name_wide = base::UTF8ToUTF16(font_name); std::wstring font_name_wide = base::UTF8ToWide(font_name);
if (FAILED(font_collection->FindFamilyName(font_name_wide.c_str(), &index, if (FAILED(font_collection->FindFamilyName(font_name_wide.c_str(), &index,
&exists)) || &exists)) ||
!exists) { !exists) {
......
...@@ -83,7 +83,7 @@ NOINLINE void CrashOther(DWORD last_error) { ...@@ -83,7 +83,7 @@ NOINLINE void CrashOther(DWORD last_error) {
} // namespace } // namespace
base::string16 GetClassName(HWND window) { std::wstring GetClassName(HWND window) {
// GetClassNameW will return a truncated result (properly null terminated) if // GetClassNameW will return a truncated result (properly null terminated) if
// the given buffer is not large enough. So, it is not possible to determine // the given buffer is not large enough. So, it is not possible to determine
// that we got the entire class name if the result is exactly equal to the // that we got the entire class name if the result is exactly equal to the
......
...@@ -7,15 +7,16 @@ ...@@ -7,15 +7,16 @@
#include <windows.h> #include <windows.h>
#include "base/strings/string16.h" #include <string>
#include "ui/gfx/gfx_export.h" #include "ui/gfx/gfx_export.h"
namespace gfx { namespace gfx {
class Size; class Size;
// A version of the GetClassNameW API that returns the class name in an // A version of the GetClassNameW API that returns the class name in an
// base::string16. An empty result indicates a failure to get the class name. // std::wstring. An empty result indicates a failure to get the class name.
GFX_EXPORT base::string16 GetClassName(HWND hwnd); GFX_EXPORT std::wstring GetClassName(HWND hwnd);
// Useful for subclassing a HWND. Returns the previous window procedure. // Useful for subclassing a HWND. Returns the previous window procedure.
GFX_EXPORT WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); GFX_EXPORT WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc);
......
...@@ -11,8 +11,8 @@ namespace win { ...@@ -11,8 +11,8 @@ namespace win {
HRESULT TextAnalysisSource::Create( HRESULT TextAnalysisSource::Create(
IDWriteTextAnalysisSource** text_analysis_out, IDWriteTextAnalysisSource** text_analysis_out,
const base::string16& text, const std::wstring& text,
const base::string16& locale_name, const std::wstring& locale_name,
IDWriteNumberSubstitution* number_substitution, IDWriteNumberSubstitution* number_substitution,
DWRITE_READING_DIRECTION reading_direction) { DWRITE_READING_DIRECTION reading_direction) {
return Microsoft::WRL::MakeAndInitialize<gfx::win::TextAnalysisSource>( return Microsoft::WRL::MakeAndInitialize<gfx::win::TextAnalysisSource>(
...@@ -79,8 +79,8 @@ HRESULT TextAnalysisSource::GetTextBeforePosition(UINT32 text_position, ...@@ -79,8 +79,8 @@ HRESULT TextAnalysisSource::GetTextBeforePosition(UINT32 text_position,
} }
HRESULT TextAnalysisSource::RuntimeClassInitialize( HRESULT TextAnalysisSource::RuntimeClassInitialize(
const base::string16& text, const std::wstring& text,
const base::string16& locale_name, const std::wstring& locale_name,
IDWriteNumberSubstitution* number_substitution, IDWriteNumberSubstitution* number_substitution,
DWRITE_READING_DIRECTION reading_direction) { DWRITE_READING_DIRECTION reading_direction) {
DCHECK(number_substitution); DCHECK(number_substitution);
......
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
#include <dwrite.h> #include <dwrite.h>
#include <wrl.h> #include <wrl.h>
#include <string>
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/string16.h"
#include "ui/gfx/gfx_export.h" #include "ui/gfx/gfx_export.h"
namespace gfx { namespace gfx {
...@@ -26,8 +27,8 @@ class TextAnalysisSource ...@@ -26,8 +27,8 @@ class TextAnalysisSource
// Factory method to avoid exporting the class and all it derives from. // Factory method to avoid exporting the class and all it derives from.
static GFX_EXPORT HRESULT static GFX_EXPORT HRESULT
Create(IDWriteTextAnalysisSource** text_analysis_out, Create(IDWriteTextAnalysisSource** text_analysis_out,
const base::string16& text, const std::wstring& text,
const base::string16& locale_name, const std::wstring& locale_name,
IDWriteNumberSubstitution* number_substitution, IDWriteNumberSubstitution* number_substitution,
DWRITE_READING_DIRECTION reading_direction); DWRITE_READING_DIRECTION reading_direction);
...@@ -53,8 +54,8 @@ class TextAnalysisSource ...@@ -53,8 +54,8 @@ class TextAnalysisSource
UINT32* text_length) override; UINT32* text_length) override;
HRESULT STDMETHODCALLTYPE HRESULT STDMETHODCALLTYPE
RuntimeClassInitialize(const base::string16& text, RuntimeClassInitialize(const std::wstring& text,
const base::string16& locale_name, const std::wstring& locale_name,
IDWriteNumberSubstitution* number_substitution, IDWriteNumberSubstitution* number_substitution,
DWRITE_READING_DIRECTION reading_direction); DWRITE_READING_DIRECTION reading_direction);
...@@ -62,8 +63,8 @@ class TextAnalysisSource ...@@ -62,8 +63,8 @@ class TextAnalysisSource
~TextAnalysisSource() override; ~TextAnalysisSource() override;
private: private:
base::string16 text_; std::wstring text_;
base::string16 locale_name_; std::wstring locale_name_;
Microsoft::WRL::ComPtr<IDWriteNumberSubstitution> number_substitution_; Microsoft::WRL::ComPtr<IDWriteNumberSubstitution> number_substitution_;
DWRITE_READING_DIRECTION reading_direction_; DWRITE_READING_DIRECTION reading_direction_;
......
...@@ -66,7 +66,7 @@ class ClassRegistrar { ...@@ -66,7 +66,7 @@ class ClassRegistrar {
// Represents a registered window class. // Represents a registered window class.
struct RegisteredClass { struct RegisteredClass {
RegisteredClass(const ClassInfo& info, RegisteredClass(const ClassInfo& info,
const base::string16& name, const std::wstring& name,
ATOM atom, ATOM atom,
HINSTANCE instance); HINSTANCE instance);
...@@ -74,7 +74,7 @@ class ClassRegistrar { ...@@ -74,7 +74,7 @@ class ClassRegistrar {
ClassInfo info; ClassInfo info;
// The name given to the window class // The name given to the window class
base::string16 name; std::wstring name;
// The atom identifying the window class. // The atom identifying the window class.
ATOM atom; ATOM atom;
...@@ -126,8 +126,8 @@ ATOM ClassRegistrar::RetrieveClassAtom(const ClassInfo& class_info) { ...@@ -126,8 +126,8 @@ ATOM ClassRegistrar::RetrieveClassAtom(const ClassInfo& class_info) {
} }
// No class found, need to register one. // No class found, need to register one.
base::string16 name = base::string16(WindowImpl::kBaseClassName) + std::wstring name = std::wstring(WindowImpl::kBaseClassName) +
base::NumberToString16(registered_count_++); base::NumberToWString(registered_count_++);
WNDCLASSEX window_class; WNDCLASSEX window_class;
base::win::InitializeWindowClass( base::win::InitializeWindowClass(
...@@ -155,13 +155,10 @@ ATOM ClassRegistrar::RetrieveClassAtom(const ClassInfo& class_info) { ...@@ -155,13 +155,10 @@ ATOM ClassRegistrar::RetrieveClassAtom(const ClassInfo& class_info) {
} }
ClassRegistrar::RegisteredClass::RegisteredClass(const ClassInfo& info, ClassRegistrar::RegisteredClass::RegisteredClass(const ClassInfo& info,
const base::string16& name, const std::wstring& name,
ATOM atom, ATOM atom,
HMODULE instance) HMODULE instance)
: info(info), : info(info), name(name), atom(atom), instance(instance) {}
name(name),
atom(atom),
instance(instance) {}
ClassRegistrar::ClassRegistrar() : registered_count_(0) {} ClassRegistrar::ClassRegistrar() : registered_count_(0) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment