Skip to content

Commit

Permalink
Update some uses of char16 to use the base:: namespace.
Browse files Browse the repository at this point in the history
BUG=329295
TEST=no change
TBR=ben@chromium.org

Review URL: https://codereview.chromium.org/113403006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242503 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
avi@chromium.org committed Dec 25, 2013
1 parent 6c3bf03 commit b6775d7
Show file tree
Hide file tree
Showing 97 changed files with 310 additions and 297 deletions.
2 changes: 1 addition & 1 deletion ash/system/user/tray_user.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const SkColor kBorderColor = 0xffdcdcdc;

// The invisible word joiner character, used as a marker to indicate the start
// and end of the user's display name in the public account user card's text.
const char16 kDisplayNameMark[] = { 0x2060, 0 };
const base::char16 kDisplayNameMark[] = { 0x2060, 0 };

const int kPublicAccountLogoutButtonBorderImagesNormal[] = {
IDR_AURA_TRAY_POPUP_PUBLIC_ACCOUNT_LOGOUT_BUTTON_BORDER,
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/autocomplete/autocomplete_input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ base::string16 AutocompleteInput::FormattedStringWithEquivalentMeaning(
const base::string16& formatted_url) {
if (!net::CanStripTrailingSlash(url))
return formatted_url;
const base::string16 url_with_path(formatted_url + char16('/'));
const base::string16 url_with_path(formatted_url + base::char16('/'));
return (AutocompleteInput::Parse(formatted_url, base::string16(), NULL, NULL,
NULL) ==
AutocompleteInput::Parse(url_with_path, base::string16(), NULL, NULL,
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/autocomplete/autocomplete_match.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bool IsTrivialClassification(const ACMatchClassifications& classifications) {
// AutocompleteMatch ----------------------------------------------------------

// static
const char16 AutocompleteMatch::kInvalidChars[] = {
const base::char16 AutocompleteMatch::kInvalidChars[] = {
'\n', '\r', '\t',
0x2028, // Line separator
0x2029, // Paragraph separator
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/autocomplete/autocomplete_match.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct AutocompleteMatch {

// Null-terminated array of characters that are not valid within |contents|
// and |description| strings.
static const char16 kInvalidChars[];
static const base::char16 kInvalidChars[];

AutocompleteMatch();
AutocompleteMatch(AutocompleteProvider* provider,
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/autocomplete/autocomplete_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ size_t AutocompleteProvider::TrimHttpPrefix(base::string16* url) {
if (!AutocompleteInput::HasHTTPScheme(*url))
return 0;
size_t scheme_pos =
url->find(base::ASCIIToUTF16(content::kHttpScheme) + char16(':'));
url->find(base::ASCIIToUTF16(content::kHttpScheme) + base::char16(':'));
DCHECK_NE(base::string16::npos, scheme_pos);

// Erase scheme plus up to two slashes.
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/autocomplete/extension_app_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void ExtensionAppProvider::Start(const AutocompleteInput& input,
base::string16::const_iterator name_iter =
std::search(name.begin(), name.end(),
input.text().begin(), input.text().end(),
base::CaseInsensitiveCompare<char16>());
base::CaseInsensitiveCompare<base::char16>());
bool matches_name = name_iter != name.end();
size_t name_match_index = matches_name ?
static_cast<size_t>(name_iter - name.begin()) : base::string16::npos;
Expand All @@ -130,7 +130,7 @@ void ExtensionAppProvider::Start(const AutocompleteInput& input,
base::string16::const_iterator url_iter =
std::search(url.begin(), url.end(),
input.text().begin(), input.text().end(),
base::CaseInsensitiveCompare<char16>());
base::CaseInsensitiveCompare<base::char16>());
matches_url = url_iter != url.end() &&
input.type() != AutocompleteInput::FORCED_QUERY;
url_match_index = matches_url ?
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/autocomplete/search_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ AutocompleteMatch SearchProvider::CreateSearchSuggestion(
if (input.type() == AutocompleteInput::FORCED_QUERY)
match.fill_into_edit.assign(base::ASCIIToUTF16("?"));
if (is_keyword)
match.fill_into_edit.append(match.keyword + char16(' '));
match.fill_into_edit.append(match.keyword + base::char16(' '));
if (!input.prevent_inline_autocomplete() &&
StartsWith(query_string, input_text, false)) {
match.inline_autocompletion = query_string.substr(input_text.length());
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/autocomplete/search_provider_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ TEST_F(SearchProviderTest, QueryKeywordProvider) {
EXPECT_FALSE(match.keyword.empty());

// The fill into edit should contain the keyword.
EXPECT_EQ(keyword_t_url_->keyword() + char16(' ') + keyword_term_,
EXPECT_EQ(keyword_t_url_->keyword() + base::char16(' ') + keyword_term_,
match.fill_into_edit);
}

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/autocomplete/shortcuts_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ShortcutsProvider
friend class ClassifyTest;
friend class history::ShortcutsProviderTest;

typedef std::multimap<char16, base::string16> WordMap;
typedef std::multimap<base::char16, base::string16> WordMap;

virtual ~ShortcutsProvider();

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/bookmarks/bookmark_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ BookmarkNode* AsMutable(const BookmarkNode* node) {
}

// Whitespace characters to strip from bookmark titles.
const char16 kInvalidChars[] = {
const base::char16 kInvalidChars[] = {
'\n', '\r', '\t',
0x2028, // Line separator
0x2029, // Paragraph separator
Expand Down
10 changes: 5 additions & 5 deletions chrome/browser/component_updater/background_downloader_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace {

// All jobs created by this module have a specific description so they can
// be found at run-time or by using system administration tools.
const char16 kJobDescription[] = L"Chrome Component Updater";
const base::char16 kJobDescription[] = L"Chrome Component Updater";

// How often the code looks for changes in the BITS job state.
const int kJobPollingIntervalSec = 10;
Expand Down Expand Up @@ -167,15 +167,15 @@ HRESULT GetJobFileProperties(IBackgroundCopyFile* file,
HRESULT hr = S_OK;

if (local_name) {
ScopedCoMem<char16> name;
ScopedCoMem<base::char16> name;
hr = file->GetLocalName(&name);
if (FAILED(hr))
return hr;
local_name->assign(name);
}

if (remote_name) {
ScopedCoMem<char16> name;
ScopedCoMem<base::char16> name;
hr = file->GetRemoteName(&name);
if (FAILED(hr))
return hr;
Expand All @@ -194,7 +194,7 @@ HRESULT GetJobFileProperties(IBackgroundCopyFile* file,
}

HRESULT GetJobDescription(IBackgroundCopyJob* job, const base::string16* name) {
ScopedCoMem<char16> description;
ScopedCoMem<base::char16> description;
return job->GetDescription(&description);
}

Expand Down Expand Up @@ -288,7 +288,7 @@ bool JobFileUrlEqual::operator()(IBackgroundCopyJob* job,
return false;

for (size_t i = 0; i != files.size(); ++i) {
ScopedCoMem<char16> name;
ScopedCoMem<base::char16> name;
if (SUCCEEDED(files[i]->GetRemoteName(&name)) &&
remote_name.compare(name) == 0)
return true;
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/download/download_query_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ template<> void DownloadQueryTest::AddFilter(
}

template<> void DownloadQueryTest::AddFilter(
DownloadQuery::FilterType name, const char16* cpp_value) {
DownloadQuery::FilterType name, const base::char16* cpp_value) {
scoped_ptr<base::Value> value(
base::Value::CreateStringValue(base::string16(cpp_value)));
CHECK(query_.AddFilter(name, *value.get()));
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/drive/drive_api_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ std::string TranslateQuery(const std::string& original_query) {
// In order to handle non-ascii white spaces correctly, convert to UTF16.
base::string16 query = base::UTF8ToUTF16(original_query);
const base::string16 kDelimiter(
base::kWhitespaceUTF16 + base::string16(1, static_cast<char16>('"')));
base::kWhitespaceUTF16 +
base::string16(1, static_cast<base::char16>('"')));

std::string result;
for (size_t index = query.find_first_not_of(base::kWhitespaceUTF16);
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/extensions/extension_error_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ base::string16 ExtensionErrorUI::GenerateMessageSection(
extension_service_->GetInstalledExtension(*iter);
message += l10n_util::GetStringFUTF16(
e->is_app() ? app_template_message_id : extension_template_message_id,
base::UTF8ToUTF16(e->name())) + char16('\n');
base::UTF8ToUTF16(e->name())) + base::char16('\n');
}
return message;
}
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/history/in_memory_url_index_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ TermMatches ReplaceOffsetsInTermMatches(const TermMatches& matches,

typedef std::vector<base::string16> String16Vector;
typedef std::set<base::string16> String16Set;
typedef std::set<char16> Char16Set;
typedef std::vector<char16> Char16Vector;
typedef std::set<base::char16> Char16Set;
typedef std::vector<base::char16> Char16Vector;

// A vector that contains the offsets at which each word starts within a string.
typedef std::vector<size_t> WordStarts;
Expand Down Expand Up @@ -143,7 +143,7 @@ typedef std::map<base::string16, WordID> WordMap;

// A map from character to the word_ids of words containing that character.
typedef std::set<WordID> WordIDSet; // An index into the WordList.
typedef std::map<char16, WordIDSet> CharWordIDMap;
typedef std::map<base::char16, WordIDSet> CharWordIDMap;

// A map from word (by word_id) to history items containing that word.
typedef history::URLID HistoryID;
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/history/url_index_private_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ void URLIndexPrivateData::AddWordHistory(const base::string16& term,
Char16Set characters = Char16SetFromString16(term);
for (Char16Set::iterator uni_char_iter = characters.begin();
uni_char_iter != characters.end(); ++uni_char_iter) {
char16 uni_char = *uni_char_iter;
base::char16 uni_char = *uni_char_iter;
CharWordIDMap::iterator char_iter = char_word_map_.find(uni_char);
if (char_iter != char_word_map_.end()) {
// Update existing entry in the char/word index.
Expand Down Expand Up @@ -868,7 +868,7 @@ void URLIndexPrivateData::RemoveRowWordsFromIndex(const URLRow& row) {
Char16Set characters = Char16SetFromString16(word);
for (Char16Set::iterator uni_char_iter = characters.begin();
uni_char_iter != characters.end(); ++uni_char_iter) {
char16 uni_char = *uni_char_iter;
base::char16 uni_char = *uni_char_iter;
char_word_map_[uni_char].erase(word_id);
if (char_word_map_[uni_char].empty())
char_word_map_.erase(uni_char); // No longer in use.
Expand Down Expand Up @@ -1120,7 +1120,7 @@ bool URLIndexPrivateData::RestoreCharWordMap(
actual_item_count = iter->word_id_size();
if (actual_item_count == 0 || actual_item_count != expected_item_count)
return false;
char16 uni_char = static_cast<char16>(iter->char_16());
base::char16 uni_char = static_cast<base::char16>(iter->char_16());
WordIDSet word_id_set;
const RepeatedField<int32>& word_ids(iter->word_id());
for (RepeatedField<int32>::const_iterator jiter = word_ids.begin();
Expand Down
16 changes: 8 additions & 8 deletions chrome/browser/importer/ie_importer_browsertest_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ const BookmarkInfo kIESortedBookmarks[] = {
{false, 0, {}, L"c", "http://www.google.com/3"},
};

const char16 kIEIdentifyUrl[] =
const base::char16 kIEIdentifyUrl[] =
L"http://A79029D6-753E-4e27-B807-3D46AB1545DF.com:8080/path?key=value";
const char16 kIEIdentifyTitle[] =
const base::char16 kIEIdentifyTitle[] =
L"Unittest GUID";

const char16 kFaviconStreamSuffix[] = L"url:favicon:$DATA";
const base::char16 kFaviconStreamSuffix[] = L"url:favicon:$DATA";
const char kDummyFaviconImageData[] =
"\x42\x4D" // Magic signature 'BM'
"\x1E\x00\x00\x00" // File size
Expand All @@ -101,8 +101,8 @@ const char kDummyFaviconImageData[] =
"\x00\xFF\x00\x00"; // The pixel

struct FaviconGroup {
const char16* favicon_url;
const char16* site_url[2];
const base::char16* favicon_url;
const base::char16* site_url[2];
};

const FaviconGroup kIEFaviconGroup[2] = {
Expand Down Expand Up @@ -216,7 +216,7 @@ void ClearPStoreType(IPStore* pstore, const GUID* type, const GUID* subtype) {
base::win::ScopedComPtr<IEnumPStoreItems, NULL> item;
HRESULT result = pstore->EnumItems(0, type, subtype, 0, item.Receive());
if (result == PST_E_OK) {
char16* item_name;
base::char16* item_name;
while (SUCCEEDED(item->Next(1, &item_name, 0))) {
pstore->DeleteItem(0, type, subtype, item_name, NULL, 0);
CoTaskMemFree(item_name);
Expand All @@ -228,7 +228,7 @@ void ClearPStoreType(IPStore* pstore, const GUID* type, const GUID* subtype) {

void WritePStore(IPStore* pstore, const GUID* type, const GUID* subtype) {
struct PStoreItem {
char16* name;
base::char16* name;
int data_size;
char* data;
} items[] = {
Expand Down Expand Up @@ -501,7 +501,7 @@ IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, IEImporter) {
file_util::WriteFile(path.AppendASCII("InvalidUrlFile.url"), "x", 1);
file_util::WriteFile(path.AppendASCII("PlainTextFile.txt"), "x", 1);

const char16* root_links[] = {
const base::char16* root_links[] = {
L"Links",
L"Google Home Page.url",
L"TheLink.url",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bool IsDirectory(IPortableDeviceValues* properties_values) {
base::string16 GetObjectName(IPortableDeviceValues* properties_values,
bool is_directory) {
DCHECK(properties_values);
base::win::ScopedCoMem<char16> buffer;
base::win::ScopedCoMem<base::char16> buffer;
REFPROPERTYKEY key =
is_directory ? WPD_OBJECT_NAME : WPD_OBJECT_ORIGINAL_FILE_NAME;
HRESULT hr = properties_values->GetStringValue(key, &buffer);
Expand Down Expand Up @@ -269,7 +269,8 @@ bool GetMTPDeviceObjectEntries(IPortableDevice* device,
const bool get_all_entries = object_name.empty();
for (HRESULT hr = S_OK; hr == S_OK;) {
DWORD num_objects_fetched = 0;
scoped_ptr<char16*[]> object_ids(new char16*[num_objects_to_request]);
scoped_ptr<base::char16*[]> object_ids(
new base::char16*[num_objects_to_request]);
hr = enum_object_ids->Next(num_objects_to_request,
object_ids.get(),
&num_objects_fetched);
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/profiles/profile_shortcut_manager_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ const char kProfileIconFileName[] = "Google Profile.ico";

// Characters that are not allowed in Windows filenames. Taken from
// http://msdn.microsoft.com/en-us/library/aa365247.aspx
const char16 kReservedCharacters[] = L"<>:\"/\\|?*\x01\x02\x03\x04\x05\x06\x07"
L"\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19"
L"\x1A\x1B\x1C\x1D\x1E\x1F";
const base::char16 kReservedCharacters[] = L"<>:\"/\\|?*\x01\x02\x03\x04\x05"
L"\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17"
L"\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";

// The maximum number of characters allowed in profile shortcuts' file names.
// Warning: migration code will be needed if this is changed later, since
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/spellchecker/spellcheck_host_metrics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void SpellCheckHostMetrics::RecordCheckedWordStats(const base::string16& word,
// Collects actual number of checked words, excluding duplication.
base::MD5Digest digest;
base::MD5Sum(reinterpret_cast<const unsigned char*>(word.c_str()),
word.size() * sizeof(char16), &digest);
word.size() * sizeof(base::char16), &digest);
checked_word_hashes_.insert(base::MD5DigestToBase16(digest));

RecordWordCounts();
Expand Down
9 changes: 5 additions & 4 deletions chrome/browser/storage_monitor/portable_device_watcher_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
namespace {

// Name of the client application that communicates with the MTP device.
const char16 kClientName[] = L"Chromium";
const base::char16 kClientName[] = L"Chromium";

// Name of the sequenced task runner.
const char kMediaTaskRunnerName[] = "media-task-runner";
Expand Down Expand Up @@ -195,11 +195,11 @@ bool GetStringPropertyValue(IPortableDeviceValues* properties_values,
base::string16* value) {
DCHECK(properties_values);
DCHECK(value);
base::win::ScopedCoMem<char16> buffer;
base::win::ScopedCoMem<base::char16> buffer;
HRESULT hr = properties_values->GetStringValue(key, &buffer);
if (FAILED(hr))
return false;
*value = static_cast<const char16*>(buffer);
*value = static_cast<const base::char16*>(buffer);
return true;
}

Expand Down Expand Up @@ -413,7 +413,8 @@ bool EnumerateAttachedDevicesOnBlockingThread(
if (FAILED(hr))
return false;

scoped_ptr<char16*[]> pnp_device_ids(new char16*[pnp_device_count]);
scoped_ptr<base::char16*[]> pnp_device_ids(
new base::char16*[pnp_device_count]);
hr = portable_device_mgr->GetDevices(pnp_device_ids.get(), &pnp_device_count);
if (FAILED(hr))
return false;
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/storage_monitor/removable_device_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const char kVendorModelVolumeStoragePrefix[] = "VendorModelVolumeStorage:";
#endif

#if defined(OS_WIN)
const char16 kWPDDevInterfaceGUID[] = L"{6ac27878-a6fa-4155-ba85-f98f491d4f33}";
const base::char16 kWPDDevInterfaceGUID[] =
L"{6ac27878-a6fa-4155-ba85-f98f491d4f33}";
#endif

const base::FilePath::CharType kDCIMDirectoryName[] = FILE_PATH_LITERAL("DCIM");
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extern const char kVendorModelVolumeStoragePrefix[];

#if defined(OS_WIN)
// Windows portable device interface GUID constant.
extern const char16 kWPDDevInterfaceGUID[];
extern const base::char16 kWPDDevInterfaceGUID[];
#endif

extern const base::FilePath::CharType kDCIMDirectoryName[];
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/storage_monitor/storage_monitor_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
return name;
if (name.empty())
return addition;
return name + static_cast<char16>(' ') + addition;
return name + static_cast<base::char16>(' ') + addition;
}

StorageInfo::Type GetDeviceType(bool is_removable, bool has_dcim) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void StorageMonitorWinTest::DoMTPDeviceTest(const base::string16& pnp_device_id,
if (FAILED(hr))
return;

size_t device_id_size = pnp_device_id.size() * sizeof(char16);
size_t device_id_size = pnp_device_id.size() * sizeof(base::char16);
size_t size = sizeof(DEV_BROADCAST_DEVICEINTERFACE) + device_id_size;
scoped_ptr_malloc<DEV_BROADCAST_DEVICEINTERFACE> dev_interface_broadcast(
static_cast<DEV_BROADCAST_DEVICEINTERFACE*>(malloc(size)));
Expand Down
Loading

0 comments on commit b6775d7

Please sign in to comment.