diff options
author | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-18 20:03:44 +0000 |
---|---|---|
committer | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-18 20:03:44 +0000 |
commit | 2aadf21d2ff4882cb94510e4107067a70a928850 (patch) | |
tree | 8acbc4f186e6fc73a20292b2baca8efc954d47cb /ui/base | |
parent | df97969962d83bf8ad962bc3d46b824ebeee4af0 (diff) | |
download | chromium_src-2aadf21d2ff4882cb94510e4107067a70a928850.zip chromium_src-2aadf21d2ff4882cb94510e4107067a70a928850.tar.gz chromium_src-2aadf21d2ff4882cb94510e4107067a70a928850.tar.bz2 |
Prefix string16 with base:: in ui/.
R=sky@chromium.org, tsepez@chromium.org
BUG=329295
Review URL: https://codereview.chromium.org/117983002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241625 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base')
52 files changed, 376 insertions, 341 deletions
diff --git a/ui/base/clipboard/clipboard_android.cc b/ui/base/clipboard/clipboard_android.cc index f0971c4..3e56ecd 100644 --- a/ui/base/clipboard/clipboard_android.cc +++ b/ui/base/clipboard/clipboard_android.cc @@ -243,7 +243,7 @@ void Clipboard::Clear(ClipboardType type) { } void Clipboard::ReadAvailableTypes(ClipboardType type, - std::vector<string16>* types, + std::vector<base::string16>* types, bool* contains_filenames) const { DCHECK(CalledOnValidThread()); DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); @@ -259,7 +259,7 @@ void Clipboard::ReadAvailableTypes(ClipboardType type, *contains_filenames = false; } -void Clipboard::ReadText(ClipboardType type, string16* result) const { +void Clipboard::ReadText(ClipboardType type, base::string16* result) const { DCHECK(CalledOnValidThread()); DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); std::string utf8; @@ -275,7 +275,7 @@ void Clipboard::ReadAsciiText(ClipboardType type, std::string* result) const { // Note: |src_url| isn't really used. It is only implemented in Windows void Clipboard::ReadHTML(ClipboardType type, - string16* markup, + base::string16* markup, std::string* src_url, uint32* fragment_start, uint32* fragment_end) const { @@ -317,13 +317,13 @@ SkBitmap Clipboard::ReadImage(ClipboardType type) const { } void Clipboard::ReadCustomData(ClipboardType clipboard_type, - const string16& type, - string16* result) const { + const base::string16& type, + base::string16* result) const { DCHECK(CalledOnValidThread()); NOTIMPLEMENTED(); } -void Clipboard::ReadBookmark(string16* title, std::string* url) const { +void Clipboard::ReadBookmark(base::string16* title, std::string* url) const { DCHECK(CalledOnValidThread()); NOTIMPLEMENTED(); } diff --git a/ui/base/clipboard/clipboard_aura.cc b/ui/base/clipboard/clipboard_aura.cc index 638604b..6fe2ff36 100644 --- a/ui/base/clipboard/clipboard_aura.cc +++ b/ui/base/clipboard/clipboard_aura.cc @@ -186,7 +186,7 @@ class AuraClipboard { } // Reads text from the data at the top of clipboard stack. - void ReadText(string16* result) const { + void ReadText(base::string16* result) const { std::string utf8_result; ReadAsciiText(&utf8_result); *result = UTF8ToUTF16(utf8_result); @@ -207,7 +207,7 @@ class AuraClipboard { } // Reads HTML from the data at the top of clipboard stack. - void ReadHTML(string16* markup, + void ReadHTML(base::string16* markup, std::string* src_url, uint32* fragment_start, uint32* fragment_end) const { @@ -252,7 +252,8 @@ class AuraClipboard { } // Reads data of type |type| from the data at the top of clipboard stack. - void ReadCustomData(const string16& type, string16* result) const { + void ReadCustomData(const base::string16& type, + base::string16* result) const { result->clear(); const ClipboardData* data = GetData(); if (!HasFormat(CUSTOM)) @@ -264,7 +265,7 @@ class AuraClipboard { } // Reads bookmark from the data at the top of clipboard stack. - void ReadBookmark(string16* title, std::string* url) const { + void ReadBookmark(base::string16* title, std::string* url) const { title->clear(); url->clear(); if (!HasFormat(BOOKMARK)) @@ -481,7 +482,7 @@ void Clipboard::Clear(ClipboardType type) { } void Clipboard::ReadAvailableTypes(ClipboardType type, - std::vector<string16>* types, + std::vector<base::string16>* types, bool* contains_filenames) const { DCHECK(CalledOnValidThread()); if (!types || !contains_filenames) { @@ -507,7 +508,7 @@ void Clipboard::ReadAvailableTypes(ClipboardType type, } } -void Clipboard::ReadText(ClipboardType type, string16* result) const { +void Clipboard::ReadText(ClipboardType type, base::string16* result) const { DCHECK(CalledOnValidThread()); GetClipboard()->ReadText(result); } @@ -518,7 +519,7 @@ void Clipboard::ReadAsciiText(ClipboardType type, std::string* result) const { } void Clipboard::ReadHTML(ClipboardType type, - string16* markup, + base::string16* markup, std::string* src_url, uint32* fragment_start, uint32* fragment_end) const { @@ -537,13 +538,13 @@ SkBitmap Clipboard::ReadImage(ClipboardType type) const { } void Clipboard::ReadCustomData(ClipboardType clipboard_type, - const string16& type, - string16* result) const { + const base::string16& type, + base::string16* result) const { DCHECK(CalledOnValidThread()); GetClipboard()->ReadCustomData(type, result); } -void Clipboard::ReadBookmark(string16* title, std::string* url) const { +void Clipboard::ReadBookmark(base::string16* title, std::string* url) const { DCHECK(CalledOnValidThread()); GetClipboard()->ReadBookmark(title, url); } diff --git a/ui/base/clipboard/clipboard_aurax11.cc b/ui/base/clipboard/clipboard_aurax11.cc index 71a545c..3c75154 100644 --- a/ui/base/clipboard/clipboard_aurax11.cc +++ b/ui/base/clipboard/clipboard_aurax11.cc @@ -568,7 +568,7 @@ void Clipboard::Clear(ClipboardType type) { } void Clipboard::ReadAvailableTypes(ClipboardType type, - std::vector<string16>* types, + std::vector<base::string16>* types, bool* contains_filenames) const { DCHECK(CalledOnValidThread()); if (!types || !contains_filenames) { @@ -596,7 +596,7 @@ void Clipboard::ReadAvailableTypes(ClipboardType type, ReadCustomDataTypes(data.GetData(), data.GetSize(), types); } -void Clipboard::ReadText(ClipboardType type, string16* result) const { +void Clipboard::ReadText(ClipboardType type, base::string16* result) const { DCHECK(CalledOnValidThread()); SelectionData data(aurax11_details_->RequestAndWaitForTypes( @@ -619,7 +619,7 @@ void Clipboard::ReadAsciiText(ClipboardType type, std::string* result) const { // TODO(estade): handle different charsets. // TODO(port): set *src_url. void Clipboard::ReadHTML(ClipboardType type, - string16* markup, + base::string16* markup, std::string* src_url, uint32* fragment_start, uint32* fragment_end) const { @@ -665,8 +665,8 @@ SkBitmap Clipboard::ReadImage(ClipboardType type) const { } void Clipboard::ReadCustomData(ClipboardType clipboard_type, - const string16& type, - string16* result) const { + const base::string16& type, + base::string16* result) const { DCHECK(CalledOnValidThread()); SelectionData data(aurax11_details_->RequestAndWaitForTypes( @@ -676,7 +676,7 @@ void Clipboard::ReadCustomData(ClipboardType clipboard_type, ReadCustomDataForType(data.GetData(), data.GetSize(), type, result); } -void Clipboard::ReadBookmark(string16* title, std::string* url) const { +void Clipboard::ReadBookmark(base::string16* title, std::string* url) const { DCHECK(CalledOnValidThread()); // TODO(erg): This was left NOTIMPLEMENTED() in the gtk port too. NOTIMPLEMENTED(); @@ -736,8 +736,8 @@ void Clipboard::WriteBookmark(const char* title_data, const char* url_data, size_t url_len) { // Write as a mozilla url (UTF16: URL, newline, title). - string16 url = UTF8ToUTF16(std::string(url_data, url_len) + "\n"); - string16 title = UTF8ToUTF16(std::string(title_data, title_len)); + base::string16 url = UTF8ToUTF16(std::string(url_data, url_len) + "\n"); + base::string16 title = UTF8ToUTF16(std::string(title_data, title_len)); std::vector<unsigned char> data; ui::AddString16ToVector(url, &data); diff --git a/ui/base/clipboard/clipboard_mac.mm b/ui/base/clipboard/clipboard_mac.mm index 8aee1d3..a774db0 100644 --- a/ui/base/clipboard/clipboard_mac.mm +++ b/ui/base/clipboard/clipboard_mac.mm @@ -223,7 +223,7 @@ void Clipboard::Clear(ClipboardType type) { } void Clipboard::ReadAvailableTypes(ClipboardType type, - std::vector<string16>* types, + std::vector<base::string16>* types, bool* contains_filenames) const { DCHECK(CalledOnValidThread()); types->clear(); @@ -245,7 +245,7 @@ void Clipboard::ReadAvailableTypes(ClipboardType type, } } -void Clipboard::ReadText(ClipboardType type, string16* result) const { +void Clipboard::ReadText(ClipboardType type, base::string16* result) const { DCHECK(CalledOnValidThread()); DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); NSPasteboard* pb = GetPasteboard(); @@ -269,7 +269,7 @@ void Clipboard::ReadAsciiText(ClipboardType type, std::string* result) const { } void Clipboard::ReadHTML(ClipboardType type, - string16* markup, + base::string16* markup, std::string* src_url, uint32* fragment_start, uint32* fragment_end) const { @@ -327,8 +327,8 @@ SkBitmap Clipboard::ReadImage(ClipboardType type) const { } void Clipboard::ReadCustomData(ClipboardType clipboard_type, - const string16& type, - string16* result) const { + const base::string16& type, + base::string16* result) const { DCHECK(CalledOnValidThread()); DCHECK_EQ(clipboard_type, CLIPBOARD_TYPE_COPY_PASTE); @@ -340,7 +340,7 @@ void Clipboard::ReadCustomData(ClipboardType clipboard_type, } } -void Clipboard::ReadBookmark(string16* title, std::string* url) const { +void Clipboard::ReadBookmark(base::string16* title, std::string* url) const { DCHECK(CalledOnValidThread()); NSPasteboard* pb = GetPasteboard(); diff --git a/ui/base/clipboard/clipboard_unittest.cc b/ui/base/clipboard/clipboard_unittest.cc index 324663a..0325b75 100644 --- a/ui/base/clipboard/clipboard_unittest.cc +++ b/ui/base/clipboard/clipboard_unittest.cc @@ -44,9 +44,9 @@ class ClipboardTest : public PlatformTest { namespace { -bool MarkupMatches(const string16& expected_markup, - const string16& actual_markup) { - return actual_markup.find(expected_markup) != string16::npos; +bool MarkupMatches(const base::string16& expected_markup, + const base::string16& actual_markup) { + return actual_markup.find(expected_markup) != base::string16::npos; } } // namespace @@ -67,7 +67,7 @@ TEST_F(ClipboardTest, ClearTest) { } TEST_F(ClipboardTest, TextTest) { - string16 text(ASCIIToUTF16("This is a string16!#$")), text_result; + base::string16 text(ASCIIToUTF16("This is a base::string16!#$")), text_result; std::string ascii_text; { @@ -88,8 +88,8 @@ TEST_F(ClipboardTest, TextTest) { } TEST_F(ClipboardTest, HTMLTest) { - string16 markup(ASCIIToUTF16("<string>Hi!</string>")), markup_result; - string16 plain(ASCIIToUTF16("Hi!")), plain_result; + base::string16 markup(ASCIIToUTF16("<string>Hi!</string>")), markup_result; + base::string16 plain(ASCIIToUTF16("Hi!")), plain_result; std::string url("http://www.example.com/"), url_result; { @@ -133,8 +133,8 @@ TEST_F(ClipboardTest, RTFTest) { #if defined(TOOLKIT_GTK) TEST_F(ClipboardTest, MultipleBufferTest) { - string16 text(ASCIIToUTF16("Standard")), text_result; - string16 markup(ASCIIToUTF16("<string>Selection</string>")), markup_result; + base::string16 text(ASCIIToUTF16("Standard")), text_result; + base::string16 markup(ASCIIToUTF16("<string>Selection</string>")); std::string url("http://www.example.com/"), url_result; { @@ -164,6 +164,7 @@ TEST_F(ClipboardTest, MultipleBufferTest) { EXPECT_EQ(text, text_result); uint32 ignored; + base::string16 markup_result; clipboard().ReadHTML(CLIPBOARD_TYPE_SELECTION, &markup_result, &url_result, @@ -174,10 +175,10 @@ TEST_F(ClipboardTest, MultipleBufferTest) { #endif TEST_F(ClipboardTest, TrickyHTMLTest) { - string16 markup(ASCIIToUTF16("<em>Bye!<!--EndFragment --></em>")), + base::string16 markup(ASCIIToUTF16("<em>Bye!<!--EndFragment --></em>")), markup_result; std::string url, url_result; - string16 plain(ASCIIToUTF16("Bye!")), plain_result; + base::string16 plain(ASCIIToUTF16("Bye!")), plain_result; { ScopedClipboardWriter clipboard_writer(&clipboard(), @@ -201,7 +202,7 @@ TEST_F(ClipboardTest, TrickyHTMLTest) { #if defined(OS_WIN) TEST_F(ClipboardTest, UniodeHTMLTest) { - string16 markup(UTF8ToUTF16("<div>A \xc3\xb8 \xe6\xb0\xb4</div>")), + base::string16 markup(UTF8ToUTF16("<div>A \xc3\xb8 \xe6\xb0\xb4</div>")), markup_result; std::string url, url_result; @@ -237,19 +238,19 @@ TEST_F(ClipboardTest, EmptyHTMLTest) { EXPECT_TRUE(clipboard().IsFormatAvailable(Clipboard::GetHtmlFormatType(), CLIPBOARD_TYPE_COPY_PASTE)); - string16 markup_result; + base::string16 markup_result; std::string url_result; uint32 ignored; clipboard().ReadHTML(CLIPBOARD_TYPE_COPY_PASTE, &markup_result, &url_result, &ignored, &ignored); - EXPECT_PRED2(MarkupMatches, string16(), markup_result); + EXPECT_PRED2(MarkupMatches, base::string16(), markup_result); } #endif // TODO(estade): Port the following test (decide what target we use for urls) #if !defined(OS_POSIX) || defined(OS_MACOSX) TEST_F(ClipboardTest, BookmarkTest) { - string16 title(ASCIIToUTF16("The Example Company")), title_result; + base::string16 title(ASCIIToUTF16("The Example Company")), title_result; std::string url("http://www.example.com/"), url_result; { @@ -267,8 +268,8 @@ TEST_F(ClipboardTest, BookmarkTest) { #endif // defined(OS_WIN) TEST_F(ClipboardTest, MultiFormatTest) { - string16 text(ASCIIToUTF16("Hi!")), text_result; - string16 markup(ASCIIToUTF16("<strong>Hi!</string>")), markup_result; + base::string16 text(ASCIIToUTF16("Hi!")), text_result; + base::string16 markup(ASCIIToUTF16("<strong>Hi!</string>")), markup_result; std::string url("http://www.example.com/"), url_result; std::string ascii_text; @@ -301,7 +302,7 @@ TEST_F(ClipboardTest, MultiFormatTest) { } TEST_F(ClipboardTest, URLTest) { - string16 url(ASCIIToUTF16("http://www.google.com/")); + base::string16 url(ASCIIToUTF16("http://www.google.com/")); { ScopedClipboardWriter clipboard_writer(&clipboard(), @@ -313,7 +314,7 @@ TEST_F(ClipboardTest, URLTest) { Clipboard::GetPlainTextWFormatType(), CLIPBOARD_TYPE_COPY_PASTE)); EXPECT_TRUE(clipboard().IsFormatAvailable(Clipboard::GetPlainTextFormatType(), CLIPBOARD_TYPE_COPY_PASTE)); - string16 text_result; + base::string16 text_result; clipboard().ReadText(CLIPBOARD_TYPE_COPY_PASTE, &text_result); EXPECT_EQ(text_result, url); @@ -625,7 +626,7 @@ TEST_F(ClipboardTest, HyperlinkTest) { "The <Example> Company's "home page"</a>"); std::string url_result; - string16 html_result; + base::string16 html_result; { ScopedClipboardWriter clipboard_writer(&clipboard(), CLIPBOARD_TYPE_COPY_PASTE); diff --git a/ui/base/clipboard/clipboard_util_win.cc b/ui/base/clipboard/clipboard_util_win.cc index b1bf562..0321a96 100644 --- a/ui/base/clipboard/clipboard_util_win.cc +++ b/ui/base/clipboard/clipboard_util_win.cc @@ -34,7 +34,9 @@ bool GetData(IDataObject* data_object, return SUCCEEDED(data_object->GetData(&format_etc, medium)); } -bool GetUrlFromHDrop(IDataObject* data_object, string16* url, string16* title) { +bool GetUrlFromHDrop(IDataObject* data_object, + base::string16* url, + base::string16* title) { DCHECK(data_object && url && title); STGMEDIUM medium; @@ -67,22 +69,22 @@ bool GetUrlFromHDrop(IDataObject* data_object, string16* url, string16* title) { return success; } -void SplitUrlAndTitle(const string16& str, - string16* url, - string16* title) { +void SplitUrlAndTitle(const base::string16& str, + base::string16* url, + base::string16* title) { DCHECK(url && title); size_t newline_pos = str.find('\n'); - if (newline_pos != string16::npos) { + if (newline_pos != base::string16::npos) { url->assign(str, 0, newline_pos); - title->assign(str, newline_pos + 1, string16::npos); + title->assign(str, newline_pos + 1, base::string16::npos); } else { url->assign(str); title->assign(str); } } -bool GetFileUrl(IDataObject* data_object, string16* url, - string16* title) { +bool GetFileUrl(IDataObject* data_object, base::string16* url, + base::string16* title) { STGMEDIUM store; if (GetData(data_object, Clipboard::GetFilenameWFormatType(), &store)) { bool success = false; @@ -164,7 +166,7 @@ bool ClipboardUtil::HasPlainText(IDataObject* data_object) { } bool ClipboardUtil::GetUrl(IDataObject* data_object, - string16* url, string16* title, bool convert_filenames) { + base::string16* url, base::string16* title, bool convert_filenames) { DCHECK(data_object && url && title); if (!HasUrl(data_object)) return false; @@ -203,7 +205,7 @@ bool ClipboardUtil::GetUrl(IDataObject* data_object, } bool ClipboardUtil::GetFilenames(IDataObject* data_object, - std::vector<string16>* filenames) { + std::vector<base::string16>* filenames) { DCHECK(data_object && filenames); if (!HasFilenames(data_object)) return false; @@ -233,7 +235,7 @@ bool ClipboardUtil::GetFilenames(IDataObject* data_object, } bool ClipboardUtil::GetPlainText(IDataObject* data_object, - string16* plain_text) { + base::string16* plain_text) { DCHECK(data_object && plain_text); if (!HasPlainText(data_object)) return false; @@ -261,12 +263,12 @@ bool ClipboardUtil::GetPlainText(IDataObject* data_object, // If a file is dropped on the window, it does not provide either of the // plain text formats, so here we try to forcibly get a url. - string16 title; + base::string16 title; return GetUrl(data_object, plain_text, &title, false); } bool ClipboardUtil::GetHtml(IDataObject* data_object, - string16* html, std::string* base_url) { + base::string16* html, std::string* base_url) { DCHECK(data_object && html && base_url); STGMEDIUM store; @@ -300,7 +302,7 @@ bool ClipboardUtil::GetHtml(IDataObject* data_object, } bool ClipboardUtil::GetFileContents(IDataObject* data_object, - string16* filename, std::string* file_contents) { + base::string16* filename, std::string* file_contents) { DCHECK(data_object && filename && file_contents); if (!HasData(data_object, Clipboard::GetFileContentZeroFormatType()) && !HasData(data_object, Clipboard::GetFileDescriptorFormatType())) @@ -334,7 +336,8 @@ bool ClipboardUtil::GetFileContents(IDataObject* data_object, } bool ClipboardUtil::GetWebCustomData( - IDataObject* data_object, std::map<string16, string16>* custom_data) { + IDataObject* data_object, + std::map<base::string16, base::string16>* custom_data) { DCHECK(data_object && custom_data); if (!HasData(data_object, Clipboard::GetWebCustomDataFormatType())) diff --git a/ui/base/clipboard/clipboard_util_win.h b/ui/base/clipboard/clipboard_util_win.h index f55853d..523897b 100644 --- a/ui/base/clipboard/clipboard_util_win.h +++ b/ui/base/clipboard/clipboard_util_win.h @@ -32,24 +32,26 @@ class UI_EXPORT ClipboardUtil { // Helper methods to extract information from an IDataObject. These methods // return true if the requested data type is found in |data_object|. static bool GetUrl(IDataObject* data_object, - string16* url, - string16* title, + base::string16* url, + base::string16* title, bool convert_filenames); static bool GetFilenames(IDataObject* data_object, - std::vector<string16>* filenames); - static bool GetPlainText(IDataObject* data_object, string16* plain_text); + std::vector<base::string16>* filenames); + static bool GetPlainText(IDataObject* data_object, + base::string16* plain_text); static bool GetHtml(IDataObject* data_object, - string16* text_html, + base::string16* text_html, std::string* base_url); static bool GetFileContents(IDataObject* data_object, - string16* filename, + base::string16* filename, std::string* file_contents); // 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 // to avoid polluting the ::RegisterClipboardFormat() namespace with random // strings from web content. - static bool GetWebCustomData(IDataObject* data_object, - std::map<string16, string16>* custom_data); + static bool GetWebCustomData( + IDataObject* data_object, + std::map<base::string16, base::string16>* custom_data); // Helper method for converting between MS CF_HTML format and plain // text/html. diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc index 92632c7..b2f6e0c 100644 --- a/ui/base/clipboard/clipboard_win.cc +++ b/ui/base/clipboard/clipboard_win.cc @@ -227,7 +227,7 @@ void Clipboard::WriteObjects(ClipboardType type, const ObjectMap& objects) { } void Clipboard::WriteText(const char* text_data, size_t text_len) { - string16 text; + base::string16 text; UTF8ToUTF16(text_data, text_len, &text); HGLOBAL glob = CreateGlobalData(text); @@ -262,7 +262,7 @@ void Clipboard::WriteBookmark(const char* title_data, bookmark.append(1, L'\n'); bookmark.append(url_data, url_len); - string16 wide_bookmark = UTF8ToWide(bookmark); + base::string16 wide_bookmark = UTF8ToWide(bookmark); HGLOBAL glob = CreateGlobalData(wide_bookmark); WriteToClipboard(GetUrlWFormatType().ToUINT(), glob); @@ -395,7 +395,7 @@ void Clipboard::Clear(ClipboardType type) { } void Clipboard::ReadAvailableTypes(ClipboardType type, - std::vector<string16>* types, + std::vector<base::string16>* types, bool* contains_filenames) const { if (!types || !contains_filenames) { NOTREACHED(); @@ -426,7 +426,7 @@ void Clipboard::ReadAvailableTypes(ClipboardType type, ::GlobalUnlock(hdata); } -void Clipboard::ReadText(ClipboardType type, string16* result) const { +void Clipboard::ReadText(ClipboardType type, base::string16* result) const { DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); if (!result) { NOTREACHED(); @@ -471,7 +471,7 @@ void Clipboard::ReadAsciiText(ClipboardType type, std::string* result) const { } void Clipboard::ReadHTML(ClipboardType type, - string16* markup, + base::string16* markup, std::string* src_url, uint32* fragment_start, uint32* fragment_end) const { @@ -599,8 +599,8 @@ SkBitmap Clipboard::ReadImage(ClipboardType type) const { } void Clipboard::ReadCustomData(ClipboardType clipboard_type, - const string16& type, - string16* result) const { + const base::string16& type, + base::string16* result) const { DCHECK_EQ(clipboard_type, CLIPBOARD_TYPE_COPY_PASTE); // Acquire the clipboard. @@ -616,7 +616,7 @@ void Clipboard::ReadCustomData(ClipboardType clipboard_type, ::GlobalUnlock(hdata); } -void Clipboard::ReadBookmark(string16* title, std::string* url) const { +void Clipboard::ReadBookmark(base::string16* title, std::string* url) const { if (title) title->clear(); @@ -632,7 +632,7 @@ void Clipboard::ReadBookmark(string16* title, std::string* url) const { if (!data) return; - string16 bookmark(static_cast<const char16*>(::GlobalLock(data))); + base::string16 bookmark(static_cast<const char16*>(::GlobalLock(data))); ::GlobalUnlock(data); ParseBookmarkClipboardFormat(bookmark, title, url); @@ -658,10 +658,10 @@ void Clipboard::ReadData(const FormatType& format, std::string* result) const { } // static -void Clipboard::ParseBookmarkClipboardFormat(const string16& bookmark, - string16* title, +void Clipboard::ParseBookmarkClipboardFormat(const base::string16& bookmark, + base::string16* title, std::string* url) { - const string16 kDelim = ASCIIToUTF16("\r\n"); + const base::string16 kDelim = ASCIIToUTF16("\r\n"); const size_t title_end = bookmark.find_first_of(kDelim); if (title) @@ -669,8 +669,8 @@ void Clipboard::ParseBookmarkClipboardFormat(const string16& bookmark, if (url) { const size_t url_start = bookmark.find_first_not_of(kDelim, title_end); - if (url_start != string16::npos) - *url = UTF16ToUTF8(bookmark.substr(url_start, string16::npos)); + if (url_start != base::string16::npos) + *url = UTF16ToUTF8(bookmark.substr(url_start, base::string16::npos)); } } diff --git a/ui/base/clipboard/custom_data_helper.cc b/ui/base/clipboard/custom_data_helper.cc index f0b3aa3..a6ac8d2 100644 --- a/ui/base/clipboard/custom_data_helper.cc +++ b/ui/base/clipboard/custom_data_helper.cc @@ -4,7 +4,7 @@ // // TODO(dcheng): For efficiency reasons, consider passing custom data around // as a vector instead. It allows us to append a -// std::pair<string16, string16> and swap the deserialized values in. +// std::pair<base::string16, base::string16> and swap the deserialized values. #include "ui/base/clipboard/custom_data_helper.h" diff --git a/ui/base/clipboard/custom_data_helper_unittest.cc b/ui/base/clipboard/custom_data_helper_unittest.cc index 3183b2b..c770445 100644 --- a/ui/base/clipboard/custom_data_helper_unittest.cc +++ b/ui/base/clipboard/custom_data_helper_unittest.cc @@ -15,13 +15,13 @@ namespace ui { namespace { void PrepareEmptyTestData(Pickle* pickle) { - std::map<string16, string16> data; + std::map<base::string16, base::string16> data; WriteCustomDataToPickle(data, pickle); } void PrepareTestData(Pickle* pickle) { - std::map<string16, string16> data; - data.insert(std::make_pair(ASCIIToUTF16("abc"), string16())); + std::map<base::string16, base::string16> data; + data.insert(std::make_pair(ASCIIToUTF16("abc"), base::string16())); data.insert(std::make_pair(ASCIIToUTF16("de"), ASCIIToUTF16("1"))); data.insert(std::make_pair(ASCIIToUTF16("f"), ASCIIToUTF16("23"))); WriteCustomDataToPickle(data, pickle); @@ -31,7 +31,7 @@ TEST(CustomDataHelperTest, EmptyReadTypes) { Pickle pickle; PrepareEmptyTestData(&pickle); - std::vector<string16> types; + std::vector<base::string16> types; ReadCustomDataTypes(pickle.data(), pickle.size(), &types); EXPECT_EQ(0u, types.size()); } @@ -40,19 +40,19 @@ TEST(CustomDataHelperTest, EmptyReadSingleType) { Pickle pickle; PrepareEmptyTestData(&pickle); - string16 result; + base::string16 result; ReadCustomDataForType(pickle.data(), pickle.size(), ASCIIToUTF16("f"), &result); - EXPECT_EQ(string16(), result); + EXPECT_EQ(base::string16(), result); } TEST(CustomDataHelperTest, EmptyReadMap) { Pickle pickle; PrepareEmptyTestData(&pickle); - std::map<string16, string16> result; + std::map<base::string16, base::string16> result; ReadCustomDataIntoMap(pickle.data(), pickle.size(), &result); EXPECT_EQ(0u, result.size()); } @@ -61,10 +61,10 @@ TEST(CustomDataHelperTest, ReadTypes) { Pickle pickle; PrepareTestData(&pickle); - std::vector<string16> types; + std::vector<base::string16> types; ReadCustomDataTypes(pickle.data(), pickle.size(), &types); - std::vector<string16> expected; + std::vector<base::string16> expected; expected.push_back(ASCIIToUTF16("abc")); expected.push_back(ASCIIToUTF16("de")); expected.push_back(ASCIIToUTF16("f")); @@ -75,12 +75,12 @@ TEST(CustomDataHelperTest, ReadSingleType) { Pickle pickle; PrepareTestData(&pickle); - string16 result; + base::string16 result; ReadCustomDataForType(pickle.data(), pickle.size(), ASCIIToUTF16("abc"), &result); - EXPECT_EQ(string16(), result); + EXPECT_EQ(base::string16(), result); ReadCustomDataForType(pickle.data(), pickle.size(), @@ -99,11 +99,11 @@ TEST(CustomDataHelperTest, ReadMap) { Pickle pickle; PrepareTestData(&pickle); - std::map<string16, string16> result; + std::map<base::string16, base::string16> result; ReadCustomDataIntoMap(pickle.data(), pickle.size(), &result); - std::map<string16, string16> expected; - expected.insert(std::make_pair(ASCIIToUTF16("abc"), string16())); + std::map<base::string16, base::string16> expected; + expected.insert(std::make_pair(ASCIIToUTF16("abc"), base::string16())); expected.insert(std::make_pair(ASCIIToUTF16("de"), ASCIIToUTF16("1"))); expected.insert(std::make_pair(ASCIIToUTF16("f"), ASCIIToUTF16("23"))); EXPECT_EQ(expected, result); @@ -112,7 +112,7 @@ TEST(CustomDataHelperTest, ReadMap) { TEST(CustomDataHelperTest, BadReadTypes) { // ReadCustomDataTypes makes the additional guarantee that the contents of the // result vector will not change if the input is malformed. - std::vector<string16> expected; + std::vector<base::string16> expected; expected.push_back(ASCIIToUTF16("abc")); expected.push_back(ASCIIToUTF16("de")); expected.push_back(ASCIIToUTF16("f")); @@ -121,21 +121,21 @@ TEST(CustomDataHelperTest, BadReadTypes) { malformed.WriteUInt64(1000); malformed.WriteString16(ASCIIToUTF16("hello")); malformed.WriteString16(ASCIIToUTF16("world")); - std::vector<string16> actual(expected); + std::vector<base::string16> actual(expected); ReadCustomDataTypes(malformed.data(), malformed.size(), &actual); EXPECT_EQ(expected, actual); Pickle malformed2; malformed2.WriteUInt64(1); malformed2.WriteString16(ASCIIToUTF16("hello")); - std::vector<string16> actual2(expected); + std::vector<base::string16> actual2(expected); ReadCustomDataTypes(malformed2.data(), malformed2.size(), &actual2); EXPECT_EQ(expected, actual2); } TEST(CustomDataHelperTest, BadPickle) { - string16 result_data; - std::map<string16, string16> result_map; + base::string16 result_data; + std::map<base::string16, base::string16> result_map; Pickle malformed; malformed.WriteUInt64(1000); diff --git a/ui/base/cocoa/find_pasteboard.h b/ui/base/cocoa/find_pasteboard.h index aada8a7..0595ffe 100644 --- a/ui/base/cocoa/find_pasteboard.h +++ b/ui/base/cocoa/find_pasteboard.h @@ -54,6 +54,6 @@ UI_EXPORT #endif // __OBJC__ // Also provide a c++ interface -UI_EXPORT string16 GetFindPboardText(); +UI_EXPORT base::string16 GetFindPboardText(); #endif // UI_BASE_COCOA_FIND_PASTEBOARD_H_ diff --git a/ui/base/cocoa/find_pasteboard.mm b/ui/base/cocoa/find_pasteboard.mm index a74fa78..536d8cc 100644 --- a/ui/base/cocoa/find_pasteboard.mm +++ b/ui/base/cocoa/find_pasteboard.mm @@ -77,6 +77,6 @@ NSString* kFindPasteboardChangedNotification = @end -string16 GetFindPboardText() { +base::string16 GetFindPboardText() { return base::SysNSStringToUTF16([[FindPasteboard sharedInstance] findText]); } diff --git a/ui/base/cocoa/menu_controller.h b/ui/base/cocoa/menu_controller.h index a856404..2082ab3 100644 --- a/ui/base/cocoa/menu_controller.h +++ b/ui/base/cocoa/menu_controller.h @@ -35,7 +35,7 @@ UI_EXPORT // |-initWithModel:useWithPopUpButtonCell:| or after the first call to |-menu|. @property(nonatomic) BOOL useWithPopUpButtonCell; -+ (string16)elideMenuTitle:(const string16&)title ++ (string16)elideMenuTitle:(const base::string16&)title toWidth:(int)width; // NIB-based initializer. This does not create a menu. Clients can set the diff --git a/ui/base/cocoa/menu_controller.mm b/ui/base/cocoa/menu_controller.mm index c7b8dff..4c98c1d 100644 --- a/ui/base/cocoa/menu_controller.mm +++ b/ui/base/cocoa/menu_controller.mm @@ -25,7 +25,7 @@ @synthesize model = model_; @synthesize useWithPopUpButtonCell = useWithPopUpButtonCell_; -+ (string16)elideMenuTitle:(const string16&)title ++ (string16)elideMenuTitle:(const base::string16&)title toWidth:(int)width { NSFont* nsfont = [NSFont menuBarFontOfSize:0]; // 0 means "default" gfx::Font font(base::SysNSStringToUTF8([nsfont fontName]), @@ -102,7 +102,7 @@ - (void)addItemToMenu:(NSMenu*)menu atIndex:(NSInteger)index fromModel:(ui::MenuModel*)model { - string16 label16 = model->GetLabelAt(index); + base::string16 label16 = model->GetLabelAt(index); int maxWidth = [self maxWidthForMenuModel:model modelIndex:index]; if (maxWidth != -1) label16 = [MenuController elideMenuTitle:label16 toWidth:maxWidth]; diff --git a/ui/base/cocoa/menu_controller_unittest.mm b/ui/base/cocoa/menu_controller_unittest.mm index 7cec6c6..3e3af1c 100644 --- a/ui/base/cocoa/menu_controller_unittest.mm +++ b/ui/base/cocoa/menu_controller_unittest.mm @@ -87,7 +87,7 @@ class DynamicDelegate : public Delegate { virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE { return true; } - virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE { + virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE { return label_; } virtual bool GetIconForCommandId( @@ -100,11 +100,11 @@ class DynamicDelegate : public Delegate { return true; } } - void SetDynamicLabel(string16 label) { label_ = label; } + void SetDynamicLabel(base::string16 label) { label_ = label; } void SetDynamicIcon(const gfx::Image& icon) { icon_ = icon; } private: - string16 label_; + base::string16 label_; gfx::Image icon_; }; @@ -222,7 +222,7 @@ TEST_F(MenuControllerTest, PopUpButton) { [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:YES]); EXPECT_EQ([[menu menu] numberOfItems], 4); EXPECT_EQ(base::SysNSStringToUTF16([[[menu menu] itemAtIndex:0] title]), - string16()); + base::string16()); // Make sure the tags are still correct (the index no longer matches the tag). NSMenuItem* itemTwo = [[menu menu] itemAtIndex:2]; @@ -313,7 +313,7 @@ TEST_F(MenuControllerTest, Dynamic) { // Create a menu containing a single item whose label is "initial" and who has // no icon. - string16 initial = ASCIIToUTF16("initial"); + base::string16 initial = ASCIIToUTF16("initial"); delegate.SetDynamicLabel(initial); SimpleMenuModel model(&delegate); model.AddItem(1, ASCIIToUTF16("foo")); @@ -329,7 +329,7 @@ TEST_F(MenuControllerTest, Dynamic) { EXPECT_EQ(nil, [item image]); // Now update the item to have a label of "second" and an icon. - string16 second = ASCIIToUTF16("second"); + base::string16 second = ASCIIToUTF16("second"); delegate.SetDynamicLabel(second); const gfx::Image& icon = ResourceBundle::GetSharedInstance().GetNativeImageNamed(IDR_THROBBER); diff --git a/ui/base/cursor/cursor_loader_win.cc b/ui/base/cursor/cursor_loader_win.cc index 6d35e55..3faa046 100644 --- a/ui/base/cursor/cursor_loader_win.cc +++ b/ui/base/cursor/cursor_loader_win.cc @@ -18,7 +18,7 @@ namespace ui { namespace { -base::LazyInstance<string16> g_cursor_resource_module_name; +base::LazyInstance<base::string16> g_cursor_resource_module_name; const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) { switch (native_cursor.native_type()) { @@ -170,7 +170,8 @@ void CursorLoaderWin::SetPlatformCursor(gfx::NativeCursor* cursor) { #if defined(USE_AURA) // static -void CursorLoaderWin::SetCursorResourceModule(const string16& module_name) { +void CursorLoaderWin::SetCursorResourceModule( + const base::string16& module_name) { g_cursor_resource_module_name.Get() = module_name; } #endif diff --git a/ui/base/cursor/cursor_loader_win.h b/ui/base/cursor/cursor_loader_win.h index fcae566..02e5e40 100644 --- a/ui/base/cursor/cursor_loader_win.h +++ b/ui/base/cursor/cursor_loader_win.h @@ -29,7 +29,7 @@ class UI_EXPORT CursorLoaderWin : public CursorLoader { #if defined(USE_AURA) // Used to pass the cursor resource module name to the cursor loader. This is // typically used to load non system cursors. - static void SetCursorResourceModule(const string16& module_name); + static void SetCursorResourceModule(const base::string16& module_name); #endif private: diff --git a/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc b/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc index ffd0a3c..551ef3b 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc +++ b/ui/base/dragdrop/os_exchange_data_provider_aurax11.cc @@ -123,7 +123,7 @@ void OSExchangeDataProviderAuraX11::SetURL(const GURL& url, const base::string16& title) { // Mozilla's URL format: (UTF16: URL, newline, title) if (url.is_valid()) { - string16 spec = UTF8ToUTF16(url.spec()); + base::string16 spec = UTF8ToUTF16(url.spec()); std::vector<unsigned char> data; ui::AddString16ToVector(spec, &data); @@ -200,7 +200,7 @@ bool OSExchangeDataProviderAuraX11::GetURLAndTitle( if (num_tokens > 1) *title = tokens[1]; else - *title = string16(); + *title = base::string16(); *url = GURL(tokens[0]); return true; @@ -355,7 +355,7 @@ bool OSExchangeDataProviderAuraX11::Dispatch(const base::NativeEvent& event) { } bool OSExchangeDataProviderAuraX11::GetPlainTextURL(GURL* url) const { - string16 text; + base::string16 text; if (GetString(&text)) { GURL test_url(text); if (test_url.is_valid()) { diff --git a/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc b/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc index c3a944a..0cc8f2f0 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc +++ b/ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc @@ -32,12 +32,12 @@ TEST(OSExchangeDataProviderAuraX11Test, MozillaURL) { } // Check that we can get non-titled entries. - provider.SetURL(GURL(kGoogleURL), string16()); + provider.SetURL(GURL(kGoogleURL), base::string16()); { GURL out_gurl; base::string16 out_str; EXPECT_TRUE(provider.GetURLAndTitle(&out_gurl, &out_str)); - EXPECT_EQ(string16(), out_str); + EXPECT_EQ(base::string16(), out_str); EXPECT_EQ(kGoogleURL, out_gurl.spec()); } } diff --git a/ui/base/dragdrop/os_exchange_data_unittest.cc b/ui/base/dragdrop/os_exchange_data_unittest.cc index f2d243d..81f33c8 100644 --- a/ui/base/dragdrop/os_exchange_data_unittest.cc +++ b/ui/base/dragdrop/os_exchange_data_unittest.cc @@ -19,16 +19,16 @@ class OSExchangeDataTest : public PlatformTest { TEST_F(OSExchangeDataTest, StringDataGetAndSet) { OSExchangeData data; - string16 input = ASCIIToUTF16("I can has cheezburger?"); + base::string16 input = ASCIIToUTF16("I can has cheezburger?"); data.SetString(input); OSExchangeData data2(data.provider().Clone()); - string16 output; + base::string16 output; EXPECT_TRUE(data2.GetString(&output)); EXPECT_EQ(input, output); std::string url_spec = "http://www.goats.com/"; GURL url(url_spec); - string16 title; + base::string16 title; EXPECT_FALSE(data2.GetURLAndTitle(&url, &title)); // No URLs in |data|, so url should be untouched. EXPECT_EQ(url_spec, url.spec()); @@ -38,19 +38,19 @@ TEST_F(OSExchangeDataTest, TestURLExchangeFormats) { OSExchangeData data; std::string url_spec = "http://www.google.com/"; GURL url(url_spec); - string16 url_title = ASCIIToUTF16("www.google.com"); + base::string16 url_title = ASCIIToUTF16("www.google.com"); data.SetURL(url, url_title); - string16 output; + base::string16 output; OSExchangeData data2(data.provider().Clone()); // URL spec and title should match GURL output_url; - string16 output_title; + base::string16 output_title; EXPECT_TRUE(data2.GetURLAndTitle(&output_url, &output_title)); EXPECT_EQ(url_spec, output_url.spec()); EXPECT_EQ(url_title, output_title); - string16 output_string; + base::string16 output_string; // URL should be the raw text response EXPECT_TRUE(data2.GetString(&output_string)); @@ -83,14 +83,14 @@ TEST_F(OSExchangeDataTest, TestPickledData) { TEST_F(OSExchangeDataTest, TestHTML) { OSExchangeData data; GURL url("http://www.google.com/"); - string16 html = ASCIIToUTF16( + base::string16 html = ASCIIToUTF16( "<HTML>\n<BODY>\n" "<b>bold.</b> <i><b>This is bold italic.</b></i>\n" "</BODY>\n</HTML>"); data.SetHtml(html, url); OSExchangeData copy(data.provider().Clone()); - string16 read_html; + base::string16 read_html; EXPECT_TRUE(copy.GetHtml(&read_html, &url)); EXPECT_EQ(html, read_html); } diff --git a/ui/base/ime/chromeos/character_composer.cc b/ui/base/ime/chromeos/character_composer.cc index b9fb51f..ed1df4c 100644 --- a/ui/base/ime/chromeos/character_composer.cc +++ b/ui/base/ime/chromeos/character_composer.cc @@ -358,7 +358,7 @@ bool CheckCharacterComposeTable(const ComposeBufferType& sequence, // Converts |character| to UTF16 string. // Returns false when |character| is not a valid character. -bool UTF32CharacterToUTF16(uint32 character, string16* output) { +bool UTF32CharacterToUTF16(uint32 character, base::string16* output) { output->clear(); // Reject invalid character. (e.g. codepoint greater than 0x10ffff) if (!CBU_IS_UNICODE_CHAR(character)) diff --git a/ui/base/ime/chromeos/character_composer.h b/ui/base/ime/chromeos/character_composer.h index 0624eb5..6dffc18 100644 --- a/ui/base/ime/chromeos/character_composer.h +++ b/ui/base/ime/chromeos/character_composer.h @@ -30,10 +30,12 @@ class UI_EXPORT CharacterComposer { // Returns a string consisting of composed character. // Empty string is returned when there is no composition result. - const string16& composed_character() const { return composed_character_; } + const base::string16& composed_character() const { + return composed_character_; + } // Returns the preedit string. - const string16& preedit_string() const { return preedit_string_; } + const base::string16& preedit_string() const { return preedit_string_; } private: friend class CharacterComposerTest; @@ -85,10 +87,10 @@ class UI_EXPORT CharacterComposer { std::vector<unsigned int> compose_buffer_; // A string representing the composed character. - string16 composed_character_; + base::string16 composed_character_; // Preedit string. - string16 preedit_string_; + base::string16 preedit_string_; // Composition mode which this instance is in. CompositionMode composition_mode_; diff --git a/ui/base/ime/chromeos/character_composer_unittest.cc b/ui/base/ime/chromeos/character_composer_unittest.cc index 4e5d7f8..eb3a726 100644 --- a/ui/base/ime/chromeos/character_composer_unittest.cc +++ b/ui/base/ime/chromeos/character_composer_unittest.cc @@ -60,7 +60,7 @@ class CharacterComposerTest : public testing::Test { uint key1, uint key2, int flags, - const string16& expected_character) { + const base::string16& expected_character) { ExpectKeyFiltered(character_composer, key1, flags); EXPECT_TRUE(character_composer->FilterKeyPressInternal(key2, 0, flags)); EXPECT_EQ(expected_character, character_composer->composed_character()); @@ -72,7 +72,7 @@ class CharacterComposerTest : public testing::Test { uint key2, uint key3, int flags, - const string16& expected_character) { + const base::string16& expected_character) { ExpectKeyFiltered(character_composer, key1, flags); ExpectCharacterComposed(character_composer, key2, key3, flags, expected_character); @@ -86,7 +86,7 @@ class CharacterComposerTest : public testing::Test { uint key3, uint key4, int flags, - const string16& expected_character) { + const base::string16& expected_character) { ExpectKeyFiltered(character_composer, key1, flags); ExpectCharacterComposed(character_composer, key2, key3, key4, flags, expected_character); @@ -101,7 +101,7 @@ class CharacterComposerTest : public testing::Test { uint key4, uint key5, int flags, - const string16& expected_character) { + const base::string16& expected_character) { ExpectKeyFiltered(character_composer, key1, flags); ExpectCharacterComposed(character_composer, key2, key3, key4, key5, flags, expected_character); @@ -117,17 +117,18 @@ class CharacterComposerTest : public testing::Test { uint key5, uint key6, int flags, - const string16& expected_character) { + const base::string16& expected_character) { ExpectKeyFiltered(character_composer, key1, flags); ExpectCharacterComposed(character_composer, key2, key3, key4, key5, key6, flags, expected_character); } // Expects |expected_character| is composed after sequence [{key1, keycode1}]. - void ExpectCharacterComposedWithKeyCode(CharacterComposer* character_composer, - uint key1, uint keycode1, - int flags, - const string16& expected_character) { + void ExpectCharacterComposedWithKeyCode( + CharacterComposer* character_composer, + uint key1, uint keycode1, + int flags, + const base::string16& expected_character) { EXPECT_TRUE(character_composer->FilterKeyPressInternal(key1, keycode1, flags)); EXPECT_EQ(expected_character, character_composer->composed_character()); @@ -167,26 +168,27 @@ TEST_F(CharacterComposerTest, FullyMatchingSequences) { CharacterComposer character_composer; // LATIN SMALL LETTER A WITH ACUTE ExpectCharacterComposed(&character_composer, GDK_KEY_dead_acute, GDK_KEY_a, 0, - string16(1, 0x00E1)); + base::string16(1, 0x00E1)); // LATIN CAPITAL LETTER A WITH ACUTE ExpectCharacterComposed(&character_composer, GDK_KEY_dead_acute, GDK_KEY_A, 0, - string16(1, 0x00C1)); + base::string16(1, 0x00C1)); // GRAVE ACCENT ExpectCharacterComposed(&character_composer, GDK_KEY_dead_grave, - GDK_KEY_dead_grave, 0, string16(1, 0x0060)); + GDK_KEY_dead_grave, 0, base::string16(1, 0x0060)); // LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE ExpectCharacterComposed(&character_composer, GDK_KEY_dead_acute, GDK_KEY_dead_circumflex, GDK_KEY_a, 0, - string16(1, 0x1EA5)); + base::string16(1, 0x1EA5)); // LATIN CAPITAL LETTER U WITH HORN AND GRAVE ExpectCharacterComposed(&character_composer, GDK_KEY_dead_grave, - GDK_KEY_dead_horn, GDK_KEY_U, 0, string16(1, 0x1EEA)); + GDK_KEY_dead_horn, GDK_KEY_U, 0, + base::string16(1, 0x1EEA)); // LATIN CAPITAL LETTER C WITH CEDILLA ExpectCharacterComposed(&character_composer, GDK_KEY_dead_acute, GDK_KEY_C, 0, - string16(1, 0x00C7)); + base::string16(1, 0x00C7)); // LATIN SMALL LETTER C WITH CEDILLA ExpectCharacterComposed(&character_composer, GDK_KEY_dead_acute, GDK_KEY_c, 0, - string16(1, 0x00E7)); + base::string16(1, 0x00E7)); } TEST_F(CharacterComposerTest, FullyMatchingSequencesAfterMatchingFailure) { @@ -198,13 +200,13 @@ TEST_F(CharacterComposerTest, FullyMatchingSequencesAfterMatchingFailure) { // LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE ExpectCharacterComposed(&character_composer, GDK_KEY_dead_acute, GDK_KEY_dead_circumflex, GDK_KEY_a, 0, - string16(1, 0x1EA5)); + base::string16(1, 0x1EA5)); } TEST_F(CharacterComposerTest, ComposedCharacterIsClearedAfterReset) { CharacterComposer character_composer; ExpectCharacterComposed(&character_composer, GDK_KEY_dead_acute, GDK_KEY_a, 0, - string16(1, 0x00E1)); + base::string16(1, 0x00E1)); character_composer.Reset(); EXPECT_TRUE(character_composer.composed_character().empty()); } @@ -225,7 +227,7 @@ TEST_F(CharacterComposerTest, KeySequenceCompositionPreedit) { ExpectKeyFiltered(&character_composer, GDK_KEY_dead_acute, 0); EXPECT_TRUE(character_composer.preedit_string().empty()); EXPECT_TRUE(FilterKeyPress(&character_composer, GDK_KEY_a, 0, 0)); - EXPECT_EQ(string16(1, 0x00E1), character_composer.composed_character()); + EXPECT_EQ(base::string16(1, 0x00E1), character_composer.composed_character()); EXPECT_TRUE(character_composer.preedit_string().empty()); } @@ -281,14 +283,15 @@ TEST_F(CharacterComposerTest, HexadecimalComposition) { ExpectKeyFiltered(&character_composer, GDK_KEY_U, EF_SHIFT_DOWN | EF_CONTROL_DOWN); ExpectCharacterComposed(&character_composer, GDK_KEY_3, GDK_KEY_0, GDK_KEY_4, - GDK_KEY_2, GDK_KEY_space, 0, string16(1, 0x3042)); + GDK_KEY_2, GDK_KEY_space, 0, + base::string16(1, 0x3042)); // MUSICAL KEYBOARD (U+1F3B9) const char16 kMusicalKeyboard[] = {0xd83c, 0xdfb9}; ExpectKeyFiltered(&character_composer, GDK_KEY_U, EF_SHIFT_DOWN | EF_CONTROL_DOWN); ExpectCharacterComposed(&character_composer, GDK_KEY_1, GDK_KEY_f, GDK_KEY_3, GDK_KEY_b, GDK_KEY_9, GDK_KEY_Return, 0, - string16(kMusicalKeyboard, + base::string16(kMusicalKeyboard, kMusicalKeyboard + arraysize(kMusicalKeyboard))); } @@ -310,7 +313,7 @@ TEST_F(CharacterComposerTest, HexadecimalCompositionPreedit) { ExpectKeyFiltered(&character_composer, GDK_KEY_BackSpace, 0); EXPECT_EQ(ASCIIToUTF16("u304"), character_composer.preedit_string()); ExpectCharacterComposed(&character_composer, GDK_KEY_2, GDK_KEY_Return, 0, - string16(1, 0x3042)); + base::string16(1, 0x3042)); EXPECT_EQ(ASCIIToUTF16(""), character_composer.preedit_string()); // Sequence with an ignored character ('x') and Escape. @@ -346,7 +349,7 @@ TEST_F(CharacterComposerTest, HexadecimalCompositionWithNonHexKey) { EF_SHIFT_DOWN | EF_CONTROL_DOWN); ExpectCharacterComposed(&character_composer, GDK_KEY_3, GDK_KEY_0, GDK_KEY_x, GDK_KEY_4, GDK_KEY_2, GDK_KEY_space, 0, - string16(1, 0x3042)); + base::string16(1, 0x3042)); } TEST_F(CharacterComposerTest, HexadecimalCompositionWithAdditionalModifiers) { @@ -357,7 +360,8 @@ TEST_F(CharacterComposerTest, HexadecimalCompositionWithAdditionalModifiers) { ExpectKeyFiltered(&character_composer, GDK_KEY_U, EF_SHIFT_DOWN | EF_CONTROL_DOWN | EF_ALT_DOWN); ExpectCharacterComposed(&character_composer, GDK_KEY_3, GDK_KEY_0, GDK_KEY_4, - GDK_KEY_2, GDK_KEY_space, 0, string16(1, 0x3042)); + GDK_KEY_2, GDK_KEY_space, 0, + base::string16(1, 0x3042)); // Ctrl+Shift+u (CapsLock enabled) ExpectKeyNotFiltered(&character_composer, GDK_KEY_u, @@ -378,7 +382,8 @@ TEST_F(CharacterComposerTest, CancelHexadecimalComposition) { ExpectKeyFiltered(&character_composer, GDK_KEY_U, EF_SHIFT_DOWN | EF_CONTROL_DOWN); ExpectCharacterComposed(&character_composer, GDK_KEY_3, GDK_KEY_0, GDK_KEY_4, - GDK_KEY_2, GDK_KEY_space, 0, string16(1, 0x3042)); + GDK_KEY_2, GDK_KEY_space, 0, + base::string16(1, 0x3042)); } TEST_F(CharacterComposerTest, HexadecimalCompositionWithBackspace) { @@ -391,7 +396,7 @@ TEST_F(CharacterComposerTest, HexadecimalCompositionWithBackspace) { ExpectKeyFiltered(&character_composer, GDK_KEY_f, 0); ExpectKeyFiltered(&character_composer, GDK_KEY_BackSpace, 0); ExpectCharacterComposed(&character_composer, GDK_KEY_4, GDK_KEY_2, - GDK_KEY_space, 0, string16(1, 0x3042)); + GDK_KEY_space, 0, base::string16(1, 0x3042)); } TEST_F(CharacterComposerTest, CancelHexadecimalCompositionWithBackspace) { @@ -442,7 +447,7 @@ TEST_F(CharacterComposerTest, HexadecimalCompositionPreeditWithModifierPressed) ExpectCharacterComposedWithKeyCode(&character_composer, GDK_KEY_Return, 36, control_shift, - string16(1, 0x3042)); + base::string16(1, 0x3042)); EXPECT_EQ(ASCIIToUTF16(""), character_composer.preedit_string()); // Sequence with an ignored character (control + shift + 'x') and Escape. @@ -509,18 +514,18 @@ TEST_F(CharacterComposerTest, HexadecimalSequenceAndDeadKey) { CharacterComposer character_composer; // LATIN SMALL LETTER A WITH ACUTE ExpectCharacterComposed(&character_composer, GDK_KEY_dead_acute, GDK_KEY_a, 0, - string16(1, 0x00E1)); + base::string16(1, 0x00E1)); // HIRAGANA LETTER A (U+3042) with dead_acute ignored. ExpectKeyFiltered(&character_composer, GDK_KEY_U, EF_SHIFT_DOWN | EF_CONTROL_DOWN); ExpectCharacterComposed(&character_composer, GDK_KEY_3, GDK_KEY_0, GDK_KEY_dead_acute, GDK_KEY_4, GDK_KEY_2, - GDK_KEY_space, 0, string16(1, 0x3042)); + GDK_KEY_space, 0, base::string16(1, 0x3042)); // LATIN CAPITAL LETTER U WITH ACUTE while 'U' is pressed with Ctrl+Shift. ExpectKeyFiltered(&character_composer, GDK_KEY_dead_acute, 0); EXPECT_TRUE(FilterKeyPress(&character_composer, GDK_KEY_U, 0, EF_SHIFT_DOWN | EF_CONTROL_DOWN)); - EXPECT_EQ(string16(1, 0x00DA), character_composer.composed_character()); + EXPECT_EQ(base::string16(1, 0x00DA), character_composer.composed_character()); } TEST_F(CharacterComposerTest, BlacklistedKeyeventsTest) { diff --git a/ui/base/ime/dummy_text_input_client.cc b/ui/base/ime/dummy_text_input_client.cc index 652e2c5..5dbd69b 100644 --- a/ui/base/ime/dummy_text_input_client.cc +++ b/ui/base/ime/dummy_text_input_client.cc @@ -23,7 +23,7 @@ void DummyTextInputClient::ConfirmCompositionText() { void DummyTextInputClient::ClearCompositionText() { } -void DummyTextInputClient::InsertText(const string16& text) { +void DummyTextInputClient::InsertText(const base::string16& text) { } void DummyTextInputClient::InsertChar(char16 ch, int flags) { @@ -80,7 +80,7 @@ bool DummyTextInputClient::DeleteRange(const gfx::Range& range) { } bool DummyTextInputClient::GetTextFromRange(const gfx::Range& range, - string16* text) const { + base::string16* text) const { return false; } diff --git a/ui/base/ime/dummy_text_input_client.h b/ui/base/ime/dummy_text_input_client.h index 1242bb9..b2ebe64 100644 --- a/ui/base/ime/dummy_text_input_client.h +++ b/ui/base/ime/dummy_text_input_client.h @@ -20,7 +20,7 @@ class DummyTextInputClient : public TextInputClient { const ui::CompositionText& composition) OVERRIDE; virtual void ConfirmCompositionText() OVERRIDE; virtual void ClearCompositionText() OVERRIDE; - virtual void InsertText(const string16& text) OVERRIDE; + virtual void InsertText(const base::string16& text) OVERRIDE; virtual void InsertChar(char16 ch, int flags) OVERRIDE; virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE; virtual ui::TextInputType GetTextInputType() const OVERRIDE; @@ -36,7 +36,7 @@ class DummyTextInputClient : public TextInputClient { virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE; virtual bool DeleteRange(const gfx::Range& range) OVERRIDE; virtual bool GetTextFromRange(const gfx::Range& range, - string16* text) const OVERRIDE; + base::string16* text) const OVERRIDE; virtual void OnInputMethodChanged() OVERRIDE; virtual bool ChangeTextDirectionAndLayoutAlignment( base::i18n::TextDirection direction) OVERRIDE; diff --git a/ui/base/ime/input_method_ibus.cc b/ui/base/ime/input_method_ibus.cc index 6f1213b..317e33a 100644 --- a/ui/base/ime/input_method_ibus.cc +++ b/ui/base/ime/input_method_ibus.cc @@ -182,7 +182,7 @@ void InputMethodIBus::OnCaretBoundsChanged(const TextInputClient* client) { gfx::Range text_range; gfx::Range selection_range; - string16 surrounding_text; + base::string16 surrounding_text; if (!GetTextInputClient()->GetTextRange(&text_range) || !GetTextInputClient()->GetTextFromRange(text_range, &surrounding_text) || !GetTextInputClient()->GetSelectionRange(&selection_range)) { @@ -435,7 +435,7 @@ void InputMethodIBus::ProcessInputMethodResult(const ui::KeyEvent& event, if (result_text_.length()) { if (handled && NeedInsertChar()) { - for (string16::const_iterator i = result_text_.begin(); + for (base::string16::const_iterator i = result_text_.begin(); i != result_text_.end(); ++i) { client->InsertChar(*i, event.flags()); } @@ -484,7 +484,7 @@ void InputMethodIBus::CommitText(const std::string& text) { if (!GetTextInputClient()) return; - const string16 utf16_text = UTF8ToUTF16(text); + const base::string16 utf16_text = UTF8ToUTF16(text); if (utf16_text.empty()) return; diff --git a/ui/base/ime/input_method_ibus.h b/ui/base/ime/input_method_ibus.h index 01f958d..ebae6df 100644 --- a/ui/base/ime/input_method_ibus.h +++ b/ui/base/ime/input_method_ibus.h @@ -132,9 +132,9 @@ class UI_EXPORT InputMethodIBus // Pending result text generated by the current pending key event. // It'll be sent to the focused text input client as soon as we receive the // processing result of the pending key event. - string16 result_text_; + base::string16 result_text_; - string16 previous_surrounding_text_; + base::string16 previous_surrounding_text_; gfx::Range previous_selection_range_; // Indicates if input context is focused or not. diff --git a/ui/base/ime/input_method_ibus_unittest.cc b/ui/base/ime/input_method_ibus_unittest.cc index e381aa4..ef84c12 100644 --- a/ui/base/ime/input_method_ibus_unittest.cc +++ b/ui/base/ime/input_method_ibus_unittest.cc @@ -33,7 +33,7 @@ typedef chromeos::IBusEngineHandlerInterface::KeyEventDoneCallback KeyEventCallback; uint32 GetOffsetInUTF16(const std::string& utf8_string, uint32 utf8_offset) { - string16 utf16_string = UTF8ToUTF16(utf8_string); + base::string16 utf16_string = UTF8ToUTF16(utf8_string); DCHECK_LT(utf8_offset, utf16_string.size()); base::i18n::UTF16CharIterator char_iterator(&utf16_string); for (size_t i = 0; i < utf8_offset; ++i) @@ -257,7 +257,7 @@ class InputMethodIBusTest : public internal::InputMethodDelegate, virtual void ClearCompositionText() OVERRIDE { composition_text_.Clear(); } - virtual void InsertText(const string16& text) OVERRIDE { + virtual void InsertText(const base::string16& text) OVERRIDE { inserted_text_ = text; } virtual void InsertChar(char16 ch, int flags) OVERRIDE { @@ -302,7 +302,7 @@ class InputMethodIBusTest : public internal::InputMethodDelegate, virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE { return false; } virtual bool DeleteRange(const gfx::Range& range) OVERRIDE { return false; } virtual bool GetTextFromRange(const gfx::Range& range, - string16* text) const OVERRIDE { + base::string16* text) const OVERRIDE { *text = surrounding_text_.substr(range.GetMin(), range.length()); return true; } @@ -359,7 +359,7 @@ class InputMethodIBusTest : public internal::InputMethodDelegate, // ui::TextInputClient functions. CompositionText composition_text_; CompositionText confirmed_text_; - string16 inserted_text_; + base::string16 inserted_text_; char16 inserted_char_; unsigned int on_input_method_changed_call_count_; int inserted_char_flags_; @@ -371,7 +371,7 @@ class InputMethodIBusTest : public internal::InputMethodDelegate, gfx::Rect caret_bounds_; gfx::Range text_range_; gfx::Range selection_range_; - string16 surrounding_text_; + base::string16 surrounding_text_; scoped_ptr<chromeos::MockIMEEngineHandler> mock_ime_engine_handler_; scoped_ptr<chromeos::MockIMECandidateWindowHandler> @@ -599,7 +599,7 @@ TEST_F(InputMethodIBusTest, ExtractCompositionTextTest_NoAttribute) { const char kSampleText[] = "Sample Text"; const uint32 kCursorPos = 2UL; - const string16 utf16_string = UTF8ToUTF16(kSampleText); + const base::string16 utf16_string = UTF8ToUTF16(kSampleText); chromeos::IBusText ibus_text; ibus_text.set_text(kSampleText); diff --git a/ui/base/ime/input_method_win.cc b/ui/base/ime/input_method_win.cc index 5a30792..f59faa6 100644 --- a/ui/base/ime/input_method_win.cc +++ b/ui/base/ime/input_method_win.cc @@ -210,7 +210,7 @@ LRESULT InputMethodWin::OnDocumentFeed(RECONVERTSTRING* reconv) { if (reconv->dwSize < need_size) return 0; - string16 text; + base::string16 text; if (!GetTextInputClient()->GetTextFromRange(text_range, &text)) return 0; DCHECK_EQ(text_range.length(), text.length()); @@ -266,7 +266,7 @@ LRESULT InputMethodWin::OnReconvertString(RECONVERTSTRING* reconv) { // TODO(penghuang): Return some extra context to help improve IME's // reconversion accuracy. - string16 text; + base::string16 text; if (!GetTextInputClient()->GetTextFromRange(selection_range, &text)) return 0; DCHECK_EQ(selection_range.length(), text.length()); diff --git a/ui/base/ime/remote_input_method_win_unittest.cc b/ui/base/ime/remote_input_method_win_unittest.cc index 084819e..7c3531e 100644 --- a/ui/base/ime/remote_input_method_win_unittest.cc +++ b/ui/base/ime/remote_input_method_win_unittest.cc @@ -94,7 +94,7 @@ class MockTextInputClient : public DummyTextInputClient { inserted_text_.append(1, ch); ++call_count_insert_char_; } - virtual void InsertText(const string16& text) OVERRIDE{ + virtual void InsertText(const base::string16& text) OVERRIDE{ inserted_text_.append(text); ++call_count_insert_text_; } diff --git a/ui/base/ime/win/imm32_manager.cc b/ui/base/ime/win/imm32_manager.cc index 093b010..23f1d9d 100644 --- a/ui/base/ime/win/imm32_manager.cc +++ b/ui/base/ime/win/imm32_manager.cc @@ -368,7 +368,7 @@ void IMM32Manager::GetCompositionInfo(HIMC imm_context, LPARAM lparam, bool IMM32Manager::GetString(HIMC imm_context, WPARAM lparam, int type, - string16* result) { + base::string16* result) { if (!(lparam & type)) return false; LONG string_size = ::ImmGetCompositionString(imm_context, type, NULL, 0); @@ -381,7 +381,7 @@ bool IMM32Manager::GetString(HIMC imm_context, } bool IMM32Manager::GetResult( - HWND window_handle, LPARAM lparam, string16* result) { + HWND window_handle, LPARAM lparam, base::string16* result) { bool ret = false; HIMC imm_context = ::ImmGetContext(window_handle); if (imm_context) { diff --git a/ui/base/ime/win/imm32_manager.h b/ui/base/ime/win/imm32_manager.h index 17892cb..d82c460 100644 --- a/ui/base/ime/win/imm32_manager.h +++ b/ui/base/ime/win/imm32_manager.h @@ -154,7 +154,7 @@ class UI_EXPORT IMM32Manager { // the same parameter of a WM_IME_COMPOSITION message handler. // This parameter is used for checking if the ongoing composition has // its result string, - // * result [out] (string16) + // * result [out] (base::string16) // Represents the object contains the composition result. // Return values // * true @@ -164,7 +164,7 @@ class UI_EXPORT IMM32Manager { // Remarks // This function is designed for being called from WM_IME_COMPOSITION // message handlers. - bool GetResult(HWND window_handle, LPARAM lparam, string16* result); + bool GetResult(HWND window_handle, LPARAM lparam, base::string16* result); // Retrieves the current composition status of the ongoing composition. // Parameters @@ -274,7 +274,10 @@ class UI_EXPORT IMM32Manager { void CompleteComposition(HWND window_handle, HIMC imm_context); // Retrieves a string from the IMM. - bool GetString(HIMC imm_context, WPARAM lparam, int type, string16* result); + bool GetString(HIMC imm_context, + WPARAM lparam, + int type, + base::string16* result); private: // Represents whether or not there is an ongoing composition in a browser diff --git a/ui/base/ime/win/tsf_text_store.cc b/ui/base/ime/win/tsf_text_store.cc index 0ef34b5..aa55fae 100644 --- a/ui/base/ime/win/tsf_text_store.cc +++ b/ui/base/ime/win/tsf_text_store.cc @@ -253,7 +253,7 @@ STDMETHODIMP TSFTextStore::GetText(LONG acp_start, acp_end = std::min(acp_end, acp_start + static_cast<LONG>(text_buffer_size)); *text_buffer_copied = acp_end - acp_start; - const string16& result = + const base::string16& result = string_buffer_.substr(acp_start, *text_buffer_copied); for (size_t i = 0; i < result.size(); ++i) { text_buffer[i] = result[i]; @@ -412,7 +412,7 @@ STDMETHODIMP TSFTextStore::InsertTextAtSelection(DWORD flags, DCHECK_LE(start_pos, end_pos); string_buffer_ = string_buffer_.substr(0, start_pos) + - string16(text_buffer, text_buffer + text_buffer_size) + + base::string16(text_buffer, text_buffer + text_buffer_size) + string_buffer_.substr(end_pos); if (acp_start) *acp_start = start_pos; @@ -523,10 +523,10 @@ STDMETHODIMP TSFTextStore::RequestLock(DWORD lock_flags, HRESULT* result) { // If the text store is edited in OnLockGranted(), we may need to call // TextInputClient::InsertText() or TextInputClient::SetCompositionText(). const size_t new_committed_size = committed_size_; - const string16& new_committed_string = + const base::string16& new_committed_string = string_buffer_.substr(last_committed_size, new_committed_size - last_committed_size); - const string16& composition_string = + const base::string16& composition_string = string_buffer_.substr(new_committed_size); // If there is new committed string, calls TextInputClient::InsertText(). @@ -884,7 +884,8 @@ bool TSFTextStore::ConfirmComposition() { // This logic is based on the observation about how to emulate // ImmNotifyIME(NI_COMPOSITIONSTR, CPS_COMPLETE, 0) by CUAS. - const string16& composition_text = string_buffer_.substr(committed_size_); + const base::string16& composition_text = + string_buffer_.substr(committed_size_); if (!composition_text.empty()) text_input_client_->InsertText(composition_text); diff --git a/ui/base/ime/win/tsf_text_store.h b/ui/base/ime/win/tsf_text_store.h index 87cd6b4..a244c57 100644 --- a/ui/base/ime/win/tsf_text_store.h +++ b/ui/base/ime/win/tsf_text_store.h @@ -250,7 +250,7 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP, // Example: "aoi" is committed, and "umi" is under composition. // |string_buffer_|: "aoiumi" // |committed_size_|: 3 - string16 string_buffer_; + base::string16 string_buffer_; size_t committed_size_; // |selection_start_| and |selection_end_| indicates the selection range. diff --git a/ui/base/ime/win/tsf_text_store_unittest.cc b/ui/base/ime/win/tsf_text_store_unittest.cc index 33812a4e..48f4c24 100644 --- a/ui/base/ime/win/tsf_text_store_unittest.cc +++ b/ui/base/ime/win/tsf_text_store_unittest.cc @@ -29,7 +29,7 @@ class MockTextInputClient : public TextInputClient { MOCK_METHOD1(SetCompositionText, void(const ui::CompositionText&)); MOCK_METHOD0(ConfirmCompositionText, void()); MOCK_METHOD0(ClearCompositionText, void()); - MOCK_METHOD1(InsertText, void(const string16&)); + MOCK_METHOD1(InsertText, void(const base::string16&)); MOCK_METHOD2(InsertChar, void(char16, int)); MOCK_CONST_METHOD0(GetAttachedWindow, gfx::NativeWindow()); MOCK_CONST_METHOD0(GetTextInputType, ui::TextInputType()); @@ -43,7 +43,8 @@ class MockTextInputClient : public TextInputClient { MOCK_CONST_METHOD1(GetSelectionRange, bool(gfx::Range*)); MOCK_METHOD1(SetSelectionRange, bool(const gfx::Range&)); MOCK_METHOD1(DeleteRange, bool(const gfx::Range&)); - MOCK_CONST_METHOD2(GetTextFromRange, bool(const gfx::Range&, string16*)); + MOCK_CONST_METHOD2(GetTextFromRange, bool(const gfx::Range&, + base::string16*)); MOCK_METHOD0(OnInputMethodChanged, void()); MOCK_METHOD1(ChangeTextDirectionAndLayoutAlignment, bool(base::i18n::TextDirection)); @@ -128,7 +129,7 @@ class TSFTextStoreTest : public testing::Test { } // Accessors to the internal state of TSFTextStore. - string16* string_buffer() { return &text_store_->string_buffer_; } + base::string16* string_buffer() { return &text_store_->string_buffer_; } size_t* committed_size() { return &text_store_->committed_size_; } base::win::ScopedCOMInitializer com_initializer_; @@ -148,14 +149,14 @@ class TSFTextStoreTestCallback { protected: // Accessors to the internal state of TSFTextStore. bool* edit_flag() { return &text_store_->edit_flag_; } - string16* string_buffer() { return &text_store_->string_buffer_; } + base::string16* string_buffer() { return &text_store_->string_buffer_; } size_t* committed_size() { return &text_store_->committed_size_; } gfx::Range* selection() { return &text_store_->selection_; } CompositionUnderlines* composition_undelines() { return &text_store_->composition_undelines_; } - void SetInternalState(const string16& new_string_buffer, + void SetInternalState(const base::string16& new_string_buffer, LONG new_committed_size, LONG new_selection_start, LONG new_selection_end) { ASSERT_LE(0, new_committed_size); @@ -193,7 +194,7 @@ class TSFTextStoreTestCallback { } void SetTextTest(LONG acp_start, LONG acp_end, - const string16& text, HRESULT error_code) { + const base::string16& text, HRESULT error_code) { TS_TEXTCHANGE change = {}; ASSERT_EQ(error_code, text_store_->SetText(0, acp_start, acp_end, @@ -206,7 +207,7 @@ class TSFTextStoreTestCallback { } void GetTextTest(LONG acp_start, LONG acp_end, - const string16& expected_string, + const base::string16& expected_string, LONG expected_next_acp) { wchar_t buffer[1024] = {}; ULONG text_buffer_copied = 0; @@ -219,7 +220,8 @@ class TSFTextStoreTestCallback { &run_info, 1, &run_info_buffer_copied, &next_acp)); ASSERT_EQ(expected_string.size(), text_buffer_copied); - EXPECT_EQ(expected_string, string16(buffer, buffer + text_buffer_copied)); + EXPECT_EQ(expected_string, + base::string16(buffer, buffer + text_buffer_copied)); EXPECT_EQ(1, run_info_buffer_copied); EXPECT_EQ(expected_string.size(), run_info.uCount); EXPECT_EQ(TS_RT_PLAIN, run_info.type); @@ -548,7 +550,7 @@ class RequestLockTextChangeTestCallback : public TSFTextStoreTestCallback { return S_OK; } - void InsertText(const string16& text) { + void InsertText(const base::string16& text) { EXPECT_EQ(2, state_); EXPECT_EQ(L"012345", text); state_ = 3; @@ -1057,7 +1059,7 @@ class ScenarioTestCallback : public TSFTextStoreTestCallback { return S_OK; } - void InsertText2(const string16& text) { + void InsertText2(const base::string16& text) { EXPECT_EQ(L"axy", text); } @@ -1086,7 +1088,7 @@ class ScenarioTestCallback : public TSFTextStoreTestCallback { return S_OK; } - void InsertText3(const string16& text) { + void InsertText3(const base::string16& text) { EXPECT_EQ(L"ZCPc", text); } diff --git a/ui/base/l10n/l10n_util_android.cc b/ui/base/l10n/l10n_util_android.cc index 62d919b..96b19d4 100644 --- a/ui/base/l10n/l10n_util_android.cc +++ b/ui/base/l10n/l10n_util_android.cc @@ -73,8 +73,8 @@ ScopedJavaLocalRef<jobject> NewJavaLocale( } // namespace -string16 GetDisplayNameForLocale(const std::string& locale, - const std::string& display_locale) { +base::string16 GetDisplayNameForLocale(const std::string& locale, + const std::string& display_locale) { JNIEnv* env = base::android::AttachCurrentThread(); ScopedJavaLocalRef<jobject> java_locale = NewJavaLocale(env, locale); diff --git a/ui/base/l10n/l10n_util_android.h b/ui/base/l10n/l10n_util_android.h index 467bf17..b7639d2 100644 --- a/ui/base/l10n/l10n_util_android.h +++ b/ui/base/l10n/l10n_util_android.h @@ -17,8 +17,9 @@ namespace l10n_util { // Return the current default locale of the device. UI_EXPORT std::string GetDefaultLocale(); -UI_EXPORT string16 GetDisplayNameForLocale(const std::string& locale, - const std::string& display_locale); +UI_EXPORT base::string16 GetDisplayNameForLocale( + const std::string& locale, + const std::string& display_locale); UI_EXPORT bool RegisterLocalizationUtil(JNIEnv* env); diff --git a/ui/base/l10n/l10n_util_collator.h b/ui/base/l10n/l10n_util_collator.h index a0bfb92..f16065d 100644 --- a/ui/base/l10n/l10n_util_collator.h +++ b/ui/base/l10n/l10n_util_collator.h @@ -82,7 +82,7 @@ void SortStringsUsingMethod(const std::string& locale, // Compares two elements' string keys and returns true if the first element's // string key is less than the second element's string key. The Element must // have a method like the follow format to return the string key. -// const string16& GetStringKey() const; +// const base::string16& GetStringKey() const; // This uses the locale specified in the constructor. template <class Element> class StringComparator : public std::binary_function<const Element&, @@ -105,7 +105,7 @@ class StringComparator : public std::binary_function<const Element&, icu::Collator* collator_; }; -// Specialization of operator() method for string16 version. +// Specialization of operator() method for base::string16 version. template <> UI_EXPORT bool StringComparator<base::string16>::operator()(const base::string16& lhs, const base::string16& rhs); diff --git a/ui/base/l10n/l10n_util_mac.h b/ui/base/l10n/l10n_util_mac.h index f617d89..b2a88ce 100644 --- a/ui/base/l10n/l10n_util_mac.h +++ b/ui/base/l10n/l10n_util_mac.h @@ -23,7 +23,7 @@ namespace l10n_util { // Remove the Windows-style accelerator marker (for labels, menuitems, etc.) // and change "..." into an ellipsis. // Returns the result in an autoreleased NSString. -UI_EXPORT NSString* FixUpWindowsStyleLabel(const string16& label); +UI_EXPORT NSString* FixUpWindowsStyleLabel(const base::string16& label); // Pulls resource string from the string bundle and returns it. UI_EXPORT NSString* GetNSString(int message_id); @@ -31,25 +31,25 @@ UI_EXPORT NSString* GetNSString(int message_id); // Get a resource string and replace $1-$2-$3 with |a| and |b| // respectively. Additionally, $$ is replaced by $. UI_EXPORT NSString* GetNSStringF(int message_id, - const string16& a); + const base::string16& a); UI_EXPORT NSString* GetNSStringF(int message_id, - const string16& a, - const string16& b); + const base::string16& a, + const base::string16& b); UI_EXPORT NSString* GetNSStringF(int message_id, - const string16& a, - const string16& b, - const string16& c); + const base::string16& a, + const base::string16& b, + const base::string16& c); UI_EXPORT NSString* GetNSStringF(int message_id, - const string16& a, - const string16& b, - const string16& c, - const string16& d); + const base::string16& a, + const base::string16& b, + const base::string16& c, + const base::string16& d); // Variants that return the offset(s) of the replaced parameters. (See // app/l10n_util.h for more details.) UI_EXPORT NSString* GetNSStringF(int message_id, - const string16& a, - const string16& b, + const base::string16& a, + const base::string16& b, std::vector<size_t>* offsets); // Same as GetNSString, but runs the result through FixUpWindowsStyleLabel @@ -59,19 +59,19 @@ UI_EXPORT NSString* GetNSStringWithFixup(int message_id); // Same as GetNSStringF, but runs the result through FixUpWindowsStyleLabel // before returning it. UI_EXPORT NSString* GetNSStringFWithFixup(int message_id, - const string16& a); + const base::string16& a); UI_EXPORT NSString* GetNSStringFWithFixup(int message_id, - const string16& a, - const string16& b); + const base::string16& a, + const base::string16& b); UI_EXPORT NSString* GetNSStringFWithFixup(int message_id, - const string16& a, - const string16& b, - const string16& c); + const base::string16& a, + const base::string16& b, + const base::string16& c); UI_EXPORT NSString* GetNSStringFWithFixup(int message_id, - const string16& a, - const string16& b, - const string16& c, - const string16& d); + const base::string16& a, + const base::string16& b, + const base::string16& c, + const base::string16& d); // Support the override of the locale with the value from Cocoa. UI_EXPORT void OverrideLocaleWithCocoaLocale(); diff --git a/ui/base/l10n/l10n_util_mac.mm b/ui/base/l10n/l10n_util_mac.mm index e9d47c2..b2e3cf8 100644 --- a/ui/base/l10n/l10n_util_mac.mm +++ b/ui/base/l10n/l10n_util_mac.mm @@ -53,9 +53,9 @@ void OverrideLocaleWithCocoaLocale() { // Remove the Windows-style accelerator marker and change "..." into an // ellipsis. Returns the result in an autoreleased NSString. -NSString* FixUpWindowsStyleLabel(const string16& label) { +NSString* FixUpWindowsStyleLabel(const base::string16& label) { const char16 kEllipsisUTF16 = 0x2026; - string16 ret; + base::string16 ret; size_t label_len = label.length(); ret.reserve(label_len); for (size_t i = 0; i < label_len; ++i) { @@ -87,38 +87,38 @@ NSString* GetNSString(int message_id) { } NSString* GetNSStringF(int message_id, - const string16& a) { + const base::string16& a) { return base::SysUTF16ToNSString(l10n_util::GetStringFUTF16(message_id, a)); } NSString* GetNSStringF(int message_id, - const string16& a, - const string16& b) { + const base::string16& a, + const base::string16& b) { return base::SysUTF16ToNSString(l10n_util::GetStringFUTF16(message_id, a, b)); } NSString* GetNSStringF(int message_id, - const string16& a, - const string16& b, - const string16& c) { + const base::string16& a, + const base::string16& b, + const base::string16& c) { return base::SysUTF16ToNSString(l10n_util::GetStringFUTF16(message_id, a, b, c)); } NSString* GetNSStringF(int message_id, - const string16& a, - const string16& b, - const string16& c, - const string16& d) { + const base::string16& a, + const base::string16& b, + const base::string16& c, + const base::string16& d) { return base::SysUTF16ToNSString(l10n_util::GetStringFUTF16(message_id, a, b, c, d)); } NSString* GetNSStringF(int message_id, - const string16& a, - const string16& b, + const base::string16& a, + const base::string16& b, std::vector<size_t>* offsets) { return base::SysUTF16ToNSString(l10n_util::GetStringFUTF16(message_id, a, b, offsets)); @@ -129,31 +129,31 @@ NSString* GetNSStringWithFixup(int message_id) { } NSString* GetNSStringFWithFixup(int message_id, - const string16& a) { + const base::string16& a) { return FixUpWindowsStyleLabel(l10n_util::GetStringFUTF16(message_id, a)); } NSString* GetNSStringFWithFixup(int message_id, - const string16& a, - const string16& b) { + const base::string16& a, + const base::string16& b) { return FixUpWindowsStyleLabel(l10n_util::GetStringFUTF16(message_id, a, b)); } NSString* GetNSStringFWithFixup(int message_id, - const string16& a, - const string16& b, - const string16& c) { + const base::string16& a, + const base::string16& b, + const base::string16& c) { return FixUpWindowsStyleLabel(l10n_util::GetStringFUTF16(message_id, a, b, c)); } NSString* GetNSStringFWithFixup(int message_id, - const string16& a, - const string16& b, - const string16& c, - const string16& d) { + const base::string16& a, + const base::string16& b, + const base::string16& c, + const base::string16& d) { return FixUpWindowsStyleLabel(l10n_util::GetStringFUTF16(message_id, a, b, c, d)); } diff --git a/ui/base/l10n/l10n_util_mac_unittest.mm b/ui/base/l10n/l10n_util_mac_unittest.mm index ec31672..cd3e203 100644 --- a/ui/base/l10n/l10n_util_mac_unittest.mm +++ b/ui/base/l10n/l10n_util_mac_unittest.mm @@ -37,7 +37,7 @@ TEST_F(L10nUtilMacTest, FixUpWindowsStyleLabel) { { @"(&b)foo", @"foo" }, }; for (size_t idx = 0; idx < ARRAYSIZE_UNSAFE(data); ++idx) { - string16 input16(base::SysNSStringToUTF16(data[idx].input)); + base::string16 input16(base::SysNSStringToUTF16(data[idx].input)); NSString* result = l10n_util::FixUpWindowsStyleLabel(input16); EXPECT_TRUE(result != nil) << "Fixup Failed, idx = " << idx; diff --git a/ui/base/l10n/l10n_util_unittest.cc b/ui/base/l10n/l10n_util_unittest.cc index 6207ffa..ef530fa 100644 --- a/ui/base/l10n/l10n_util_unittest.cc +++ b/ui/base/l10n/l10n_util_unittest.cc @@ -37,11 +37,11 @@ namespace { class StringWrapper { public: - explicit StringWrapper(const string16& string) : string_(string) {} - const string16& string() const { return string_; } + explicit StringWrapper(const base::string16& string) : string_(string) {} + const base::string16& string() const { return string_; } private: - string16 string_; + base::string16 string_; DISALLOW_COPY_AND_ASSIGN(StringWrapper); }; @@ -62,7 +62,7 @@ TEST_F(L10nUtilTest, DISABLED_GetString) { UTF8ToUTF16("10")); EXPECT_EQ(std::string("Hello, chrome. Your number is 10."), s); - string16 s16 = l10n_util::GetStringFUTF16Int(IDS_PLACEHOLDERS_2, 20); + base::string16 s16 = l10n_util::GetStringFUTF16Int(IDS_PLACEHOLDERS_2, 20); EXPECT_EQ(UTF8ToUTF16("You owe me $20."), s16); } #endif // defined(OS_WIN) @@ -326,7 +326,7 @@ void CheckUiDisplayNameForLocale(const std::string& locale, const std::string& display_locale, bool is_rtl) { EXPECT_EQ(true, base::i18n::IsRTL()); - string16 result = l10n_util::GetDisplayNameForLocale(locale, + base::string16 result = l10n_util::GetDisplayNameForLocale(locale, display_locale, /* is_for_ui */ true); @@ -352,7 +352,8 @@ void CheckUiDisplayNameForLocale(const std::string& locale, TEST_F(L10nUtilTest, GetDisplayNameForLocale) { // TODO(jungshik): Make this test more extensive. // Test zh-CN and zh-TW are treated as zh-Hans and zh-Hant. - string16 result = l10n_util::GetDisplayNameForLocale("zh-CN", "en", false); + base::string16 result = + l10n_util::GetDisplayNameForLocale("zh-CN", "en", false); EXPECT_EQ(ASCIIToUTF16("Chinese (Simplified Han)"), result); result = l10n_util::GetDisplayNameForLocale("zh-TW", "en", false); @@ -388,21 +389,21 @@ TEST_F(L10nUtilTest, GetDisplayNameForLocale) { // ToUpper and ToLower should work with embedded NULLs. const size_t length_with_null = 4; char16 buf_with_null[length_with_null] = { 0, 'a', 0, 'b' }; - string16 string16_with_null(buf_with_null, length_with_null); + base::string16 string16_with_null(buf_with_null, length_with_null); - string16 upper_with_null = base::i18n::ToUpper(string16_with_null); + base::string16 upper_with_null = base::i18n::ToUpper(string16_with_null); ASSERT_EQ(length_with_null, upper_with_null.size()); EXPECT_TRUE(upper_with_null[0] == 0 && upper_with_null[1] == 'A' && upper_with_null[2] == 0 && upper_with_null[3] == 'B'); - string16 lower_with_null = base::i18n::ToLower(upper_with_null); + base::string16 lower_with_null = base::i18n::ToLower(upper_with_null); ASSERT_EQ(length_with_null, upper_with_null.size()); EXPECT_TRUE(lower_with_null[0] == 0 && lower_with_null[1] == 'a' && lower_with_null[2] == 0 && lower_with_null[3] == 'b'); } TEST_F(L10nUtilTest, GetDisplayNameForCountry) { - string16 result = l10n_util::GetDisplayNameForCountry("BR", "en"); + base::string16 result = l10n_util::GetDisplayNameForCountry("BR", "en"); EXPECT_EQ(ASCIIToUTF16("Brazil"), result); result = l10n_util::GetDisplayNameForCountry("419", "en"); diff --git a/ui/base/l10n/l10n_util_win.cc b/ui/base/l10n/l10n_util_win.cc index bc6a7e9..4b91fa2 100644 --- a/ui/base/l10n/l10n_util_win.cc +++ b/ui/base/l10n/l10n_util_win.cc @@ -20,7 +20,7 @@ namespace { -void AdjustLogFont(const string16& font_family, +void AdjustLogFont(const base::string16& font_family, double font_size_scaler, double dpi_scale, LOGFONT* logfont) { @@ -113,7 +113,7 @@ bool IsLocaleSupportedByOS(const std::string& locale) { !LowerCaseEqualsASCII(locale, "am") || IsFontPresent(L"Abyssinica SIL")); } -bool NeedOverrideDefaultUIFont(string16* override_font_family, +bool NeedOverrideDefaultUIFont(base::string16* override_font_family, double* font_size_scaler) { // This is rather simple-minded to deal with the UI font size // issue for some Indian locales (ml, bn, hi) for which @@ -130,7 +130,7 @@ bool NeedOverrideDefaultUIFont(string16* override_font_family, ui_font_size_scaler_id = IDS_UI_FONT_SIZE_SCALER_XP; } - string16 ui_font_family = GetStringUTF16(ui_font_family_id); + base::string16 ui_font_family = GetStringUTF16(ui_font_family_id); int scaler100; if (!base::StringToInt(l10n_util::GetStringUTF16(ui_font_size_scaler_id), &scaler100)) @@ -161,7 +161,7 @@ void AdjustUIFont(LOGFONT* logfont) { } void AdjustUIFontForDIP(float dpi_scale, LOGFONT* logfont) { - string16 ui_font_family = L"default"; + base::string16 ui_font_family = L"default"; double ui_font_size_scaler = 1; if (NeedOverrideDefaultUIFont(&ui_font_family, &ui_font_size_scaler) || dpi_scale != 1) { @@ -170,7 +170,7 @@ void AdjustUIFontForDIP(float dpi_scale, LOGFONT* logfont) { } void AdjustUIFontForWindow(HWND hwnd) { - string16 ui_font_family; + base::string16 ui_font_family; double ui_font_size_scaler; if (NeedOverrideDefaultUIFont(&ui_font_family, &ui_font_size_scaler)) { LOGFONT logfont; diff --git a/ui/base/l10n/l10n_util_win.h b/ui/base/l10n/l10n_util_win.h index 7558816..d0338f7 100644 --- a/ui/base/l10n/l10n_util_win.h +++ b/ui/base/l10n/l10n_util_win.h @@ -40,7 +40,7 @@ UI_EXPORT void HWNDSetRTLLayout(HWND hwnd); // override_font_family and font_size_scaler are not null, they'll be // filled with the font family name and the size scaler. The output // parameters are not modified if the return value is false. -UI_EXPORT bool NeedOverrideDefaultUIFont(string16* override_font_family, +UI_EXPORT bool NeedOverrideDefaultUIFont(base::string16* override_font_family, double* font_size_scaler); // If the default UI font stored in |logfont| is not suitable, its family diff --git a/ui/base/l10n/time_format_unittest.cc b/ui/base/l10n/time_format_unittest.cc index eaee957..483538f 100644 --- a/ui/base/l10n/time_format_unittest.cc +++ b/ui/base/l10n/time_format_unittest.cc @@ -16,9 +16,9 @@ namespace { using base::TimeDelta; void TestTimeFormats(const TimeDelta& delta, const char* expected_ascii) { - string16 expected = ASCIIToUTF16(expected_ascii); - string16 expected_left = expected + ASCIIToUTF16(" left"); - string16 expected_ago = expected + ASCIIToUTF16(" ago"); + base::string16 expected = ASCIIToUTF16(expected_ascii); + base::string16 expected_left = expected + ASCIIToUTF16(" left"); + base::string16 expected_ago = expected + ASCIIToUTF16(" ago"); EXPECT_EQ(expected, TimeFormat::TimeRemainingShort(delta)); EXPECT_EQ(expected_left, TimeFormat::TimeRemaining(delta)); EXPECT_EQ(expected_ago, TimeFormat::TimeElapsed(delta)); @@ -53,19 +53,20 @@ TEST(TimeFormat, FormatTime) { // crbug.com/159388: This test fails when daylight savings time ends. TEST(TimeFormat, RelativeDate) { base::Time now = base::Time::Now(); - string16 today_str = TimeFormat::RelativeDate(now, NULL); + base::string16 today_str = TimeFormat::RelativeDate(now, NULL); EXPECT_EQ(ASCIIToUTF16("Today"), today_str); base::Time yesterday = now - TimeDelta::FromDays(1); - string16 yesterday_str = TimeFormat::RelativeDate(yesterday, NULL); + base::string16 yesterday_str = TimeFormat::RelativeDate(yesterday, NULL); EXPECT_EQ(ASCIIToUTF16("Yesterday"), yesterday_str); base::Time two_days_ago = now - TimeDelta::FromDays(2); - string16 two_days_ago_str = TimeFormat::RelativeDate(two_days_ago, NULL); + base::string16 two_days_ago_str = + TimeFormat::RelativeDate(two_days_ago, NULL); EXPECT_TRUE(two_days_ago_str.empty()); base::Time a_week_ago = now - TimeDelta::FromDays(7); - string16 a_week_ago_str = TimeFormat::RelativeDate(a_week_ago, NULL); + base::string16 a_week_ago_str = TimeFormat::RelativeDate(a_week_ago, NULL); EXPECT_TRUE(a_week_ago_str.empty()); } diff --git a/ui/base/resource/resource_bundle_unittest.cc b/ui/base/resource/resource_bundle_unittest.cc index f6ab49d..28c5b02 100644 --- a/ui/base/resource/resource_bundle_unittest.cc +++ b/ui/base/resource/resource_bundle_unittest.cc @@ -78,8 +78,9 @@ class MockResourceBundleDelegate : public ui::ResourceBundle::Delegate { *value = GetRawDataResourceMock(resource_id, scale_factor); return true; } - MOCK_METHOD1(GetLocalizedStringMock, string16(int message_id)); - virtual bool GetLocalizedString(int message_id, string16* value) OVERRIDE { + MOCK_METHOD1(GetLocalizedStringMock, base::string16(int message_id)); + virtual bool GetLocalizedString(int message_id, + base::string16* value) OVERRIDE { *value = GetLocalizedStringMock(message_id); return true; } @@ -297,14 +298,14 @@ TEST_F(ResourceBundleTest, DelegateGetLocalizedString) { MockResourceBundleDelegate delegate; ResourceBundle* resource_bundle = CreateResourceBundle(&delegate); - string16 data = ASCIIToUTF16("My test data"); + base::string16 data = ASCIIToUTF16("My test data"); int resource_id = 5; EXPECT_CALL(delegate, GetLocalizedStringMock(resource_id)) .Times(1) .WillOnce(Return(data)); - string16 result = resource_bundle->GetLocalizedString(resource_id); + base::string16 result = resource_bundle->GetLocalizedString(resource_id); EXPECT_EQ(data, result); } diff --git a/ui/base/win/message_box_win.cc b/ui/base/win/message_box_win.cc index c78e98b..6500f98 100644 --- a/ui/base/win/message_box_win.cc +++ b/ui/base/win/message_box_win.cc @@ -14,8 +14,8 @@ namespace ui { // RTL locale, we need to make sure that LTR strings are rendered correctly by // adding the appropriate Unicode directionality marks. int MessageBox(HWND hwnd, - const string16& text, - const string16& caption, + const base::string16& text, + const base::string16& caption, UINT flags) { if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoMessageBox)) return IDOK; @@ -24,11 +24,11 @@ int MessageBox(HWND hwnd, if (base::i18n::IsRTL()) actual_flags |= MB_RIGHT | MB_RTLREADING; - string16 localized_text = text; + base::string16 localized_text = text; base::i18n::AdjustStringForLocaleDirection(&localized_text); const wchar_t* text_ptr = localized_text.c_str(); - string16 localized_caption = caption; + base::string16 localized_caption = caption; base::i18n::AdjustStringForLocaleDirection(&localized_caption); const wchar_t* caption_ptr = localized_caption.c_str(); diff --git a/ui/base/win/message_box_win.h b/ui/base/win/message_box_win.h index a91c00f7..f24150e 100644 --- a/ui/base/win/message_box_win.h +++ b/ui/base/win/message_box_win.h @@ -17,8 +17,8 @@ namespace ui { // callers don't have to worry about adding these flags when running in a // right-to-left locale. UI_EXPORT int MessageBox(HWND hwnd, - const string16& text, - const string16& caption, + const base::string16& text, + const base::string16& caption, UINT flags); } // namespace ui diff --git a/ui/base/win/shell.cc b/ui/base/win/shell.cc index ff1a4ff..7866e71 100644 --- a/ui/base/win/shell.cc +++ b/ui/base/win/shell.cc @@ -24,7 +24,7 @@ namespace win { // Show the Windows "Open With" dialog box to ask the user to pick an app to // open the file with. -bool OpenItemWithExternalApp(const string16& full_path) { +bool OpenItemWithExternalApp(const base::string16& full_path) { SHELLEXECUTEINFO sei = { sizeof(sei) }; sei.fMask = SEE_MASK_FLAG_DDEWAIT; sei.nShow = SW_SHOWNORMAL; @@ -33,9 +33,9 @@ bool OpenItemWithExternalApp(const string16& full_path) { return (TRUE == ::ShellExecuteExW(&sei)); } -bool OpenAnyViaShell(const string16& full_path, - const string16& directory, - const string16& args, +bool OpenAnyViaShell(const base::string16& full_path, + const base::string16& directory, + const base::string16& args, DWORD mask) { SHELLEXECUTEINFO sei = { sizeof(sei) }; sei.fMask = mask; @@ -54,11 +54,11 @@ bool OpenAnyViaShell(const string16& full_path, bool OpenItemViaShell(const base::FilePath& full_path) { return OpenAnyViaShell(full_path.value(), full_path.DirName().value(), - string16(), 0); + base::string16(), 0); } bool OpenItemViaShellNoZoneCheck(const base::FilePath& full_path) { - return OpenAnyViaShell(full_path.value(), string16(), string16(), + return OpenAnyViaShell(full_path.value(), base::string16(), base::string16(), SEE_MASK_NOZONECHECKS | SEE_MASK_FLAG_DDEWAIT); } @@ -80,10 +80,10 @@ bool PreventWindowFromPinning(HWND hwnd) { // TODO(calamity): investigate moving this out of the UI thread as COM // operations may spawn nested message loops which can cause issues. -void SetAppDetailsForWindow(const string16& app_id, - const string16& app_icon, - const string16& relaunch_command, - const string16& relaunch_display_name, +void SetAppDetailsForWindow(const base::string16& app_id, + const base::string16& app_icon, + const base::string16& relaunch_command, + const base::string16& relaunch_display_name, HWND hwnd) { // This functionality is only available on Win7+. It also doesn't make sense // to do this for Chrome Metro. @@ -112,19 +112,27 @@ void SetAppDetailsForWindow(const string16& app_id, } } -void SetAppIdForWindow(const string16& app_id, HWND hwnd) { - SetAppDetailsForWindow(app_id, string16(), string16(), string16(), hwnd); +void SetAppIdForWindow(const base::string16& app_id, HWND hwnd) { + SetAppDetailsForWindow(app_id, + base::string16(), + base::string16(), + base::string16(), + hwnd); } -void SetAppIconForWindow(const string16& app_icon, HWND hwnd) { - SetAppDetailsForWindow(string16(), app_icon, string16(), string16(), hwnd); +void SetAppIconForWindow(const base::string16& app_icon, HWND hwnd) { + SetAppDetailsForWindow(base::string16(), + app_icon, + base::string16(), + base::string16(), + hwnd); } -void SetRelaunchDetailsForWindow(const string16& relaunch_command, - const string16& display_name, +void SetRelaunchDetailsForWindow(const base::string16& relaunch_command, + const base::string16& display_name, HWND hwnd) { - SetAppDetailsForWindow(string16(), - string16(), + SetAppDetailsForWindow(base::string16(), + base::string16(), relaunch_command, display_name, hwnd); diff --git a/ui/base/win/shell.h b/ui/base/win/shell.h index e85d2b4..82f828f 100644 --- a/ui/base/win/shell.h +++ b/ui/base/win/shell.h @@ -32,15 +32,15 @@ UI_EXPORT bool OpenItemViaShellNoZoneCheck(const base::FilePath& full_path); // don't use it if one of the above will do. |mask| is a valid combination // of SEE_MASK_FLAG_XXX as stated in msdn. If there is no default application // registered for the item, it behaves the same as OpenItemViaShell. -UI_EXPORT bool OpenAnyViaShell(const string16& full_path, - const string16& directory, - const string16& args, +UI_EXPORT bool OpenAnyViaShell(const base::string16& full_path, + const base::string16& directory, + const base::string16& args, DWORD mask); // Ask the user, via the Windows "Open With" dialog, for an application to use // to open the file specified by 'full_path'. // Returns 'true' on successful open, 'false' otherwise. -bool OpenItemWithExternalApp(const string16& full_path); +bool OpenItemWithExternalApp(const base::string16& full_path); // Disables the ability of the specified window to be pinned to the taskbar or // the Start menu. This will remove "Pin this program to taskbar" from the @@ -49,26 +49,28 @@ UI_EXPORT bool PreventWindowFromPinning(HWND hwnd); // Sets the application id, app icon, relaunch command and relaunch display name // for the given window. -UI_EXPORT void SetAppDetailsForWindow(const string16& app_id, - const string16& app_icon, - const string16& relaunch_command, - const string16& relaunch_display_name, - HWND hwnd); +UI_EXPORT void SetAppDetailsForWindow( + const base::string16& app_id, + const base::string16& app_icon, + const base::string16& relaunch_command, + const base::string16& relaunch_display_name, + HWND hwnd); // Sets the application id given as the Application Model ID for the window // specified. This method is used to insure that different web applications // do not group together on the Win7 task bar. -UI_EXPORT void SetAppIdForWindow(const string16& app_id, HWND hwnd); +UI_EXPORT void SetAppIdForWindow(const base::string16& app_id, HWND hwnd); // Sets the application icon for the window specified. -UI_EXPORT void SetAppIconForWindow(const string16& app_icon, HWND hwnd); +UI_EXPORT void SetAppIconForWindow(const base::string16& app_icon, HWND hwnd); // Sets the relaunch command and relaunch display name for the window specified. // Windows will use this information for grouping on the taskbar, and to create // a shortcut if the window is pinned to the taskbar. -UI_EXPORT void SetRelaunchDetailsForWindow(const string16& relaunch_command, - const string16& display_name, - HWND hwnd); +UI_EXPORT void SetRelaunchDetailsForWindow( + const base::string16& relaunch_command, + const base::string16& display_name, + HWND hwnd); // Returns true if composition is available and turned on on the current // platform. diff --git a/ui/base/x/selection_utils.cc b/ui/base/x/selection_utils.cc index a3f8494..138745b 100644 --- a/ui/base/x/selection_utils.cc +++ b/ui/base/x/selection_utils.cc @@ -55,7 +55,7 @@ void GetAtomIntersection(const std::vector< ::Atom>& desired, } } -void AddString16ToVector(const string16& str, +void AddString16ToVector(const base::string16& str, std::vector<unsigned char>* bytes) { const unsigned char* front = reinterpret_cast<const unsigned char*>(str.data()); @@ -77,19 +77,19 @@ std::string RefCountedMemoryToString( return std::string(reinterpret_cast<const char*>(front), size); } -string16 RefCountedMemoryToString16( +base::string16 RefCountedMemoryToString16( const scoped_refptr<base::RefCountedMemory>& memory) { if (!memory.get()) { NOTREACHED(); - return string16(); + return base::string16(); } size_t size = memory->size(); if (!size) - return string16(); + return base::string16(); const unsigned char* front = memory->front(); - return string16(reinterpret_cast<const base::char16*>(front), size / 2); + return base::string16(reinterpret_cast<const base::char16*>(front), size / 2); } /////////////////////////////////////////////////////////////////////////////// @@ -191,8 +191,8 @@ std::string SelectionData::GetText() const { } } -string16 SelectionData::GetHtml() const { - string16 markup; +base::string16 SelectionData::GetHtml() const { + base::string16 markup; if (type_ == atom_cache_.GetAtom(Clipboard::kMimeTypeHTML)) { const unsigned char* data = GetData(); @@ -223,7 +223,7 @@ void SelectionData::AssignTo(std::string* result) const { *result = RefCountedMemoryToString(memory_); } -void SelectionData::AssignTo(string16* result) const { +void SelectionData::AssignTo(base::string16* result) const { *result = RefCountedMemoryToString16(memory_); } diff --git a/ui/base/x/selection_utils.h b/ui/base/x/selection_utils.h index 350f383..9770938 100644 --- a/ui/base/x/selection_utils.h +++ b/ui/base/x/selection_utils.h @@ -37,14 +37,14 @@ UI_EXPORT void GetAtomIntersection(const std::vector< ::Atom>& desired, const std::vector< ::Atom>& offered, std::vector< ::Atom>* output); -// Takes the raw bytes of the string16 and copies them into |bytes|. -UI_EXPORT void AddString16ToVector(const string16& str, +// Takes the raw bytes of the base::string16 and copies them into |bytes|. +UI_EXPORT void AddString16ToVector(const base::string16& str, std::vector<unsigned char>* bytes); UI_EXPORT std::string RefCountedMemoryToString( const scoped_refptr<base::RefCountedMemory>& memory); -UI_EXPORT string16 RefCountedMemoryToString16( +UI_EXPORT base::string16 RefCountedMemoryToString16( const scoped_refptr<base::RefCountedMemory>& memory); /////////////////////////////////////////////////////////////////////////////// @@ -105,11 +105,11 @@ class UI_EXPORT SelectionData { // If |type_| is the HTML type, returns the data as a string16. This detects // guesses the character encoding of the source. - string16 GetHtml() const; + base::string16 GetHtml() const; // Assigns the raw data to the string. void AssignTo(std::string* result) const; - void AssignTo(string16* result) const; + void AssignTo(base::string16* result) const; private: ::Atom type_; |