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 | |
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
246 files changed, 1252 insertions, 1179 deletions
diff --git a/ui/app_list/views/app_list_item_view.cc b/ui/app_list/views/app_list_item_view.cc index f2e9c64..ba9a294 100644 --- a/ui/app_list/views/app_list_item_view.cc +++ b/ui/app_list/views/app_list_item_view.cc @@ -134,7 +134,7 @@ void AppListItemView::UpdateIcon() { void AppListItemView::UpdateTooltip() { title_->SetTooltipText(model_->title() == model_->full_name() ? - string16() : UTF8ToUTF16(model_->full_name())); + base::string16() : UTF8ToUTF16(model_->full_name())); } void AppListItemView::SetUIState(UIState state) { diff --git a/ui/app_list/views/apps_grid_view_unittest.cc b/ui/app_list/views/apps_grid_view_unittest.cc index b47731d..f2e9450 100644 --- a/ui/app_list/views/apps_grid_view_unittest.cc +++ b/ui/app_list/views/apps_grid_view_unittest.cc @@ -435,7 +435,7 @@ TEST_F(AppsGridViewTest, ItemLabelShortNameOverride) { std::string expected_tooltip("tooltip"); model_->CreateAndAddItem(expected_text, expected_tooltip); - string16 actual_tooltip; + base::string16 actual_tooltip; AppListItemView* item_view = GetItemViewAt(0); ASSERT_TRUE(item_view); const views::Label* title_label = item_view->title(); @@ -451,7 +451,7 @@ TEST_F(AppsGridViewTest, ItemLabelNoShortName) { std::string title("a"); model_->CreateAndAddItem(title, title); - string16 actual_tooltip; + base::string16 actual_tooltip; AppListItemView* item_view = GetItemViewAt(0); ASSERT_TRUE(item_view); const views::Label* title_label = item_view->title(); diff --git a/ui/aura/remote_root_window_host_win.cc b/ui/aura/remote_root_window_host_win.cc index db66beb..8e78046 100644 --- a/ui/aura/remote_root_window_host_win.cc +++ b/ui/aura/remote_root_window_host_win.cc @@ -61,7 +61,7 @@ void SetVirtualKeyStates(uint32 flags) { } void FillCompositionText( - const string16& text, + const base::string16& text, int32 selection_start, int32 selection_end, const std::vector<metro_viewer::UnderlineInfo>& underlines, @@ -652,7 +652,7 @@ void RemoteRootWindowHostWin::OnImeCandidatePopupChanged(bool visible) { } void RemoteRootWindowHostWin::OnImeCompositionChanged( - const string16& text, + const base::string16& text, int32 selection_start, int32 selection_end, const std::vector<metro_viewer::UnderlineInfo>& underlines) { @@ -666,7 +666,7 @@ void RemoteRootWindowHostWin::OnImeCompositionChanged( remote_input_method_private->OnCompositionChanged(composition_text); } -void RemoteRootWindowHostWin::OnImeTextCommitted(const string16& text) { +void RemoteRootWindowHostWin::OnImeTextCommitted(const base::string16& text) { ui::RemoteInputMethodPrivateWin* remote_input_method_private = GetRemoteInputMethodPrivate(); if (!remote_input_method_private) diff --git a/ui/aura/remote_root_window_host_win.h b/ui/aura/remote_root_window_host_win.h index 6ccf94d..41774e2 100644 --- a/ui/aura/remote_root_window_host_win.h +++ b/ui/aura/remote_root_window_host_win.h @@ -196,11 +196,11 @@ class AURA_EXPORT RemoteRootWindowHostWin ui::RemoteInputMethodPrivateWin* GetRemoteInputMethodPrivate(); void OnImeCandidatePopupChanged(bool visible); void OnImeCompositionChanged( - const string16& text, + const base::string16& text, int32 selection_start, int32 selection_end, const std::vector<metro_viewer::UnderlineInfo>& underlines); - void OnImeTextCommitted(const string16& text); + void OnImeTextCommitted(const base::string16& text); void OnImeInputSourceChanged(uint16 language_id, bool is_ime); // RootWindowHost overrides: 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_; diff --git a/ui/gfx/text_elider_unittest.cc b/ui/gfx/text_elider_unittest.cc index 5fa74cb..a97d764 100644 --- a/ui/gfx/text_elider_unittest.cc +++ b/ui/gfx/text_elider_unittest.cc @@ -32,8 +32,8 @@ struct FileTestcase { }; struct UTF16Testcase { - const string16 input; - const string16 output; + const base::string16 input; + const base::string16 output; }; struct TestData { @@ -111,7 +111,7 @@ TEST(TextEliderTest, MAYBE_ElideEmail) { const FontList font_list; for (size_t i = 0; i < arraysize(testcases); ++i) { - const string16 expected_output = UTF8ToUTF16(testcases[i].output); + const base::string16 expected_output = UTF8ToUTF16(testcases[i].output); EXPECT_EQ(expected_output, ElideEmail( UTF8ToUTF16(testcases[i].input), @@ -139,7 +139,7 @@ TEST(TextEliderTest, ElideEmailMoreSpace) { font_list.GetExpectedTextWidth(test_width_factors[i]); for (size_t j = 0; j < arraysize(test_emails); ++j) { // Extra space is available: the email should not be elided. - const string16 test_email = UTF8ToUTF16(test_emails[j]); + const base::string16 test_email = UTF8ToUTF16(test_emails[j]); EXPECT_EQ(test_email, ElideEmail(test_email, font_list, test_width)); } } @@ -193,7 +193,7 @@ TEST(TextEliderTest, TestTrailingEllipsisSlashEllipsisHack) { font_list), GetStringWidthF(UTF8ToUTF16("d" + kEllipsisStr), font_list)); GURL long_url("http://battersbox.com/directorynameisreallylongtoforcetrunc"); - string16 expected = + base::string16 expected = ElideUrl(long_url, font_list, available_width, std::string()); // Ensure that the expected result still contains part of the directory name. ASSERT_GT(expected.length(), std::string("battersbox.com/d").length()); @@ -320,7 +320,7 @@ TEST(TextEliderTest, MAYBE_TestFilenameEliding) { static const FontList font_list; for (size_t i = 0; i < arraysize(testcases); ++i) { base::FilePath filepath(testcases[i].input); - string16 expected = UTF8ToUTF16(testcases[i].output); + base::string16 expected = UTF8ToUTF16(testcases[i].output); expected = base::i18n::GetDisplayStringInLTRDirectionality(expected); EXPECT_EQ(expected, ElideFilename(filepath, font_list, GetStringWidthF(UTF8ToUTF16(testcases[i].output), font_list))); @@ -344,7 +344,7 @@ TEST(TextEliderTest, ElideTextTruncate) { }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { - string16 result = ElideText(UTF8ToUTF16(cases[i].input), font_list, + base::string16 result = ElideText(UTF8ToUTF16(cases[i].input), font_list, cases[i].width, TRUNCATE_AT_END); EXPECT_EQ(cases[i].output, UTF16ToUTF8(result)); } @@ -370,7 +370,7 @@ TEST(TextEliderTest, ElideTextEllipsis) { }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { - string16 result = ElideText(UTF8ToUTF16(cases[i].input), font_list, + base::string16 result = ElideText(UTF8ToUTF16(cases[i].input), font_list, cases[i].width, ELIDE_AT_END); EXPECT_EQ(cases[i].output, UTF16ToUTF8(result)); } @@ -378,17 +378,17 @@ TEST(TextEliderTest, ElideTextEllipsis) { // Checks that all occurrences of |first_char| are followed by |second_char| and // all occurrences of |second_char| are preceded by |first_char| in |text|. -static void CheckSurrogatePairs(const string16& text, +static void CheckSurrogatePairs(const base::string16& text, char16 first_char, char16 second_char) { size_t index = text.find_first_of(first_char); - while (index != string16::npos) { + while (index != base::string16::npos) { EXPECT_LT(index, text.length() - 1); EXPECT_EQ(second_char, text[index + 1]); index = text.find_first_of(first_char, index + 1); } index = text.find_first_of(second_char); - while (index != string16::npos) { + while (index != base::string16::npos) { EXPECT_GT(index, 0U); EXPECT_EQ(first_char, text[index - 1]); index = text.find_first_of(second_char, index + 1); @@ -400,12 +400,12 @@ TEST(TextEliderTest, ElideTextSurrogatePairs) { // The below is 'MUSICAL SYMBOL G CLEF', which is represented in UTF-16 as // two characters forming a surrogate pair 0x0001D11E. const std::string kSurrogate = "\xF0\x9D\x84\x9E"; - const string16 kTestString = + const base::string16 kTestString = UTF8ToUTF16(kSurrogate + "ab" + kSurrogate + kSurrogate + "cd"); const float kTestStringWidth = GetStringWidthF(kTestString, font_list); const char16 kSurrogateFirstChar = kTestString[0]; const char16 kSurrogateSecondChar = kTestString[1]; - string16 result; + base::string16 result; // Elide |kTextString| to all possible widths and check that no instance of // |kSurrogate| was split in two. @@ -422,20 +422,20 @@ TEST(TextEliderTest, ElideTextSurrogatePairs) { } TEST(TextEliderTest, ElideTextLongStrings) { - const string16 kEllipsisStr = UTF8ToUTF16(kEllipsis); - string16 data_scheme(UTF8ToUTF16("data:text/plain,")); + const base::string16 kEllipsisStr = UTF8ToUTF16(kEllipsis); + base::string16 data_scheme(UTF8ToUTF16("data:text/plain,")); size_t data_scheme_length = data_scheme.length(); - string16 ten_a(10, 'a'); - string16 hundred_a(100, 'a'); - string16 thousand_a(1000, 'a'); - string16 ten_thousand_a(10000, 'a'); - string16 hundred_thousand_a(100000, 'a'); - string16 million_a(1000000, 'a'); + base::string16 ten_a(10, 'a'); + base::string16 hundred_a(100, 'a'); + base::string16 thousand_a(1000, 'a'); + base::string16 ten_thousand_a(10000, 'a'); + base::string16 hundred_thousand_a(100000, 'a'); + base::string16 million_a(1000000, 'a'); size_t number_of_as = 156; - string16 long_string_end( - data_scheme + string16(number_of_as, 'a') + kEllipsisStr); + base::string16 long_string_end( + data_scheme + base::string16(number_of_as, 'a') + kEllipsisStr); UTF16Testcase testcases_end[] = { {data_scheme + ten_a, data_scheme + ten_a}, {data_scheme + hundred_a, data_scheme + hundred_a}, @@ -462,9 +462,9 @@ TEST(TextEliderTest, ElideTextLongStrings) { } size_t number_of_trailing_as = (data_scheme_length + number_of_as) / 2; - string16 long_string_middle(data_scheme + - string16(number_of_as - number_of_trailing_as, 'a') + kEllipsisStr + - string16(number_of_trailing_as, 'a')); + base::string16 long_string_middle(data_scheme + + base::string16(number_of_as - number_of_trailing_as, 'a') + kEllipsisStr + + base::string16(number_of_trailing_as, 'a')); UTF16Testcase testcases_middle[] = { {data_scheme + ten_a, data_scheme + ten_a}, {data_scheme + hundred_a, data_scheme + hundred_a}, @@ -553,7 +553,7 @@ TEST(TextEliderTest, ElideString) { { "Hello, my name is Tom", 100, false, "Hello, my name is Tom" } }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { - string16 output; + base::string16 output; EXPECT_EQ(cases[i].result, ElideString(UTF8ToUTF16(cases[i].input), cases[i].max_len, &output)); @@ -601,7 +601,7 @@ TEST(TextEliderTest, ElideRectangleText) { }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { - std::vector<string16> lines; + std::vector<base::string16> lines; EXPECT_EQ(cases[i].truncated_y ? INSUFFICIENT_SPACE_VERTICAL : 0, ElideRectangleText(UTF8ToUTF16(cases[i].input), font_list, @@ -639,7 +639,7 @@ TEST(TextEliderTest, ElideRectangleTextPunctuation) { }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { - std::vector<string16> lines; + std::vector<base::string16> lines; const WordWrapBehavior wrap_behavior = (cases[i].wrap_words ? WRAP_LONG_WORDS : TRUNCATE_LONG_WORDS); EXPECT_EQ(cases[i].truncated_x ? INSUFFICIENT_SPACE_HORIZONTAL : 0, @@ -661,7 +661,8 @@ TEST(TextEliderTest, ElideRectangleTextPunctuation) { TEST(TextEliderTest, ElideRectangleTextLongWords) { const FontList font_list; const int kAvailableHeight = 1000; - const string16 kElidedTesting = UTF8ToUTF16(std::string("Tes") + kEllipsis); + const base::string16 kElidedTesting = + UTF8ToUTF16(std::string("Tes") + kEllipsis); const float elided_width = GetStringWidthF(kElidedTesting, font_list); const float test_width = GetStringWidthF(ASCIIToUTF16("Test"), font_list); @@ -702,7 +703,7 @@ TEST(TextEliderTest, ElideRectangleTextLongWords) { }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { - std::vector<string16> lines; + std::vector<base::string16> lines; EXPECT_EQ(cases[i].truncated_x ? INSUFFICIENT_SPACE_HORIZONTAL : 0, ElideRectangleText(UTF8ToUTF16(cases[i].input), font_list, @@ -731,7 +732,7 @@ TEST(TextEliderTest, ElideRectangleTextCheckLineWidth) { const float kAvailableWidth = 235; const int kAvailableHeight = 1000; const char text[] = "that Russian place we used to go to after fencing"; - std::vector<string16> lines; + std::vector<base::string16> lines; EXPECT_EQ(0, ElideRectangleText(UTF8ToUTF16(text), font_list, kAvailableWidth, @@ -816,7 +817,7 @@ TEST(TextEliderTest, ElideRectangleString) { { "Hi, my name is\nTom", 2, 20, false, "Hi, my name is\nTom" }, { "Hi, my name is Tom", 1, 40, false, "Hi, my name is Tom" }, }; - string16 output; + base::string16 output; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { EXPECT_EQ(cases[i].result, ElideRectangleString(UTF8ToUTF16(cases[i].input), @@ -898,7 +899,7 @@ TEST(TextEliderTest, ElideRectangleStringNotStrict) { { "Hi, my name_is\nDick", 2, 20, false, "Hi, my name_is\nDick" }, { "Hi, my name_is Dick", 1, 40, false, "Hi, my name_is Dick" }, }; - string16 output; + base::string16 output; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { EXPECT_EQ(cases[i].result, ElideRectangleString(UTF8ToUTF16(cases[i].input), @@ -910,17 +911,17 @@ TEST(TextEliderTest, ElideRectangleStringNotStrict) { TEST(TextEliderTest, ElideRectangleWide16) { // Two greek words separated by space. - const string16 str(WideToUTF16( + const base::string16 str(WideToUTF16( L"\x03a0\x03b1\x03b3\x03ba\x03cc\x03c3\x03bc\x03b9" L"\x03bf\x03c2\x0020\x0399\x03c3\x03c4\x03cc\x03c2")); - const string16 out1(WideToUTF16( + const base::string16 out1(WideToUTF16( L"\x03a0\x03b1\x03b3\x03ba\n" L"\x03cc\x03c3\x03bc\x03b9\n" L"...")); - const string16 out2(WideToUTF16( + const base::string16 out2(WideToUTF16( L"\x03a0\x03b1\x03b3\x03ba\x03cc\x03c3\x03bc\x03b9\x03bf\x03c2\x0020\n" L"\x0399\x03c3\x03c4\x03cc\x03c2")); - string16 output; + base::string16 output; EXPECT_TRUE(ElideRectangleString(str, 2, 4, true, &output)); EXPECT_EQ(out1, output); EXPECT_FALSE(ElideRectangleString(str, 2, 12, true, &output)); @@ -929,19 +930,19 @@ TEST(TextEliderTest, ElideRectangleWide16) { TEST(TextEliderTest, ElideRectangleWide32) { // Four U+1D49C MATHEMATICAL SCRIPT CAPITAL A followed by space "aaaaa". - const string16 str(UTF8ToUTF16( + const base::string16 str(UTF8ToUTF16( "\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C" " aaaaa")); - const string16 out(UTF8ToUTF16( + const base::string16 out(UTF8ToUTF16( "\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\n" "\xF0\x9D\x92\x9C \naaa\n...")); - string16 output; + base::string16 output; EXPECT_TRUE(ElideRectangleString(str, 3, 3, true, &output)); EXPECT_EQ(out, output); } TEST(TextEliderTest, TruncateString) { - string16 string = ASCIIToUTF16("foooooey bxxxar baz"); + base::string16 string = ASCIIToUTF16("foooooey bxxxar baz"); // Make sure it doesn't modify the string if length > string length. EXPECT_EQ(string, TruncateString(string, 100)); diff --git a/ui/gfx/utf16_indexing_unittest.cc b/ui/gfx/utf16_indexing_unittest.cc index da2f8f5b..e17bdc8 100644 --- a/ui/gfx/utf16_indexing_unittest.cc +++ b/ui/gfx/utf16_indexing_unittest.cc @@ -10,7 +10,7 @@ namespace gfx { TEST(UTF16IndexingTest, IndexOffsetConversions) { // Valid surrogate pair surrounded by unpaired surrogates const char16 foo[] = {0xDC00, 0xD800, 0xD800, 0xDFFF, 0xDFFF, 0xDBFF, 0}; - const string16 s(foo); + const base::string16 s(foo); const size_t the_invalid_index = 3; for (size_t i = 0; i <= s.length(); ++i) EXPECT_EQ(i != the_invalid_index, IsValidCodePointIndex(s, i)); diff --git a/ui/gfx/win/hwnd_util.cc b/ui/gfx/win/hwnd_util.cc index fec39d4..4f06066 100644 --- a/ui/gfx/win/hwnd_util.cc +++ b/ui/gfx/win/hwnd_util.cc @@ -70,7 +70,7 @@ MSVC_ENABLE_OPTIMIZE(); } // namespace -string16 GetClassName(HWND window) { +base::string16 GetClassName(HWND window) { // GetClassNameW will return a truncated result (properly null terminated) if // the given buffer is not large enough. So, it is not possible to determine // that we got the entire class name if the result is exactly equal to the diff --git a/ui/gfx/win/hwnd_util.h b/ui/gfx/win/hwnd_util.h index 472dacc..2afd660 100644 --- a/ui/gfx/win/hwnd_util.h +++ b/ui/gfx/win/hwnd_util.h @@ -15,8 +15,8 @@ class Point; class Size; // A version of the GetClassNameW API that returns the class name in an -// string16. An empty result indicates a failure to get the class name. -GFX_EXPORT string16 GetClassName(HWND hwnd); +// base::string16. An empty result indicates a failure to get the class name. +GFX_EXPORT base::string16 GetClassName(HWND hwnd); // Useful for subclassing a HWND. Returns the previous window procedure. GFX_EXPORT WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); diff --git a/ui/gfx/win/window_impl.cc b/ui/gfx/win/window_impl.cc index 7f0c232..3ca3f90 100644 --- a/ui/gfx/win/window_impl.cc +++ b/ui/gfx/win/window_impl.cc @@ -97,7 +97,7 @@ ATOM ClassRegistrar::RetrieveClassAtom(const ClassInfo& class_info) { } // No class found, need to register one. - string16 name = string16(WindowImpl::kBaseClassName) + + base::string16 name = base::string16(WindowImpl::kBaseClassName) + base::IntToString16(registered_count_++); WNDCLASSEX window_class; diff --git a/ui/keyboard/keyboard_ui_handler.cc b/ui/keyboard/keyboard_ui_handler.cc index 780e0be..a626095 100644 --- a/ui/keyboard/keyboard_ui_handler.cc +++ b/ui/keyboard/keyboard_ui_handler.cc @@ -48,7 +48,7 @@ void KeyboardUIHandler::RegisterMessages() { } void KeyboardUIHandler::HandleInsertTextMessage(const base::ListValue* args) { - string16 text; + base::string16 text; if (!args->GetString(0, &text)) { LOG(ERROR) << "insertText failed: bad argument"; return; diff --git a/ui/message_center/cocoa/notification_controller.mm b/ui/message_center/cocoa/notification_controller.mm index 0a46050..574887f 100644 --- a/ui/message_center/cocoa/notification_controller.mm +++ b/ui/message_center/cocoa/notification_controller.mm @@ -227,7 +227,7 @@ // more than the given number of lines. The wrapped text would be painted using // the given font. The Ellipsis could be added at the end of the last line if // it is too long. -- (string16)wrapText:(const string16&)text +- (string16)wrapText:(const base::string16&)text forFont:(NSFont*)font maxNumberOfLines:(size_t)lines; @end @@ -392,9 +392,9 @@ [[itemView textContainer] setWidthTracksTextView:NO]; // Construct the text from the title and message. - string16 text = + base::string16 text = items[i].title + base::UTF8ToUTF16(" ") + items[i].message; - string16 ellidedText = + base::string16 ellidedText = [self wrapText:text forFont:font maxNumberOfLines:1]; [itemView setString:base::SysUTF16ToNSString(ellidedText)]; @@ -724,7 +724,7 @@ return contentFrame; } -- (string16)wrapText:(const string16&)text +- (string16)wrapText:(const base::string16&)text forFont:(NSFont*)nsfont maxNumberOfLines:(size_t)lines { if (text.empty()) @@ -733,18 +733,18 @@ int width = NSWidth([self currentContentRect]); int height = (lines + 1) * font_list.GetHeight(); - std::vector<string16> wrapped; + std::vector<base::string16> wrapped; gfx::ElideRectangleText(text, font_list, width, height, gfx::WRAP_LONG_WORDS, &wrapped); // This could be possible when the input text contains only spaces. if (wrapped.empty()) - return string16(); + return base::string16(); if (wrapped.size() > lines) { // Add an ellipsis to the last line. If this ellipsis makes the last line // too wide, that line will be further elided by the gfx::ElideText below. - string16 last = wrapped[lines - 1] + UTF8ToUTF16(gfx::kEllipsis); + base::string16 last = wrapped[lines - 1] + UTF8ToUTF16(gfx::kEllipsis); if (gfx::GetStringWidth(last, font_list) > width) last = gfx::ElideText(last, font_list, width, gfx::ELIDE_AT_END); wrapped.resize(lines - 1); diff --git a/ui/message_center/cocoa/notification_controller_unittest.mm b/ui/message_center/cocoa/notification_controller_unittest.mm index 7b4d2355..57726ab 100644 --- a/ui/message_center/cocoa/notification_controller_unittest.mm +++ b/ui/message_center/cocoa/notification_controller_unittest.mm @@ -115,7 +115,7 @@ TEST_F(NotificationControllerTest, BasicLayout) { ASCIIToUTF16("Added to circles"), ASCIIToUTF16("Jonathan and 5 others"), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -145,7 +145,7 @@ TEST_F(NotificationControllerTest, OverflowText) { "notification. Are you really going to read this " "entire thing?"), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -163,10 +163,10 @@ TEST_F(NotificationControllerTest, Close) { new message_center::Notification( message_center::NOTIFICATION_TYPE_SIMPLE, "an_id", - string16(), - string16(), + base::string16(), + base::string16(), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -193,7 +193,7 @@ TEST_F(NotificationControllerTest, Update) { ASCIIToUTF16("This message isn't too long and should fit in the" "default bounds."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -226,10 +226,10 @@ TEST_F(NotificationControllerTest, Buttons) { new message_center::Notification( message_center::NOTIFICATION_TYPE_BASE_FORMAT, "an_id", - string16(), - string16(), + base::string16(), + base::string16(), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), optional, NULL)); @@ -251,10 +251,10 @@ TEST_F(NotificationControllerTest, Image) { new message_center::Notification( message_center::NOTIFICATION_TYPE_BASE_FORMAT, "an_id", - string16(), - string16(), + base::string16(), + base::string16(), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -297,7 +297,7 @@ TEST_F(NotificationControllerTest, List) { UTF8ToUTF16("Notification Title"), UTF8ToUTF16("Notification Message - should be hidden"), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), optional, NULL)); diff --git a/ui/message_center/cocoa/popup_collection_unittest.mm b/ui/message_center/cocoa/popup_collection_unittest.mm index 445673d..4a853da 100644 --- a/ui/message_center/cocoa/popup_collection_unittest.mm +++ b/ui/message_center/cocoa/popup_collection_unittest.mm @@ -56,7 +56,7 @@ class PopupCollectionTest : public ui::CocoaTest { ASCIIToUTF16("This is the first notification to" " be displayed"), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -68,7 +68,7 @@ class PopupCollectionTest : public ui::CocoaTest { ASCIIToUTF16("Two"), ASCIIToUTF16("This is the second notification."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -85,7 +85,7 @@ class PopupCollectionTest : public ui::CocoaTest { "set the screen size too small or " "if the notification is way too big"), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -140,7 +140,7 @@ TEST_F(PopupCollectionTest, AttemptFourOneOffscreen) { ASCIIToUTF16("Four"), ASCIIToUTF16("This is the fourth notification."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -189,7 +189,7 @@ TEST_F(PopupCollectionTest, LayoutSpacing) { ASCIIToUTF16("Four"), ASCIIToUTF16("This is the fourth notification."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), optional, NULL)); @@ -227,7 +227,7 @@ TEST_F(PopupCollectionTest, TinyScreen) { ASCIIToUTF16("This is the first notification to" " be displayed"), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -249,7 +249,7 @@ TEST_F(PopupCollectionTest, TinyScreen) { "very very very very very very very " "long notification."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -293,7 +293,7 @@ TEST_F(PopupCollectionTest, UpdateIconAndBody) { "updated to have a significantly " "longer body"), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -322,7 +322,7 @@ TEST_F(PopupCollectionTest, CloseCollectionBeforeNewPopupAnimationEnds) { ASCIIToUTF16("This is the first notification to" " be displayed"), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -355,7 +355,7 @@ TEST_F(PopupCollectionTest, CloseCollectionBeforeUpdatePopupAnimationEnds) { ASCIIToUTF16("One"), ASCIIToUTF16("New message."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); diff --git a/ui/message_center/cocoa/popup_controller_unittest.mm b/ui/message_center/cocoa/popup_controller_unittest.mm index e443e04..33a6e43 100644 --- a/ui/message_center/cocoa/popup_controller_unittest.mm +++ b/ui/message_center/cocoa/popup_controller_unittest.mm @@ -24,7 +24,7 @@ TEST_F(PopupControllerTest, Creation) { ASCIIToUTF16("Added to circles"), ASCIIToUTF16("Jonathan and 5 others"), gfx::Image(), - string16(), + base::string16(), message_center::NotifierId(), message_center::RichNotificationData(), NULL)); diff --git a/ui/message_center/cocoa/settings_controller.mm b/ui/message_center/cocoa/settings_controller.mm index 82f2c46..1f8e204 100644 --- a/ui/message_center/cocoa/settings_controller.mm +++ b/ui/message_center/cocoa/settings_controller.mm @@ -192,11 +192,12 @@ void NotifierSettingsObserverMac::NotifierGroupChanged() { [groupDropDownButton_ setTarget:self]; // Add a dummy item for pull-down. [groupDropDownButton_ addItemWithTitle:@""]; - string16 title; + base::string16 title; for (size_t i = 0; i < groupCount; ++i) { const message_center::NotifierGroup& group = provider_->GetNotifierGroupAt(i); - string16 item = group.login_info.empty() ? group.name : group.login_info; + base::string16 item = + group.login_info.empty() ? group.name : group.login_info; [groupDropDownButton_ addItemWithTitle:base::SysUTF16ToNSString(item)]; if (provider_->IsNotifierGroupActiveAt(i)) { title = item; diff --git a/ui/message_center/cocoa/tray_view_controller_unittest.mm b/ui/message_center/cocoa/tray_view_controller_unittest.mm index cb649f9..fe2399d 100644 --- a/ui/message_center/cocoa/tray_view_controller_unittest.mm +++ b/ui/message_center/cocoa/tray_view_controller_unittest.mm @@ -76,7 +76,7 @@ TEST_F(TrayViewControllerTest, AddRemoveOne) { ASCIIToUTF16("First notification"), ASCIIToUTF16("This is a simple test."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -110,7 +110,7 @@ TEST_F(TrayViewControllerTest, AddThreeClearAll) { ASCIIToUTF16("First notification"), ASCIIToUTF16("This is a simple test."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -121,7 +121,7 @@ TEST_F(TrayViewControllerTest, AddThreeClearAll) { ASCIIToUTF16("Second notification"), ASCIIToUTF16("This is a simple test."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -132,7 +132,7 @@ TEST_F(TrayViewControllerTest, AddThreeClearAll) { ASCIIToUTF16("Third notification"), ASCIIToUTF16("This is a simple test."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -165,7 +165,7 @@ TEST_F(TrayViewControllerTest, NoClearAllWhenNoNotifications) { ASCIIToUTF16("First notification"), ASCIIToUTF16("This is a simple test."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); @@ -184,7 +184,7 @@ TEST_F(TrayViewControllerTest, NoClearAllWhenNoNotifications) { ASCIIToUTF16("Second notification"), ASCIIToUTF16("This is a simple test."), gfx::Image(), - string16(), + base::string16(), DummyNotifierId(), message_center::RichNotificationData(), NULL)); diff --git a/ui/message_center/notification.cc b/ui/message_center/notification.cc index 5e0f1b6..f18472c 100644 --- a/ui/message_center/notification.cc +++ b/ui/message_center/notification.cc @@ -14,13 +14,13 @@ unsigned g_next_serial_number_ = 0; namespace message_center { -NotificationItem::NotificationItem(const string16& title, - const string16& message) +NotificationItem::NotificationItem(const base::string16& title, + const base::string16& message) : title(title), message(message) { } -ButtonInfo::ButtonInfo(const string16& title) +ButtonInfo::ButtonInfo(const base::string16& title) : title(title) { } @@ -50,10 +50,10 @@ RichNotificationData::~RichNotificationData() {} Notification::Notification(NotificationType type, const std::string& id, - const string16& title, - const string16& message, + const base::string16& title, + const base::string16& message, const gfx::Image& icon, - const string16& display_source, + const base::string16& display_source, const NotifierId& notifier_id, const RichNotificationData& optional_fields, NotificationDelegate* delegate) diff --git a/ui/message_center/notification.h b/ui/message_center/notification.h index ff6f7d1..2e151b3 100644 --- a/ui/message_center/notification.h +++ b/ui/message_center/notification.h @@ -20,17 +20,17 @@ namespace message_center { struct MESSAGE_CENTER_EXPORT NotificationItem { - string16 title; - string16 message; + base::string16 title; + base::string16 message; - NotificationItem(const string16& title, const string16& message); + NotificationItem(const base::string16& title, const base::string16& message); }; struct MESSAGE_CENTER_EXPORT ButtonInfo { - string16 title; + base::string16 title; gfx::Image icon; - ButtonInfo(const string16& title); + ButtonInfo(const base::string16& title); }; class MESSAGE_CENTER_EXPORT RichNotificationData { @@ -42,8 +42,8 @@ class MESSAGE_CENTER_EXPORT RichNotificationData { int priority; bool never_timeout; base::Time timestamp; - string16 expanded_message; - string16 context_message; + base::string16 expanded_message; + base::string16 context_message; gfx::Image image; std::vector<NotificationItem> items; int progress; @@ -56,10 +56,10 @@ class MESSAGE_CENTER_EXPORT Notification { public: Notification(NotificationType type, const std::string& id, - const string16& title, - const string16& message, + const base::string16& title, + const base::string16& message, const gfx::Image& icon, - const string16& display_source, + const base::string16& display_source, const NotifierId& notifier_id, const RichNotificationData& optional_fields, NotificationDelegate* delegate); @@ -77,14 +77,14 @@ class MESSAGE_CENTER_EXPORT Notification { const std::string& id() const { return id_; } - const string16& title() const { return title_; } - void set_title(const string16& title) { title_ = title; } + const base::string16& title() const { return title_; } + void set_title(const base::string16& title) { title_ = title; } - const string16& message() const { return message_; } - void set_message(const string16& message) { message_ = message; } + const base::string16& message() const { return message_; } + void set_message(const base::string16& message) { message_ = message; } // A display string for the source of the notification. - const string16& display_source() const { return display_source_; } + const base::string16& display_source() const { return display_source_; } const NotifierId& notifier_id() const { return notifier_id_; } @@ -101,17 +101,17 @@ class MESSAGE_CENTER_EXPORT Notification { optional_fields_.timestamp = timestamp; } - const string16& expanded_message() const { + const base::string16& expanded_message() const { return optional_fields_.expanded_message; } - void set_expanded_message(const string16& expanded_message) { + void set_expanded_message(const base::string16& expanded_message) { optional_fields_.expanded_message = expanded_message; } - const string16& context_message() const { + const base::string16& context_message() const { return optional_fields_.context_message; } - void set_context_message(const string16& context_message) { + void set_context_message(const base::string16& context_message) { optional_fields_.context_message = context_message; } @@ -205,15 +205,15 @@ class MESSAGE_CENTER_EXPORT Notification { NotificationType type_; std::string id_; - string16 title_; - string16 message_; + base::string16 title_; + base::string16 message_; // Image data for the associated icon, used by Ash when available. gfx::Image icon_; // The display string for the source of the notification. Could be // the same as origin_url_, or the name of an extension. - string16 display_source_; + base::string16 display_source_; private: NotifierId notifier_id_; diff --git a/ui/message_center/notifier_settings.cc b/ui/message_center/notifier_settings.cc index 0e6fe9b..2654611 100644 --- a/ui/message_center/notifier_settings.cc +++ b/ui/message_center/notifier_settings.cc @@ -51,7 +51,7 @@ bool NotifierId::operator<(const NotifierId& other) const { } Notifier::Notifier(const NotifierId& notifier_id, - const string16& name, + const base::string16& name, bool enabled) : notifier_id(notifier_id), name(name), @@ -62,8 +62,8 @@ Notifier::~Notifier() { } NotifierGroup::NotifierGroup(const gfx::Image& icon, - const string16& name, - const string16& login_info, + const base::string16& name, + const base::string16& login_info, size_t index) : icon(icon), name(name), login_info(login_info), index(index) {} diff --git a/ui/message_center/notifier_settings.h b/ui/message_center/notifier_settings.h index 7fe859a..644ed4c5 100644 --- a/ui/message_center/notifier_settings.h +++ b/ui/message_center/notifier_settings.h @@ -86,14 +86,16 @@ struct MESSAGE_CENTER_EXPORT NotifierId { // The struct to hold the information of notifiers. The information will be // used by NotifierSettingsView. struct MESSAGE_CENTER_EXPORT Notifier { - Notifier(const NotifierId& notifier_id, const string16& name, bool enabled); + Notifier(const NotifierId& notifier_id, + const base::string16& name, + bool enabled); ~Notifier(); NotifierId notifier_id; // The human-readable name of the notifier such like the extension name. // It can be empty. - string16 name; + base::string16 name; // True if the source is allowed to send notifications. True is default. bool enabled; @@ -107,8 +109,8 @@ struct MESSAGE_CENTER_EXPORT Notifier { struct MESSAGE_CENTER_EXPORT NotifierGroup { NotifierGroup(const gfx::Image& icon, - const string16& name, - const string16& login_info, + const base::string16& name, + const base::string16& login_info, size_t index); ~NotifierGroup(); @@ -116,10 +118,10 @@ struct MESSAGE_CENTER_EXPORT NotifierGroup { const gfx::Image icon; // Display name of a notifier group. - const string16 name; + const base::string16 name; // More display information about the notifier group. - string16 login_info; + base::string16 login_info; // Unique identifier for the notifier group so that they can be selected in // the UI. diff --git a/ui/message_center/views/bounded_label.cc b/ui/message_center/views/bounded_label.cc index 2b8423b..56c9b13 100644 --- a/ui/message_center/views/bounded_label.cc +++ b/ui/message_center/views/bounded_label.cc @@ -40,7 +40,7 @@ class InnerBoundedLabel : public views::Label { // Pass in a -1 width to use the preferred width, a -1 limit to skip limits. int GetLinesForWidthAndLimit(int width, int limit); gfx::Size GetSizeForWidthAndLines(int width, int lines); - std::vector<string16> GetWrappedText(int width, int lines); + std::vector<base::string16> GetWrappedText(int width, int lines); protected: // Overridden from views::Label. @@ -57,7 +57,7 @@ class InnerBoundedLabel : public views::Label { void SetCachedSize(std::pair<int, int> width_and_lines, gfx::Size size); const BoundedLabel* owner_; // Weak reference. - string16 wrapped_text_; + base::string16 wrapped_text_; int wrapped_text_width_; int wrapped_text_lines_; std::map<int, int> lines_cache_; @@ -108,7 +108,7 @@ gfx::Size InnerBoundedLabel::GetSizeForWidthAndLines(int width, int lines) { int text_width = (width < 0) ? std::numeric_limits<int>::max() : std::max(width - insets.width(), 0); int text_height = std::numeric_limits<int>::max(); - std::vector<string16> wrapped = GetWrappedText(text_width, lines); + std::vector<base::string16> wrapped = GetWrappedText(text_width, lines); gfx::Canvas::SizeStringInt(JoinString(wrapped, '\n'), font(), &text_width, &text_height, owner_->GetLineHeight(), @@ -120,10 +120,11 @@ gfx::Size InnerBoundedLabel::GetSizeForWidthAndLines(int width, int lines) { return size; } -std::vector<string16> InnerBoundedLabel::GetWrappedText(int width, int lines) { +std::vector<base::string16> InnerBoundedLabel::GetWrappedText(int width, + int lines) { // Short circuit simple case. if (width == 0 || lines == 0) - return std::vector<string16>(); + return std::vector<base::string16>(); // Restrict line limit to ensure (lines + 1) * line_height <= INT_MAX and // use it to calculate a reasonable text height. @@ -141,7 +142,7 @@ std::vector<string16> InnerBoundedLabel::GetWrappedText(int width, int lines) { width = std::max(width, 2 * font().GetStringWidth(UTF8ToUTF16("W"))); // Wrap, using INT_MAX for -1 widths that indicate no wrapping. - std::vector<string16> wrapped; + std::vector<base::string16> wrapped; gfx::ElideRectangleText(text(), font_list(), (width < 0) ? std::numeric_limits<int>::max() : width, height, gfx::WRAP_LONG_WORDS, &wrapped); @@ -151,7 +152,7 @@ std::vector<string16> InnerBoundedLabel::GetWrappedText(int width, int lines) { // Add an ellipsis to the last line. If this ellipsis makes the last line // too wide, that line will be further elided by the gfx::ElideText below, // so for example "ABC" could become "ABC..." and then "AB...". - string16 last = wrapped[lines - 1] + UTF8ToUTF16(gfx::kEllipsis); + base::string16 last = wrapped[lines - 1] + UTF8ToUTF16(gfx::kEllipsis); if (width > 0 && font().GetStringWidth(last) > width) last = gfx::ElideText(last, font(), width, gfx::ELIDE_AT_END); wrapped.resize(lines - 1); @@ -257,14 +258,15 @@ void InnerBoundedLabel::SetCachedSize(std::pair<int, int> width_and_lines, // BoundedLabel /////////////////////////////////////////////////////////// -BoundedLabel::BoundedLabel(const string16& text, const gfx::FontList& font_list) +BoundedLabel::BoundedLabel(const base::string16& text, + const gfx::FontList& font_list) : line_limit_(-1) { label_.reset(new InnerBoundedLabel(*this)); label_->SetFontList(font_list); label_->SetText(text); } -BoundedLabel::BoundedLabel(const string16& text) +BoundedLabel::BoundedLabel(const base::string16& text) : line_limit_(-1) { label_.reset(new InnerBoundedLabel(*this)); label_->SetText(text); @@ -338,7 +340,7 @@ void BoundedLabel::OnNativeThemeChanged(const ui::NativeTheme* theme) { label_->SetNativeTheme(theme); } -string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) { +base::string16 BoundedLabel::GetWrappedTextForTest(int width, int lines) { return JoinString(label_->GetWrappedText(width, lines), '\n'); } diff --git a/ui/message_center/views/bounded_label.h b/ui/message_center/views/bounded_label.h index d6b2f49..c607177 100644 --- a/ui/message_center/views/bounded_label.h +++ b/ui/message_center/views/bounded_label.h @@ -33,8 +33,8 @@ class BoundedLabelTest; // bounded_label.cc file for details. class MESSAGE_CENTER_EXPORT BoundedLabel : public views::View { public: - BoundedLabel(const string16& text, const gfx::FontList& font_list); - BoundedLabel(const string16& text); + BoundedLabel(const base::string16& text, const gfx::FontList& font_list); + BoundedLabel(const base::string16& text); virtual ~BoundedLabel(); void SetColors(SkColor textColor, SkColor backgroundColor); @@ -64,7 +64,7 @@ class MESSAGE_CENTER_EXPORT BoundedLabel : public views::View { private: friend class test::BoundedLabelTest; - string16 GetWrappedTextForTest(int width, int lines); + base::string16 GetWrappedTextForTest(int width, int lines); scoped_ptr<InnerBoundedLabel> label_; int line_limit_; diff --git a/ui/message_center/views/bounded_label_unittest.cc b/ui/message_center/views/bounded_label_unittest.cc index bdfb0ac..3761b9f 100644 --- a/ui/message_center/views/bounded_label_unittest.cc +++ b/ui/message_center/views/bounded_label_unittest.cc @@ -35,10 +35,10 @@ class BoundedLabelTest : public testing::Test { // with an ellipses character (UTF8 "\xE2\x80\xA6") and returns a string16 // with the results. This allows test strings to be specified as ASCII const // char* strings, making tests more readable and easier to write. - string16 ToString(const char* string) { - const string16 periods = UTF8ToUTF16("..."); - const string16 ellipses = UTF8ToUTF16("\xE2\x80\xA6"); - string16 result = UTF8ToUTF16(string); + base::string16 ToString(const char* string) { + const base::string16 periods = UTF8ToUTF16("..."); + const base::string16 ellipses = UTF8ToUTF16("\xE2\x80\xA6"); + base::string16 result = UTF8ToUTF16(string); ReplaceSubstringsAfterOffset(&result, 0, periods, ellipses); return result; } @@ -58,7 +58,7 @@ class BoundedLabelTest : public testing::Test { } // Exercise BounderLabel::GetWrappedText() using the fixture's test label. - string16 GetWrappedText(int width) { + base::string16 GetWrappedText(int width) { return label_->GetWrappedTextForTest(width, lines_); } @@ -71,7 +71,7 @@ class BoundedLabelTest : public testing::Test { protected: // Creates a label to test with. Returns this fixture, which can be used to // test the newly created label using the exercise methods above. - BoundedLabelTest& Label(string16 text, int lines) { + BoundedLabelTest& Label(base::string16 text, int lines) { lines_ = lines; label_.reset(new BoundedLabel(text, font_list_)); label_->SetLineLimit(lines_); diff --git a/ui/message_center/views/group_view.cc b/ui/message_center/views/group_view.cc index 64c5d73..3b4d7c5 100644 --- a/ui/message_center/views/group_view.cc +++ b/ui/message_center/views/group_view.cc @@ -78,7 +78,7 @@ GroupView::GroupView(MessageCenterController* controller, context_message_view_(NULL), icon_view_(NULL) { - std::vector<string16> accessible_lines; + std::vector<base::string16> accessible_lines; // Create the top_view_, which collects into a vertical box all content // at the top of the notification (to the right of the icon) except for the // close button. @@ -96,7 +96,7 @@ GroupView::GroupView(MessageCenterController* controller, int padding = kTitleLineHeight - font_list.GetHeight(); title_view_ = new BoundedLabel( - gfx::TruncateString(string16(last_notification.title()), + gfx::TruncateString(base::string16(last_notification.title()), kTitleCharacterLimit), font_list); accessible_lines.push_back(last_notification.title()); @@ -155,7 +155,7 @@ GroupView::GroupView(MessageCenterController* controller, 1, 0, 0, 0, kButtonSeparatorColor)); bottom_view_->AddChildView(separator); more_button_ = new NotificationButton(this); - string16 button_title = + base::string16 button_title = l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_MORE_FROM, base::IntToString16(group_size_), display_source_); diff --git a/ui/message_center/views/group_view.h b/ui/message_center/views/group_view.h index 1b3f5ba..020f7d1 100644 --- a/ui/message_center/views/group_view.h +++ b/ui/message_center/views/group_view.h @@ -51,7 +51,7 @@ class GroupView : public MessageView, public MessageViewController { private: MessageCenterController* controller_; // Weak, controls lifetime of views. NotifierId notifier_id_; - string16 display_source_; + base::string16 display_source_; gfx::ImageSkia group_icon_; int group_size_; std::string last_notification_id_; diff --git a/ui/message_center/views/message_center_view_unittest.cc b/ui/message_center/views/message_center_view_unittest.cc index 4e86ed3..1a4ad9f 100644 --- a/ui/message_center/views/message_center_view_unittest.cc +++ b/ui/message_center/views/message_center_view_unittest.cc @@ -238,7 +238,7 @@ void MessageCenterViewTest::RegisterCall(CallType type) { } void MessageCenterViewTest::LogBounds(int depth, views::View* view) { - string16 inset; + base::string16 inset; for (int i = 0; i < depth; ++i) inset.append(UTF8ToUTF16(" ")); gfx::Rect bounds = view->bounds(); diff --git a/ui/message_center/views/message_popup_collection_unittest.cc b/ui/message_center/views/message_popup_collection_unittest.cc index 4840f20..9b244276 100644 --- a/ui/message_center/views/message_popup_collection_unittest.cc +++ b/ui/message_center/views/message_popup_collection_unittest.cc @@ -90,7 +90,7 @@ class MessagePopupCollectionTest : public views::ViewsTestBase { UTF8ToUTF16("test title"), UTF8ToUTF16("test message"), gfx::Image(), - string16() /* display_source */, + base::string16() /* display_source */, NotifierId(), message_center::RichNotificationData(), NULL /* delegate */)); diff --git a/ui/message_center/views/message_view.cc b/ui/message_center/views/message_view.cc index 509e755..6c1a681 100644 --- a/ui/message_center/views/message_view.cc +++ b/ui/message_center/views/message_view.cc @@ -38,7 +38,7 @@ namespace message_center { MessageView::MessageView(MessageViewController* controller, const std::string& notification_id, const NotifierId& notifier_id, - const string16& display_source) + const base::string16& display_source) : controller_(controller), notification_id_(notification_id), notifier_id_(notifier_id), diff --git a/ui/message_center/views/message_view.h b/ui/message_center/views/message_view.h index fc2b161..a10a705 100644 --- a/ui/message_center/views/message_view.h +++ b/ui/message_center/views/message_view.h @@ -48,7 +48,7 @@ class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, MessageView(MessageViewController* controller, const std::string& notification_id, const NotifierId& notifier_id, - const string16& display_source); + const base::string16& display_source); virtual ~MessageView(); // Returns the insets for the shadow it will have for rich notification. @@ -60,7 +60,9 @@ class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, bool IsCloseButtonFocused(); void RequestFocusOnCloseButton(); - void set_accessible_name(const string16& name) { accessible_name_ = name; } + void set_accessible_name(const base::string16& accessible_name) { + accessible_name_ = accessible_name; + } // Overridden from views::View: virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; @@ -99,7 +101,7 @@ class MESSAGE_CENTER_EXPORT MessageView : public views::SlideOutView, scoped_ptr<views::ImageButton> close_button_; views::ScrollView* scroller_; - string16 accessible_name_; + base::string16 accessible_name_; base::string16 display_source_; diff --git a/ui/message_center/views/notification_button.cc b/ui/message_center/views/notification_button.cc index 7ef5295..8fa32f3 100644 --- a/ui/message_center/views/notification_button.cc +++ b/ui/message_center/views/notification_button.cc @@ -54,7 +54,7 @@ void NotificationButton::SetIcon(const gfx::ImageSkia& image) { } } -void NotificationButton::SetTitle(const string16& title) { +void NotificationButton::SetTitle(const base::string16& title) { if (title_ != NULL) delete title_; // This removes the title from this view's children. if (title.empty()) { diff --git a/ui/message_center/views/notification_button.h b/ui/message_center/views/notification_button.h index 7d3c52ce..e0603cd 100644 --- a/ui/message_center/views/notification_button.h +++ b/ui/message_center/views/notification_button.h @@ -24,7 +24,7 @@ class NotificationButton : public views::CustomButton { virtual ~NotificationButton(); void SetIcon(const gfx::ImageSkia& icon); - void SetTitle(const string16& title); + void SetTitle(const base::string16& title); // Overridden from views::View: virtual gfx::Size GetPreferredSize() OVERRIDE; diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc index 21ab8a9..3403b286 100644 --- a/ui/message_center/views/notification_view.cc +++ b/ui/message_center/views/notification_view.cc @@ -303,7 +303,7 @@ NotificationView::NotificationView(MessageCenterController* controller, controller_(controller), clickable_(notification.clickable()), is_expanded_(expanded) { - std::vector<string16> accessible_lines; + std::vector<base::string16> accessible_lines; // Create the top_view_, which collects into a vertical box all content // at the top of the notification (to the right of the icon) except for the // close button. diff --git a/ui/message_center/views/notifier_settings_view.cc b/ui/message_center/views/notifier_settings_view.cc index daff2d4..2d24a73 100644 --- a/ui/message_center/views/notifier_settings_view.cc +++ b/ui/message_center/views/notifier_settings_view.cc @@ -295,7 +295,7 @@ NotifierSettingsView::NotifierButton::NotifierButton( notifier_(notifier), icon_view_(new views::ImageView()), name_view_(new views::Label(notifier_->name)), - checkbox_(new views::Checkbox(string16())), + checkbox_(new views::Checkbox(base::string16())), learn_more_(NULL) { DCHECK(provider); DCHECK(notifier); @@ -581,7 +581,7 @@ void NotifierSettingsView::UpdateContentsView( if (need_account_switcher) { const NotifierGroup& active_group = provider_->GetActiveNotifierGroup(); - string16 notifier_group_text = active_group.login_info.empty() ? + base::string16 notifier_group_text = active_group.login_info.empty() ? active_group.name : active_group.login_info; notifier_group_selector_ = new views::MenuButton(NULL, notifier_group_text, this, true); diff --git a/ui/metro_viewer/ime_types.h b/ui/metro_viewer/ime_types.h index 8b3e291..0fb701d 100644 --- a/ui/metro_viewer/ime_types.h +++ b/ui/metro_viewer/ime_types.h @@ -28,7 +28,7 @@ struct UnderlineInfo { struct Composition { Composition(); ~Composition(); - string16 text; + base::string16 text; int32 selection_start; int32 selection_end; std::vector<UnderlineInfo> underlines; diff --git a/ui/metro_viewer/metro_viewer_messages.h b/ui/metro_viewer/metro_viewer_messages.h index eae79d6..b68c052 100644 --- a/ui/metro_viewer/metro_viewer_messages.h +++ b/ui/metro_viewer/metro_viewer_messages.h @@ -100,7 +100,7 @@ IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_ActivateDesktop, // Requests the viewer to open a URL in desktop mode. IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_OpenURLOnDesktop, base::FilePath, /* shortcut */ - string16 /* url */); + base::string16 /* url */); // Requests the viewer to change the pointer to a new cursor. IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_SetCursor, @@ -111,19 +111,19 @@ IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_SetCursor, IPC_STRUCT_BEGIN(MetroViewerHostMsg_SaveAsDialogParams) // The title of the file save dialog if any. - IPC_STRUCT_MEMBER(string16, title) + IPC_STRUCT_MEMBER(base::string16, title) // The suggested file name. IPC_STRUCT_MEMBER(base::FilePath, suggested_name) // The save as filter to be used. - IPC_STRUCT_MEMBER(string16, filter) + IPC_STRUCT_MEMBER(base::string16, filter) // The filter index. IPC_STRUCT_MEMBER(uint32, filter_index) // The default extension. - IPC_STRUCT_MEMBER(string16, default_extension) + IPC_STRUCT_MEMBER(base::string16, default_extension) IPC_STRUCT_END() @@ -133,14 +133,14 @@ IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_DisplayFileSaveAs, // Requests the viewer to display the file open dialog. IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_DisplayFileOpen, - string16, /* title */ - string16, /* filter */ + base::string16, /* title */ + base::string16, /* filter */ base::FilePath, /* Default path */ bool) /* allow_multi_select */ // Requests the viewer to display the select folder dialog. IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_DisplaySelectFolder, - string16) /* title */ + base::string16) /* title */ // Sent to the viewer process to set the cursor position. IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_SetCursorPos, @@ -152,10 +152,10 @@ IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_SetCursorPos, IPC_MESSAGE_CONTROL0(MetroViewerHostMsg_SetCursorPosAck) IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_OpenURL, - string16) /* url */ + base::string16) /* url */ IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_SearchRequest, - string16) /* search_string */ + base::string16) /* search_string */ // Sent from the metro viewer process to the browser process to indicate that // the viewer window size has changed. @@ -173,7 +173,7 @@ IPC_STRUCT_TRAITS_END() // composition string. IPC_MESSAGE_CONTROL4( MetroViewerHostMsg_ImeCompositionChanged, - string16, /* text */ + base::string16, /* text */ int32, /* selection_start */ int32, /* selection_end */ std::vector<metro_viewer::UnderlineInfo>) /* underlines */ @@ -186,7 +186,7 @@ IPC_MESSAGE_CONTROL1( // Sent from the metro viewer process to the browser process to commit strings. IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_ImeTextCommitted, - string16) /* text */ + base::string16) /* text */ // Sent from the metro viewer process to the browser process to notify that the // active text input source is changed. diff --git a/ui/views/accessibility/native_view_accessibility_win.cc b/ui/views/accessibility/native_view_accessibility_win.cc index 3e20cbb..2b11e96 100644 --- a/ui/views/accessibility/native_view_accessibility_win.cc +++ b/ui/views/accessibility/native_view_accessibility_win.cc @@ -559,7 +559,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accDefaultAction( ui::AccessibleViewState state; view_->GetAccessibleState(&state); - string16 temp_action = state.default_action; + base::string16 temp_action = state.default_action; if (!temp_action.empty()) { *def_action = SysAllocString(temp_action.c_str()); @@ -578,7 +578,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accDescription( if (!view_) return E_FAIL; - string16 temp_desc; + base::string16 temp_desc; view_->GetTooltipText(gfx::Point(), &temp_desc); if (!temp_desc.empty()) { @@ -626,7 +626,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accKeyboardShortcut( ui::AccessibleViewState state; view_->GetAccessibleState(&state); - string16 temp_key = state.keyboard_shortcut; + base::string16 temp_key = state.keyboard_shortcut; if (!temp_key.empty()) { *acc_key = SysAllocString(temp_key.c_str()); @@ -648,7 +648,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accName( // Retrieve the current view's name. ui::AccessibleViewState state; view_->GetAccessibleState(&state); - string16 temp_name = state.name; + base::string16 temp_name = state.name; if (!temp_name.empty()) { // Return name retrieved. *name = SysAllocString(temp_name.c_str()); @@ -735,7 +735,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accValue(VARIANT var_id, // Retrieve the current view's value. ui::AccessibleViewState state; view_->GetAccessibleState(&state); - string16 temp_value = state.value; + base::string16 temp_value = state.value; if (!temp_value.empty()) { // Return value retrieved. @@ -877,7 +877,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_nCharacters(LONG* n_characters) { if (!n_characters) return E_INVALIDARG; - string16 text = TextForIAccessibleText(); + base::string16 text = TextForIAccessibleText(); *n_characters = static_cast<LONG>(text.size()); return S_OK; } @@ -935,7 +935,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_text(LONG start_offset, ui::AccessibleViewState state; view_->GetAccessibleState(&state); - string16 text_str = TextForIAccessibleText(); + base::string16 text_str = TextForIAccessibleText(); LONG len = static_cast<LONG>(text_str.size()); if (start_offset == IA2_TEXT_OFFSET_LENGTH) { @@ -963,7 +963,8 @@ STDMETHODIMP NativeViewAccessibilityWin::get_text(LONG start_offset, if (end_offset > len) return E_INVALIDARG; - string16 substr = text_str.substr(start_offset, end_offset - start_offset); + base::string16 substr = + text_str.substr(start_offset, end_offset - start_offset); if (substr.empty()) return S_FALSE; @@ -989,7 +990,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_textAtOffset( return S_FALSE; } - const string16& text_str = TextForIAccessibleText(); + const base::string16& text_str = TextForIAccessibleText(); *start_offset = FindBoundary( text_str, boundary_type, offset, ui::BACKWARDS_DIRECTION); @@ -1015,7 +1016,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_textBeforeOffset( return S_FALSE; } - const string16& text_str = TextForIAccessibleText(); + const base::string16& text_str = TextForIAccessibleText(); *start_offset = FindBoundary( text_str, boundary_type, offset, ui::BACKWARDS_DIRECTION); @@ -1040,7 +1041,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_textAfterOffset( return S_FALSE; } - const string16& text_str = TextForIAccessibleText(); + const base::string16& text_str = TextForIAccessibleText(); *start_offset = offset; *end_offset = FindBoundary( @@ -1344,7 +1345,7 @@ void NativeViewAccessibilityWin::SetState( msaa_state->lVal |= MSAAState(view_state.state); } -string16 NativeViewAccessibilityWin::TextForIAccessibleText() { +base::string16 NativeViewAccessibilityWin::TextForIAccessibleText() { ui::AccessibleViewState state; view_->GetAccessibleState(&state); if (state.role == AccessibilityTypes::ROLE_TEXT) @@ -1354,7 +1355,7 @@ string16 NativeViewAccessibilityWin::TextForIAccessibleText() { } void NativeViewAccessibilityWin::HandleSpecialTextOffset( - const string16& text, LONG* offset) { + const base::string16& text, LONG* offset) { if (*offset == IA2_TEXT_OFFSET_LENGTH) { *offset = static_cast<LONG>(text.size()); } else if (*offset == IA2_TEXT_OFFSET_CARET) { @@ -1378,7 +1379,7 @@ ui::TextBoundaryType NativeViewAccessibilityWin::IA2TextBoundaryToTextBoundary( } LONG NativeViewAccessibilityWin::FindBoundary( - const string16& text, + const base::string16& text, IA2TextBoundaryType ia2_boundary, LONG start_offset, ui::TextBoundaryDirection direction) { diff --git a/ui/views/accessibility/native_view_accessibility_win.h b/ui/views/accessibility/native_view_accessibility_win.h index 83d03db..0c248c8 100644 --- a/ui/views/accessibility/native_view_accessibility_win.h +++ b/ui/views/accessibility/native_view_accessibility_win.h @@ -374,11 +374,11 @@ NativeViewAccessibilityWin void SetState(VARIANT* msaa_state, View* view); // Return the text to use for IAccessibleText. - string16 TextForIAccessibleText(); + base::string16 TextForIAccessibleText(); // If offset is a member of IA2TextSpecialOffsets this function updates the // value of offset and returns, otherwise offset remains unchanged. - void HandleSpecialTextOffset(const string16& text, LONG* offset); + void HandleSpecialTextOffset(const base::string16& text, LONG* offset); // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType. ui::TextBoundaryType IA2TextBoundaryToTextBoundary(IA2TextBoundaryType type); @@ -386,7 +386,7 @@ NativeViewAccessibilityWin // Search forwards (direction == 1) or backwards (direction == -1) // from the given offset until the given boundary is found, and // return the offset of that boundary. - LONG FindBoundary(const string16& text, + LONG FindBoundary(const base::string16& text, IA2TextBoundaryType ia2_boundary, LONG start_offset, ui::TextBoundaryDirection direction); diff --git a/ui/views/accessible_pane_view_unittest.cc b/ui/views/accessible_pane_view_unittest.cc index 02778d6..75938c7 100644 --- a/ui/views/accessible_pane_view_unittest.cc +++ b/ui/views/accessible_pane_view_unittest.cc @@ -57,7 +57,7 @@ void TestBarView::ButtonPressed(Button* sender, const ui::Event& event) { void TestBarView::Init() { SetLayoutManager(new FillLayout()); - string16 label; + base::string16 label; child_button_.reset(new LabelButton(this, label)); AddChildView(child_button_.get()); second_child_button_.reset(new LabelButton(this, label)); diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc index 7e0fd5e..836a56f 100644 --- a/ui/views/bubble/bubble_frame_view.cc +++ b/ui/views/bubble/bubble_frame_view.cc @@ -67,11 +67,12 @@ BubbleFrameView::BubbleFrameView(const gfx::Insets& content_margins) close_(NULL), titlebar_extra_view_(NULL) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - title_ = new Label(string16(), rb.GetFont(ui::ResourceBundle::MediumFont)); + title_ = + new Label(base::string16(), rb.GetFont(ui::ResourceBundle::MediumFont)); title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); AddChildView(title_); - close_ = new LabelButton(this, string16()); + close_ = new LabelButton(this, base::string16()); close_->SetImage(CustomButton::STATE_NORMAL, *rb.GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); close_->SetImage(CustomButton::STATE_HOVERED, @@ -154,7 +155,7 @@ void BubbleFrameView::UpdateWindowIcon() {} void BubbleFrameView::UpdateWindowTitle() { title_->SetText(GetWidget()->widget_delegate()->ShouldShowWindowTitle() ? - GetWidget()->widget_delegate()->GetWindowTitle() : string16()); + GetWidget()->widget_delegate()->GetWindowTitle() : base::string16()); // Update the close button visibility too, otherwise it's not intialized. ResetWindowControls(); } diff --git a/ui/views/bubble/tray_bubble_view.h b/ui/views/bubble/tray_bubble_view.h index 1e9d482..6e4cb9b 100644 --- a/ui/views/bubble/tray_bubble_view.h +++ b/ui/views/bubble/tray_bubble_view.h @@ -71,7 +71,7 @@ class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView, // Called from GetAccessibleState(); should return the appropriate // accessible name for the bubble. - virtual string16 GetAccessibleNameForBubble() = 0; + virtual base::string16 GetAccessibleNameForBubble() = 0; // Passes responsibility for BubbleDelegateView::GetAnchorRect to the // delegate. diff --git a/ui/views/button_drag_utils.cc b/ui/views/button_drag_utils.cc index 9305a07..e3ab1d0 100644 --- a/ui/views/button_drag_utils.cc +++ b/ui/views/button_drag_utils.cc @@ -21,7 +21,7 @@ namespace button_drag_utils { static const int kLinkDragImageMaxWidth = 200; void SetURLAndDragImage(const GURL& url, - const string16& title, + const base::string16& title, const gfx::ImageSkia& icon, ui::OSExchangeData* data, views::Widget* widget) { diff --git a/ui/views/button_drag_utils.h b/ui/views/button_drag_utils.h index 1f93c95..0570ff2 100644 --- a/ui/views/button_drag_utils.h +++ b/ui/views/button_drag_utils.h @@ -27,7 +27,7 @@ namespace button_drag_utils { // Sets url and title on data as well as setting a suitable image for dragging. // The image looks like that of the bookmark buttons. VIEWS_EXPORT void SetURLAndDragImage(const GURL& url, - const string16& title, + const base::string16& title, const gfx::ImageSkia& icon, ui::OSExchangeData* data, views::Widget* widget); diff --git a/ui/views/color_chooser/color_chooser_view.cc b/ui/views/color_chooser/color_chooser_view.cc index 3c649f9..4536e27 100644 --- a/ui/views/color_chooser/color_chooser_view.cc +++ b/ui/views/color_chooser/color_chooser_view.cc @@ -32,14 +32,14 @@ const int kHueIndicatorSize = 5; const int kBorderWidth = 1; const int kTextfieldLengthInChars = 14; -string16 GetColorText(SkColor color) { +base::string16 GetColorText(SkColor color) { return ASCIIToUTF16(base::StringPrintf("#%02x%02x%02x", SkColorGetR(color), SkColorGetG(color), SkColorGetB(color))); } -bool GetColorFromText(const string16& text, SkColor* result) { +bool GetColorFromText(const base::string16& text, SkColor* result) { if (text.size() != 6 && !(text.size() == 7 && text[0] == '#')) return false; @@ -454,7 +454,7 @@ View* ColorChooserView::GetContentsView() { } void ColorChooserView::ContentsChanged(Textfield* sender, - const string16& new_contents) { + const base::string16& new_contents) { SkColor color = SK_ColorBLACK; if (GetColorFromText(new_contents, &color)) { SkColorToHSV(color, hsv_); diff --git a/ui/views/color_chooser/color_chooser_view.h b/ui/views/color_chooser/color_chooser_view.h index c77e0b6..e7fda32 100644 --- a/ui/views/color_chooser/color_chooser_view.h +++ b/ui/views/color_chooser/color_chooser_view.h @@ -55,7 +55,7 @@ class VIEWS_EXPORT ColorChooserView : public WidgetDelegateView, // TextfieldController overrides: virtual void ContentsChanged(Textfield* sender, - const string16& new_contents) OVERRIDE; + const base::string16& new_contents) OVERRIDE; virtual bool HandleKeyEvent(Textfield* sender, const ui::KeyEvent& key_event) OVERRIDE; diff --git a/ui/views/controls/button/blue_button.cc b/ui/views/controls/button/blue_button.cc index 3e52afd..82260b1 100644 --- a/ui/views/controls/button/blue_button.cc +++ b/ui/views/controls/button/blue_button.cc @@ -27,7 +27,7 @@ namespace views { // static const char BlueButton::kViewClassName[] = "views/BlueButton"; -BlueButton::BlueButton(ButtonListener* listener, const string16& text) +BlueButton::BlueButton(ButtonListener* listener, const base::string16& text) : LabelButton(listener, text) { // Inherit STYLE_BUTTON insets, minimum size, alignment, etc. SetStyle(STYLE_BUTTON); diff --git a/ui/views/controls/button/button.cc b/ui/views/controls/button/button.cc index 96e2e27..83df6e2 100644 --- a/ui/views/controls/button/button.cc +++ b/ui/views/controls/button/button.cc @@ -15,21 +15,22 @@ namespace views { Button::~Button() { } -void Button::SetTooltipText(const string16& tooltip_text) { +void Button::SetTooltipText(const base::string16& tooltip_text) { tooltip_text_ = tooltip_text; if (accessible_name_.empty()) accessible_name_ = tooltip_text_; TooltipTextChanged(); } -void Button::SetAccessibleName(const string16& name) { +void Button::SetAccessibleName(const base::string16& name) { accessible_name_ = name; } //////////////////////////////////////////////////////////////////////////////// // Button, View overrides: -bool Button::GetTooltipText(const gfx::Point& p, string16* tooltip) const { +bool Button::GetTooltipText(const gfx::Point& p, + base::string16* tooltip) const { if (tooltip_text_.empty()) return false; diff --git a/ui/views/controls/button/button.h b/ui/views/controls/button/button.h index d038015..75952d2 100644 --- a/ui/views/controls/button/button.h +++ b/ui/views/controls/button/button.h @@ -46,16 +46,16 @@ class VIEWS_EXPORT Button : public View { STYLE_COUNT, }; - void SetTooltipText(const string16& tooltip_text); + void SetTooltipText(const base::string16& tooltip_text); int tag() const { return tag_; } void set_tag(int tag) { tag_ = tag; } - void SetAccessibleName(const string16& name); + void SetAccessibleName(const base::string16& name); // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, - string16* tooltip) const OVERRIDE; + base::string16* tooltip) const OVERRIDE; virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; protected: @@ -72,10 +72,10 @@ class VIEWS_EXPORT Button : public View { private: // The text shown in a tooltip. - string16 tooltip_text_; + base::string16 tooltip_text_; // Accessibility data. - string16 accessible_name_; + base::string16 accessible_name_; // The id tag associated with this button. Used to disambiguate buttons in // the ButtonListener implementation. diff --git a/ui/views/controls/button/checkbox.cc b/ui/views/controls/button/checkbox.cc index ec33a47..07edf97 100644 --- a/ui/views/controls/button/checkbox.cc +++ b/ui/views/controls/button/checkbox.cc @@ -15,7 +15,7 @@ namespace views { // static const char Checkbox::kViewClassName[] = "Checkbox"; -Checkbox::Checkbox(const string16& label) +Checkbox::Checkbox(const base::string16& label) : LabelButton(NULL, label), checked_(false) { SetHorizontalAlignment(gfx::ALIGN_LEFT); diff --git a/ui/views/controls/button/checkbox.h b/ui/views/controls/button/checkbox.h index a603bd5..1dec75f 100644 --- a/ui/views/controls/button/checkbox.h +++ b/ui/views/controls/button/checkbox.h @@ -19,7 +19,7 @@ class VIEWS_EXPORT Checkbox : public LabelButton { public: static const char kViewClassName[]; - explicit Checkbox(const string16& label); + explicit Checkbox(const base::string16& label); virtual ~Checkbox(); // Sets a listener for this checkbox. Checkboxes aren't required to have them diff --git a/ui/views/controls/button/custom_button_unittest.cc b/ui/views/controls/button/custom_button_unittest.cc index cb27628..49bc832 100644 --- a/ui/views/controls/button/custom_button_unittest.cc +++ b/ui/views/controls/button/custom_button_unittest.cc @@ -155,7 +155,7 @@ TEST_F(CustomButtonTest, GestureEventsSetState) { // Make sure all subclasses of CustomButton are correctly recognized // as CustomButton. TEST_F(CustomButtonTest, AsCustomButton) { - string16 text; + base::string16 text; TextButton text_button(NULL, text); EXPECT_TRUE(CustomButton::AsCustomButton(&text_button)); diff --git a/ui/views/controls/button/image_button.cc b/ui/views/controls/button/image_button.cc index 6a84234..fc804e7 100644 --- a/ui/views/controls/button/image_button.cc +++ b/ui/views/controls/button/image_button.cc @@ -220,7 +220,7 @@ void ToggleImageButton::SetToggledImage(ButtonState state, } } -void ToggleImageButton::SetToggledTooltipText(const string16& tooltip) { +void ToggleImageButton::SetToggledTooltipText(const base::string16& tooltip) { toggled_tooltip_text_ = tooltip; } @@ -249,7 +249,7 @@ void ToggleImageButton::SetImage(ButtonState state, // ToggleImageButton, View overrides: bool ToggleImageButton::GetTooltipText(const gfx::Point& p, - string16* tooltip) const { + base::string16* tooltip) const { if (!toggled_ || toggled_tooltip_text_.empty()) return Button::GetTooltipText(p, tooltip); diff --git a/ui/views/controls/button/image_button.h b/ui/views/controls/button/image_button.h index 4977b06..46ab52ed 100644 --- a/ui/views/controls/button/image_button.h +++ b/ui/views/controls/button/image_button.h @@ -145,7 +145,7 @@ class VIEWS_EXPORT ToggleImageButton : public ImageButton { void SetToggledImage(ButtonState state, const gfx::ImageSkia* image); // Set the tooltip text displayed when the button is toggled. - void SetToggledTooltipText(const string16& tooltip); + void SetToggledTooltipText(const base::string16& tooltip); // Overridden from ImageButton: virtual const gfx::ImageSkia& GetImage(ButtonState state) const OVERRIDE; @@ -154,7 +154,7 @@ class VIEWS_EXPORT ToggleImageButton : public ImageButton { // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, - string16* tooltip) const OVERRIDE; + base::string16* tooltip) const OVERRIDE; virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; private: @@ -168,7 +168,7 @@ class VIEWS_EXPORT ToggleImageButton : public ImageButton { // The parent class's tooltip_text_ is displayed when not toggled, and // this one is shown when toggled. - string16 toggled_tooltip_text_; + base::string16 toggled_tooltip_text_; DISALLOW_COPY_AND_ASSIGN(ToggleImageButton); }; diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc index 30db5d1..fe245a0 100644 --- a/ui/views/controls/button/label_button.cc +++ b/ui/views/controls/button/label_button.cc @@ -37,7 +37,7 @@ const int LabelButton::kHoverAnimationDurationMs = 170; // static const char LabelButton::kViewClassName[] = "LabelButton"; -LabelButton::LabelButton(ButtonListener* listener, const string16& text) +LabelButton::LabelButton(ButtonListener* listener, const base::string16& text) : CustomButton(listener), image_(new ImageView()), label_(new Label()), @@ -75,11 +75,11 @@ void LabelButton::SetImage(ButtonState for_state, const gfx::ImageSkia& image) { UpdateImage(); } -const string16& LabelButton::GetText() const { +const base::string16& LabelButton::GetText() const { return label_->text(); } -void LabelButton::SetText(const string16& text) { +void LabelButton::SetText(const base::string16& text) { SetAccessibleName(text); label_->SetText(text); } diff --git a/ui/views/controls/button/label_button.h b/ui/views/controls/button/label_button.h index ad7e226..b9dbc8d 100644 --- a/ui/views/controls/button/label_button.h +++ b/ui/views/controls/button/label_button.h @@ -28,7 +28,7 @@ class VIEWS_EXPORT LabelButton : public CustomButton, static const char kViewClassName[]; - LabelButton(ButtonListener* listener, const string16& text); + LabelButton(ButtonListener* listener, const base::string16& text); virtual ~LabelButton(); // Get or set the image shown for the specified button state. @@ -37,8 +37,8 @@ class VIEWS_EXPORT LabelButton : public CustomButton, void SetImage(ButtonState for_state, const gfx::ImageSkia& image); // Get or set the text shown on the button. - const string16& GetText() const; - void SetText(const string16& text); + const base::string16& GetText() const; + void SetText(const base::string16& text); // Set the text color shown for the specified button state. void SetTextColor(ButtonState for_state, SkColor color); diff --git a/ui/views/controls/button/label_button_unittest.cc b/ui/views/controls/button/label_button_unittest.cc index fe2d1f6..0018b65 100644 --- a/ui/views/controls/button/label_button_unittest.cc +++ b/ui/views/controls/button/label_button_unittest.cc @@ -26,7 +26,7 @@ namespace views { typedef ViewsTestBase LabelButtonTest; TEST_F(LabelButtonTest, Init) { - const string16 text(ASCIIToUTF16("abc")); + const base::string16 text(ASCIIToUTF16("abc")); LabelButton button(NULL, text); EXPECT_TRUE(button.GetImage(Button::STATE_NORMAL).isNull()); @@ -45,12 +45,12 @@ TEST_F(LabelButtonTest, Init) { } TEST_F(LabelButtonTest, Label) { - LabelButton button(NULL, string16()); + LabelButton button(NULL, base::string16()); EXPECT_TRUE(button.GetText().empty()); const gfx::Font font; - const string16 short_text(ASCIIToUTF16("abcdefghijklm")); - const string16 long_text(ASCIIToUTF16("abcdefghijklmnopqrstuvwxyz")); + const base::string16 short_text(ASCIIToUTF16("abcdefghijklm")); + const base::string16 long_text(ASCIIToUTF16("abcdefghijklmnopqrstuvwxyz")); const int short_text_width = gfx::Canvas::GetStringWidth(short_text, font); const int long_text_width = gfx::Canvas::GetStringWidth(long_text, font); @@ -76,7 +76,7 @@ TEST_F(LabelButtonTest, Label) { } TEST_F(LabelButtonTest, Image) { - LabelButton button(NULL, string16()); + LabelButton button(NULL, base::string16()); const int small_size = 50, large_size = 100; const gfx::ImageSkia small_image = CreateTestImage(small_size, small_size); @@ -108,10 +108,10 @@ TEST_F(LabelButtonTest, Image) { } TEST_F(LabelButtonTest, LabelAndImage) { - LabelButton button(NULL, string16()); + LabelButton button(NULL, base::string16()); const gfx::Font font; - const string16 text(ASCIIToUTF16("abcdefghijklm")); + const base::string16 text(ASCIIToUTF16("abcdefghijklm")); const int text_width = gfx::Canvas::GetStringWidth(text, font); const int image_size = 50; @@ -146,7 +146,7 @@ TEST_F(LabelButtonTest, LabelAndImage) { EXPECT_EQ(gfx::ALIGN_RIGHT, button.GetHorizontalAlignment()); EXPECT_LT(button.label_->bounds().right(), button.image_->bounds().x()); - button.SetText(string16()); + button.SetText(base::string16()); EXPECT_GT(button.GetPreferredSize().width(), text_width + image_size); EXPECT_GT(button.GetPreferredSize().height(), image_size); button.SetImage(Button::STATE_NORMAL, gfx::ImageSkia()); @@ -165,7 +165,7 @@ TEST_F(LabelButtonTest, LabelAndImage) { } TEST_F(LabelButtonTest, Font) { - const string16 text(ASCIIToUTF16("abc")); + const base::string16 text(ASCIIToUTF16("abc")); LabelButton button(NULL, text); const gfx::Font original_font = button.GetFont(); diff --git a/ui/views/controls/button/menu_button.cc b/ui/views/controls/button/menu_button.cc index 728c037..66ce0cc 100644 --- a/ui/views/controls/button/menu_button.cc +++ b/ui/views/controls/button/menu_button.cc @@ -43,7 +43,7 @@ const int MenuButton::kMenuMarkerPaddingRight = -1; //////////////////////////////////////////////////////////////////////////////// MenuButton::MenuButton(ButtonListener* listener, - const string16& text, + const base::string16& text, MenuButtonListener* menu_button_listener, bool show_menu_marker) : TextButton(listener, text), diff --git a/ui/views/controls/button/menu_button.h b/ui/views/controls/button/menu_button.h index 2262dab..024c816 100644 --- a/ui/views/controls/button/menu_button.h +++ b/ui/views/controls/button/menu_button.h @@ -34,7 +34,7 @@ class VIEWS_EXPORT MenuButton : public TextButton { // Create a Button. MenuButton(ButtonListener* listener, - const string16& text, + const base::string16& text, MenuButtonListener* menu_button_listener, bool show_menu_marker); virtual ~MenuButton(); diff --git a/ui/views/controls/button/radio_button.cc b/ui/views/controls/button/radio_button.cc index 0b85469..9aa2910 100644 --- a/ui/views/controls/button/radio_button.cc +++ b/ui/views/controls/button/radio_button.cc @@ -15,7 +15,7 @@ namespace views { // static const char RadioButton::kViewClassName[] = "RadioButton"; -RadioButton::RadioButton(const string16& label, int group_id) +RadioButton::RadioButton(const base::string16& label, int group_id) : Checkbox(label) { SetGroup(group_id); diff --git a/ui/views/controls/button/radio_button.h b/ui/views/controls/button/radio_button.h index a7afff4..7d8c5b5 100644 --- a/ui/views/controls/button/radio_button.h +++ b/ui/views/controls/button/radio_button.h @@ -17,7 +17,7 @@ class VIEWS_EXPORT RadioButton : public Checkbox { // The button's class name. static const char kViewClassName[]; - RadioButton(const string16& label, int group_id); + RadioButton(const base::string16& label, int group_id); virtual ~RadioButton(); // Overridden from View: diff --git a/ui/views/controls/button/text_button.cc b/ui/views/controls/button/text_button.cc index e829405..67e0898 100644 --- a/ui/views/controls/button/text_button.cc +++ b/ui/views/controls/button/text_button.cc @@ -199,7 +199,8 @@ void TextButtonNativeThemeBorder::Paint(const View& view, gfx::Canvas* canvas) { // TextButtonBase ------------------------------------------------------------- -TextButtonBase::TextButtonBase(ButtonListener* listener, const string16& text) +TextButtonBase::TextButtonBase(ButtonListener* listener, + const base::string16& text) : CustomButton(listener), alignment_(ALIGN_LEFT), font_(ResourceBundle::GetSharedInstance().GetFont( @@ -239,7 +240,7 @@ void TextButtonBase::SetIsDefault(bool is_default) { SchedulePaint(); } -void TextButtonBase::SetText(const string16& text) { +void TextButtonBase::SetText(const base::string16& text) { if (text == text_) return; text_ = text; @@ -609,7 +610,7 @@ ui::NativeTheme::State TextButtonBase::GetForegroundThemeState( // TextButton ----------------------------------------------------------------- -TextButton::TextButton(ButtonListener* listener, const string16& text) +TextButton::TextButton(ButtonListener* listener, const base::string16& text) : TextButtonBase(listener, text), icon_placement_(ICON_ON_LEFT), has_hover_icon_(false), diff --git a/ui/views/controls/button/text_button.h b/ui/views/controls/button/text_button.h index 4dc6157..4cf6177 100644 --- a/ui/views/controls/button/text_button.h +++ b/ui/views/controls/button/text_button.h @@ -112,8 +112,8 @@ class VIEWS_EXPORT TextButtonBase : public CustomButton, // Call SetText once per string in your set of possible values at button // creation time, so that it can contain the largest of them and avoid // resizing the button when the text changes. - virtual void SetText(const string16& text); - const string16& text() const { return text_; } + virtual void SetText(const base::string16& text); + const base::string16& text() const { return text_; } enum TextAlignment { ALIGN_LEFT, @@ -185,7 +185,7 @@ class VIEWS_EXPORT TextButtonBase : public CustomButton, virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; protected: - TextButtonBase(ButtonListener* listener, const string16& text); + TextButtonBase(ButtonListener* listener, const base::string16& text); // Called when enabled or disabled state changes, or the colors for those // states change. @@ -239,7 +239,7 @@ class VIEWS_EXPORT TextButtonBase : public CustomButton, gfx::Rect GetContentBounds(int extra_width) const; // The text string that is displayed in the button. - string16 text_; + base::string16 text_; // The size of the text string. gfx::Size text_size_; @@ -310,7 +310,7 @@ class VIEWS_EXPORT TextButton : public TextButtonBase { // The button's class name. static const char kViewClassName[]; - TextButton(ButtonListener* listener, const string16& text); + TextButton(ButtonListener* listener, const base::string16& text); virtual ~TextButton(); void set_icon_text_spacing(int icon_text_spacing) { diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc index ce8d93a..6997ab8 100644 --- a/ui/views/controls/combobox/combobox.cc +++ b/ui/views/controls/combobox/combobox.cc @@ -321,7 +321,7 @@ bool Combobox::SelectValue(const base::string16& value) { return false; } -void Combobox::SetAccessibleName(const string16& name) { +void Combobox::SetAccessibleName(const base::string16& name) { accessible_name_ = name; } @@ -396,8 +396,9 @@ void Combobox::SetSelectedRow(int row) { SetSelectedIndex(row); } -string16 Combobox::GetTextForRow(int row) { - return model()->IsItemSeparatorAt(row) ? string16() : model()->GetItemAt(row); +base::string16 Combobox::GetTextForRow(int row) { + return model()->IsItemSeparatorAt(row) ? base::string16() : + model()->GetItemAt(row); } //////////////////////////////////////////////////////////////////////////////// @@ -593,7 +594,7 @@ void Combobox::UpdateFromModel() { continue; } - string16 text = model()->GetItemAt(i); + base::string16 text = model()->GetItemAt(i); // Inserting the Unicode formatting characters if necessary so that the // text is displayed correctly in right-to-left UIs. @@ -636,7 +637,7 @@ void Combobox::PaintText(gfx::Canvas* canvas) { DCHECK_LT(selected_index_, model()->GetItemCount()); if (selected_index_ < 0 || selected_index_ > model()->GetItemCount()) selected_index_ = 0; - string16 text = model()->GetItemAt(selected_index_); + base::string16 text = model()->GetItemAt(selected_index_); int disclosure_arrow_offset = width() - disclosure_arrow_->width() - GetDisclosureArrowLeftPadding() - GetDisclosureArrowRightPadding(); diff --git a/ui/views/controls/combobox/combobox.h b/ui/views/controls/combobox/combobox.h index 8ec45c9..6371e9d 100644 --- a/ui/views/controls/combobox/combobox.h +++ b/ui/views/controls/combobox/combobox.h @@ -79,7 +79,7 @@ class VIEWS_EXPORT Combobox : public MenuDelegate, ui::ComboboxModel* model() const { return model_; } // Set the accessible name of the combobox. - void SetAccessibleName(const string16& name); + void SetAccessibleName(const base::string16& name); // Visually marks the combobox as having an invalid value selected. // When invalid, it paints with white text on a red background. @@ -110,7 +110,7 @@ class VIEWS_EXPORT Combobox : public MenuDelegate, virtual int GetRowCount() OVERRIDE; virtual int GetSelectedRow() OVERRIDE; virtual void SetSelectedRow(int row) OVERRIDE; - virtual string16 GetTextForRow(int row) OVERRIDE; + virtual base::string16 GetTextForRow(int row) OVERRIDE; // Overriden from ComboboxModelObserver: virtual void OnModelChanged() OVERRIDE; @@ -168,7 +168,7 @@ class VIEWS_EXPORT Combobox : public MenuDelegate, bool invalid_; // The accessible name of this combobox. - string16 accessible_name_; + base::string16 accessible_name_; // A helper used to select entries by keyboard input. scoped_ptr<PrefixSelector> selector_; diff --git a/ui/views/controls/combobox/combobox_unittest.cc b/ui/views/controls/combobox/combobox_unittest.cc index 573fcb3..ec4cf85 100644 --- a/ui/views/controls/combobox/combobox_unittest.cc +++ b/ui/views/controls/combobox/combobox_unittest.cc @@ -94,7 +94,7 @@ class TestComboboxModel : public ui::ComboboxModel { virtual int GetItemCount() const OVERRIDE { return 10; } - virtual string16 GetItemAt(int index) OVERRIDE { + virtual base::string16 GetItemAt(int index) OVERRIDE { if (IsItemSeparatorAt(index)) { NOTREACHED(); return ASCIIToUTF16("SEPARATOR"); diff --git a/ui/views/controls/image_view.cc b/ui/views/controls/image_view.cc index 2bbf91c..fcd5347 100644 --- a/ui/views/controls/image_view.cc +++ b/ui/views/controls/image_view.cc @@ -177,15 +177,16 @@ ImageView::Alignment ImageView::GetVerticalAlignment() const { return vert_alignment_; } -void ImageView::SetTooltipText(const string16& tooltip) { +void ImageView::SetTooltipText(const base::string16& tooltip) { tooltip_text_ = tooltip; } -string16 ImageView::GetTooltipText() const { +base::string16 ImageView::GetTooltipText() const { return tooltip_text_; } -bool ImageView::GetTooltipText(const gfx::Point& p, string16* tooltip) const { +bool ImageView::GetTooltipText(const gfx::Point& p, + base::string16* tooltip) const { if (tooltip_text_.empty()) return false; diff --git a/ui/views/controls/image_view.h b/ui/views/controls/image_view.h index b0f4ce8..620ad86 100644 --- a/ui/views/controls/image_view.h +++ b/ui/views/controls/image_view.h @@ -72,8 +72,8 @@ class VIEWS_EXPORT ImageView : public View { Alignment GetVerticalAlignment() const; // Set / Get the tooltip text. - void SetTooltipText(const string16& tooltip); - string16 GetTooltipText() const; + void SetTooltipText(const base::string16& tooltip); + base::string16 GetTooltipText() const; void set_interactive(bool interactive) { interactive_ = interactive; } @@ -86,7 +86,7 @@ class VIEWS_EXPORT ImageView : public View { virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; virtual bool GetTooltipText(const gfx::Point& p, - string16* tooltip) const OVERRIDE; + base::string16* tooltip) const OVERRIDE; virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; private: @@ -117,7 +117,7 @@ class VIEWS_EXPORT ImageView : public View { Alignment vert_alignment_; // The current tooltip text. - string16 tooltip_text_; + base::string16 tooltip_text_; // A flag controlling hit test handling for interactivity. bool interactive_; diff --git a/ui/views/controls/label.cc b/ui/views/controls/label.cc index 7d4bc7e..256c2ea 100644 --- a/ui/views/controls/label.cc +++ b/ui/views/controls/label.cc @@ -44,18 +44,18 @@ namespace views { const char Label::kViewClassName[] = "Label"; Label::Label() { - Init(string16(), GetDefaultFontList()); + Init(base::string16(), GetDefaultFontList()); } -Label::Label(const string16& text) { +Label::Label(const base::string16& text) { Init(text, GetDefaultFontList()); } -Label::Label(const string16& text, const gfx::FontList& font_list) { +Label::Label(const base::string16& text, const gfx::FontList& font_list) { Init(text, font_list); } -Label::Label(const string16& text, const gfx::Font& font) { +Label::Label(const base::string16& text, const gfx::Font& font) { Init(text, gfx::FontList(font)); } @@ -77,7 +77,7 @@ void Label::SetFont(const gfx::Font& font) { SetFontList(gfx::FontList(font)); } -void Label::SetText(const string16& text) { +void Label::SetText(const base::string16& text) { if (text == text_) return; text_ = text; @@ -176,18 +176,18 @@ void Label::SetElideBehavior(ElideBehavior elide_behavior) { } } -void Label::SetTooltipText(const string16& tooltip_text) { +void Label::SetTooltipText(const base::string16& tooltip_text) { tooltip_text_ = tooltip_text; } void Label::SizeToFit(int max_width) { DCHECK(is_multi_line_); - std::vector<string16> lines; + std::vector<base::string16> lines; base::SplitString(text_, '\n', &lines); int label_width = 0; - for (std::vector<string16>::const_iterator iter = lines.begin(); + for (std::vector<base::string16>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter) { label_width = std::max(label_width, gfx::GetStringWidth(*iter, font_list_)); } @@ -282,7 +282,7 @@ bool Label::HitTestRect(const gfx::Rect& rect) const { return false; } -bool Label::GetTooltipText(const gfx::Point& p, string16* tooltip) const { +bool Label::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const { DCHECK(tooltip); // If a tooltip has been explicitly set, use it. @@ -307,7 +307,7 @@ void Label::GetAccessibleState(ui::AccessibleViewState* state) { } void Label::PaintText(gfx::Canvas* canvas, - const string16& text, + const base::string16& text, const gfx::Rect& text_bounds, int flags) { gfx::ShadowValues shadows; @@ -358,7 +358,7 @@ void Label::OnPaint(gfx::Canvas* canvas) { // interfere with that. OnPaintBorder(canvas); - string16 paint_text; + base::string16 paint_text; gfx::Rect text_bounds; int flags = 0; CalculateDrawStringParams(&paint_text, &text_bounds, &flags); @@ -369,7 +369,7 @@ void Label::OnNativeThemeChanged(const ui::NativeTheme* theme) { UpdateColorsFromTheme(theme); } -void Label::Init(const string16& text, const gfx::FontList& font_list) { +void Label::Init(const base::string16& text, const gfx::FontList& font_list) { font_list_ = font_list; enabled_color_set_ = disabled_color_set_ = background_color_set_ = false; auto_color_readability_ = true; @@ -485,7 +485,7 @@ gfx::Rect Label::GetAvailableRect() const { return bounds; } -void Label::CalculateDrawStringParams(string16* paint_text, +void Label::CalculateDrawStringParams(base::string16* paint_text, gfx::Rect* text_bounds, int* flags) const { DCHECK(paint_text && text_bounds && flags); diff --git a/ui/views/controls/label.h b/ui/views/controls/label.h index 40534ff..bc21c0ad 100644 --- a/ui/views/controls/label.h +++ b/ui/views/controls/label.h @@ -53,9 +53,9 @@ class VIEWS_EXPORT Label : public View { }; Label(); - explicit Label(const string16& text); - Label(const string16& text, const gfx::FontList& font_list); - Label(const string16& text, const gfx::Font& font); // OBSOLETE + explicit Label(const base::string16& text); + Label(const base::string16& text, const gfx::FontList& font_list); + Label(const base::string16& text, const gfx::Font& font); // OBSOLETE virtual ~Label(); // Gets or sets the fonts used by this label. @@ -66,8 +66,8 @@ class VIEWS_EXPORT Label : public View { virtual void SetFont(const gfx::Font& font); // OBSOLETE // Get or set the label text. - const string16& text() const { return text_; } - void SetText(const string16& text); + const base::string16& text() const { return text_; } + void SetText(const base::string16& text); // Enables or disables auto-color-readability (enabled by default). If this // is enabled, then calls to set any foreground or background color will @@ -144,7 +144,7 @@ class VIEWS_EXPORT Label : public View { // show the full text if it is wider than its bounds. Calling this overrides // the default behavior and lets you set a custom tooltip. To revert to // default behavior, call this with an empty string. - void SetTooltipText(const string16& tooltip_text); + void SetTooltipText(const base::string16& tooltip_text); // Resizes the label so its width is set to the width of the longest line and // its height deduced accordingly. @@ -180,13 +180,13 @@ class VIEWS_EXPORT Label : public View { // tooltip). If a custom tooltip has been specified with SetTooltipText() // it is returned instead. virtual bool GetTooltipText(const gfx::Point& p, - string16* tooltip) const OVERRIDE; + base::string16* tooltip) const OVERRIDE; protected: // Called by Paint to paint the text. Override this to change how // text is painted. virtual void PaintText(gfx::Canvas* canvas, - const string16& text, + const base::string16& text, const gfx::Rect& text_bounds, int flags); @@ -212,7 +212,7 @@ class VIEWS_EXPORT Label : public View { // Calls ComputeDrawStringFlags(). FRIEND_TEST_ALL_PREFIXES(LabelTest, DisableSubpixelRendering); - void Init(const string16& text, const gfx::FontList& font_list); + void Init(const base::string16& text, const gfx::FontList& font_list); void RecalculateColors(); @@ -224,7 +224,7 @@ class VIEWS_EXPORT Label : public View { gfx::Rect GetAvailableRect() const; // Returns parameters to be used for the DrawString call. - void CalculateDrawStringParams(string16* paint_text, + void CalculateDrawStringParams(base::string16* paint_text, gfx::Rect* text_bounds, int* flags) const; @@ -237,7 +237,7 @@ class VIEWS_EXPORT Label : public View { bool ShouldShowDefaultTooltip() const; - string16 text_; + base::string16 text_; gfx::FontList font_list_; SkColor requested_enabled_color_; SkColor actual_enabled_color_; @@ -258,7 +258,7 @@ class VIEWS_EXPORT Label : public View { bool allow_character_break_; ElideBehavior elide_behavior_; gfx::HorizontalAlignment horizontal_alignment_; - string16 tooltip_text_; + base::string16 tooltip_text_; // Whether to collapse the label when it's not visible. bool collapse_when_hidden_; // The following member variable is used to control whether the diff --git a/ui/views/controls/label_unittest.cc b/ui/views/controls/label_unittest.cc index e2a37c3..79aa52a 100644 --- a/ui/views/controls/label_unittest.cc +++ b/ui/views/controls/label_unittest.cc @@ -39,7 +39,7 @@ TEST(LabelTest, FontPropertyArial) { TEST(LabelTest, TextProperty) { Label label; - string16 test_text(ASCIIToUTF16("A random string.")); + base::string16 test_text(ASCIIToUTF16("A random string.")); label.SetText(test_text); EXPECT_EQ(test_text, label.text()); } @@ -98,19 +98,19 @@ TEST(LabelTest, MultiLineProperty) { TEST(LabelTest, TooltipProperty) { Label label; - string16 test_text(ASCIIToUTF16("My cool string.")); + base::string16 test_text(ASCIIToUTF16("My cool string.")); label.SetText(test_text); - string16 tooltip; + base::string16 tooltip; EXPECT_TRUE(label.GetTooltipText(gfx::Point(), &tooltip)); EXPECT_EQ(test_text, tooltip); - string16 tooltip_text(ASCIIToUTF16("The tooltip!")); + base::string16 tooltip_text(ASCIIToUTF16("The tooltip!")); label.SetTooltipText(tooltip_text); EXPECT_TRUE(label.GetTooltipText(gfx::Point(), &tooltip)); EXPECT_EQ(tooltip_text, tooltip); - string16 empty_text; + base::string16 empty_text; label.SetTooltipText(empty_text); EXPECT_TRUE(label.GetTooltipText(gfx::Point(), &tooltip)); EXPECT_EQ(test_text, tooltip); @@ -145,7 +145,7 @@ TEST(LabelTest, TooltipProperty) { TEST(LabelTest, Accessibility) { Label label; - string16 test_text(ASCIIToUTF16("My special text.")); + base::string16 test_text(ASCIIToUTF16("My special text.")); label.SetText(test_text); ui::AccessibleViewState state; @@ -157,7 +157,7 @@ TEST(LabelTest, Accessibility) { TEST(LabelTest, SingleLineSizing) { Label label; - string16 test_text(ASCIIToUTF16("A not so random string in one line.")); + base::string16 test_text(ASCIIToUTF16("A not so random string in one line.")); label.SetText(test_text); // GetPreferredSize @@ -183,7 +183,7 @@ TEST(LabelTest, SingleLineSizing) { TEST(LabelTest, MultilineSmallAvailableWidthSizing) { Label label; - string16 test_text(ASCIIToUTF16("Too Wide.")); + base::string16 test_text(ASCIIToUTF16("Too Wide.")); label.SetMultiLine(true); label.SetAllowCharacterBreak(true); @@ -202,7 +202,7 @@ TEST(LabelTest, MultilineSmallAvailableWidthSizing) { TEST(LabelTest, MultiLineSizing) { Label label; label.SetFocusable(false); - string16 test_text( + base::string16 test_text( ASCIIToUTF16("A random string\nwith multiple lines\nand returns!")); label.SetText(test_text); label.SetMultiLine(true); @@ -288,7 +288,7 @@ TEST(LabelTest, AutoDetectDirectionality) { label.set_directionality_mode(Label::AUTO_DETECT_DIRECTIONALITY); // Test text starts with RTL character. - string16 test_text(WideToUTF16(L" \x5d0\x5d1\x5d2 abc")); + base::string16 test_text(WideToUTF16(L" \x5d0\x5d1\x5d2 abc")); label.SetText(test_text); gfx::Size required_size(label.GetPreferredSize()); gfx::Size extra(22, 8); @@ -297,7 +297,7 @@ TEST(LabelTest, AutoDetectDirectionality) { required_size.width() + extra.width(), required_size.height() + extra.height()); - string16 paint_text; + base::string16 paint_text; gfx::Rect text_bounds; int flags; label.CalculateDrawStringParams(&paint_text, &text_bounds, &flags); @@ -328,7 +328,7 @@ TEST(LabelTest, DrawSingleLineString) { // align right really means align left. label.set_directionality_mode(Label::AUTO_DETECT_DIRECTIONALITY); - string16 test_text(ASCIIToUTF16("Here's a string with no returns.")); + base::string16 test_text(ASCIIToUTF16("Here's a string with no returns.")); label.SetText(test_text); gfx::Size required_size(label.GetPreferredSize()); gfx::Size extra(22, 8); @@ -338,7 +338,7 @@ TEST(LabelTest, DrawSingleLineString) { required_size.height() + extra.height()); // Do some basic verifications for all three alignments. - string16 paint_text; + base::string16 paint_text; gfx::Rect text_bounds; int flags; @@ -464,7 +464,7 @@ TEST(LabelTest, DrawMultiLineString) { // align right really means align left. label.set_directionality_mode(Label::AUTO_DETECT_DIRECTIONALITY); - string16 test_text(ASCIIToUTF16("Another string\nwith returns\n\n!")); + base::string16 test_text(ASCIIToUTF16("Another string\nwith returns\n\n!")); label.SetText(test_text); label.SetMultiLine(true); label.SizeToFit(0); @@ -475,7 +475,7 @@ TEST(LabelTest, DrawMultiLineString) { label.height() + extra.height()); // Do some basic verifications for all three alignments. - string16 paint_text; + base::string16 paint_text; gfx::Rect text_bounds; int flags; label.CalculateDrawStringParams(&paint_text, &text_bounds, &flags); @@ -604,7 +604,7 @@ TEST(LabelTest, DrawSingleLineStringInRTL) { std::string locale = l10n_util::GetApplicationLocale(""); base::i18n::SetICUDefaultLocale("he"); - string16 test_text(ASCIIToUTF16("Here's a string with no returns.")); + base::string16 test_text(ASCIIToUTF16("Here's a string with no returns.")); label.SetText(test_text); gfx::Size required_size(label.GetPreferredSize()); gfx::Size extra(22, 8); @@ -614,7 +614,7 @@ TEST(LabelTest, DrawSingleLineStringInRTL) { required_size.height() + extra.height()); // Do some basic verifications for all three alignments. - string16 paint_text; + base::string16 paint_text; gfx::Rect text_bounds; int flags; @@ -744,7 +744,7 @@ TEST(LabelTest, DrawMultiLineStringInRTL) { std::string locale = l10n_util::GetApplicationLocale(""); base::i18n::SetICUDefaultLocale("he"); - string16 test_text(ASCIIToUTF16("Another string\nwith returns\n\n!")); + base::string16 test_text(ASCIIToUTF16("Another string\nwith returns\n\n!")); label.SetText(test_text); label.SetMultiLine(true); label.SizeToFit(0); @@ -755,7 +755,7 @@ TEST(LabelTest, DrawMultiLineStringInRTL) { label.height() + extra.height()); // Do some basic verifications for all three alignments. - string16 paint_text; + base::string16 paint_text; gfx::Rect text_bounds; int flags; label.CalculateDrawStringParams(&paint_text, &text_bounds, &flags); diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc index d02a0b8..68d75ba8 100644 --- a/ui/views/controls/link.cc +++ b/ui/views/controls/link.cc @@ -24,11 +24,11 @@ namespace views { const char Link::kViewClassName[] = "Link"; -Link::Link() : Label(string16()) { +Link::Link() : Label(base::string16()) { Init(); } -Link::Link(const string16& title) : Label(title) { +Link::Link(const base::string16& title) : Label(title) { Init(); } diff --git a/ui/views/controls/link.h b/ui/views/controls/link.h index f6a876d..67ff884 100644 --- a/ui/views/controls/link.h +++ b/ui/views/controls/link.h @@ -25,7 +25,7 @@ class LinkListener; class VIEWS_EXPORT Link : public Label { public: Link(); - explicit Link(const string16& title); + explicit Link(const base::string16& title); virtual ~Link(); static SkColor GetDefaultEnabledColor(); diff --git a/ui/views/controls/menu/menu.cc b/ui/views/controls/menu/menu.cc index 597dba4..0cffae8 100644 --- a/ui/views/controls/menu/menu.cc +++ b/ui/views/controls/menu/menu.cc @@ -17,8 +17,8 @@ bool Menu::Delegate::IsItemDefault(int id) const { return false; } -string16 Menu::Delegate::GetLabel(int id) const { - return string16(); +base::string16 Menu::Delegate::GetLabel(int id) const { + return base::string16(); } bool Menu::Delegate::GetAcceleratorInfo(int id, ui::Accelerator* accel) { @@ -49,7 +49,7 @@ bool Menu::Delegate::IsCommandEnabled(int id) const { return true; } -bool Menu::Delegate::GetContextualLabel(int id, string16* out) const { +bool Menu::Delegate::GetContextualLabel(int id, base::string16* out) const { return false; } @@ -76,14 +76,14 @@ Menu::~Menu() { } void Menu::AppendMenuItem(int item_id, - const string16& label, + const base::string16& label, MenuItemType type) { AddMenuItem(-1, item_id, label, type); } void Menu::AddMenuItem(int index, int item_id, - const string16& label, + const base::string16& label, MenuItemType type) { if (type == SEPARATOR) AddSeparator(index); @@ -91,27 +91,27 @@ void Menu::AddMenuItem(int index, AddMenuItemInternal(index, item_id, label, gfx::ImageSkia(), type); } -Menu* Menu::AppendSubMenu(int item_id, const string16& label) { +Menu* Menu::AppendSubMenu(int item_id, const base::string16& label) { return AddSubMenu(-1, item_id, label); } -Menu* Menu::AddSubMenu(int index, int item_id, const string16& label) { +Menu* Menu::AddSubMenu(int index, int item_id, const base::string16& label) { return AddSubMenuWithIcon(index, item_id, label, gfx::ImageSkia()); } Menu* Menu::AppendSubMenuWithIcon(int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon) { return AddSubMenuWithIcon(-1, item_id, label, icon); } -void Menu::AppendMenuItemWithLabel(int item_id, const string16& label) { +void Menu::AppendMenuItemWithLabel(int item_id, const base::string16& label) { AddMenuItemWithLabel(-1, item_id, label); } void Menu::AddMenuItemWithLabel(int index, int item_id, - const string16& label) { + const base::string16& label) { AddMenuItem(index, item_id, label, Menu::NORMAL); } @@ -120,7 +120,7 @@ void Menu::AppendDelegateMenuItem(int item_id) { } void Menu::AddDelegateMenuItem(int index, int item_id) { - AddMenuItem(index, item_id, string16(), Menu::NORMAL); + AddMenuItem(index, item_id, base::string16(), Menu::NORMAL); } void Menu::AppendSeparator() { @@ -128,14 +128,14 @@ void Menu::AppendSeparator() { } void Menu::AppendMenuItemWithIcon(int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon) { AddMenuItemWithIcon(-1, item_id, label, icon); } void Menu::AddMenuItemWithIcon(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon) { AddMenuItemInternal(index, item_id, label, icon, Menu::NORMAL); } diff --git a/ui/views/controls/menu/menu.h b/ui/views/controls/menu/menu.h index 5a774df..099a98ee 100644 --- a/ui/views/controls/menu/menu.h +++ b/ui/views/controls/menu/menu.h @@ -45,7 +45,7 @@ class VIEWS_EXPORT Menu { virtual bool IsItemDefault(int id) const; // The string shown for the menu item. - virtual string16 GetLabel(int id) const; + virtual base::string16 GetLabel(int id) const; // The delegate needs to implement this function if it wants to display // the shortcut text next to each menu item. If there is an accelerator @@ -94,7 +94,7 @@ class VIEWS_EXPORT Menu { // Controller virtual bool SupportsCommand(int id) const; virtual bool IsCommandEnabled(int id) const; - virtual bool GetContextualLabel(int id, string16* out) const; + virtual bool GetContextualLabel(int id, base::string16* out) const; virtual void ExecuteCommand(int id) { } @@ -151,35 +151,37 @@ class VIEWS_EXPORT Menu { // label The text label shown. // type The type of item. void AppendMenuItem(int item_id, - const string16& label, + const base::string16& label, MenuItemType type); void AddMenuItem(int index, int item_id, - const string16& label, + const base::string16& label, MenuItemType type); // Append a submenu to this menu. // The returned pointer is owned by this menu. Menu* AppendSubMenu(int item_id, - const string16& label); - Menu* AddSubMenu(int index, int item_id, const string16& label); + const base::string16& label); + Menu* AddSubMenu(int index, int item_id, const base::string16& label); // Append a submenu with an icon to this menu // The returned pointer is owned by this menu. // Unless the icon is empty, calling this function forces the Menu class // to draw the menu, instead of relying on Windows. Menu* AppendSubMenuWithIcon(int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon); virtual Menu* AddSubMenuWithIcon(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon) = 0; // This is a convenience for standard text label menu items where the label // is provided with this call. - void AppendMenuItemWithLabel(int item_id, const string16& label); - void AddMenuItemWithLabel(int index, int item_id, const string16& label); + void AppendMenuItemWithLabel(int item_id, const base::string16& label); + void AddMenuItemWithLabel(int index, + int item_id, + const base::string16& label); // This is a convenience for text label menu items where the label is // provided by the delegate. @@ -194,11 +196,11 @@ class VIEWS_EXPORT Menu { // needs an icon. Calling this function forces the Menu class to draw // the menu, instead of relying on Windows. void AppendMenuItemWithIcon(int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon); virtual void AddMenuItemWithIcon(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon); // Enables or disables the item with the specified id. @@ -206,7 +208,7 @@ class VIEWS_EXPORT Menu { virtual void EnableMenuItemAt(int index, bool enabled) = 0; // Sets menu label at specified index. - virtual void SetMenuLabel(int item_id, const string16& label) = 0; + virtual void SetMenuLabel(int item_id, const base::string16& label) = 0; // Sets an icon for an item with a given item_id. Calling this function // also forces the Menu class to draw the menu, instead of relying on Windows. @@ -234,7 +236,7 @@ class VIEWS_EXPORT Menu { virtual void AddMenuItemInternal(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon, MenuItemType type) = 0; diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index 4629052..12922a7 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -97,7 +97,7 @@ bool TitleMatchesMnemonic(MenuItemView* menu, char16 key) { if (menu->GetMnemonic()) return false; - string16 lower_title = base::i18n::ToLower(menu->title()); + base::string16 lower_title = base::i18n::ToLower(menu->title()); return !lower_title.empty() && lower_title[0] == key; } diff --git a/ui/views/controls/menu/menu_delegate.cc b/ui/views/controls/menu/menu_delegate.cc index 90ab5cb..5e75915 100644 --- a/ui/views/controls/menu/menu_delegate.cc +++ b/ui/views/controls/menu/menu_delegate.cc @@ -13,8 +13,8 @@ bool MenuDelegate::IsItemChecked(int id) const { return false; } -string16 MenuDelegate::GetLabel(int id) const { - return string16(); +base::string16 MenuDelegate::GetLabel(int id) const { + return base::string16(); } const gfx::Font* MenuDelegate::GetLabelFont(int id) const { @@ -33,9 +33,9 @@ bool MenuDelegate::GetForegroundColor(int command_id, return false; } -string16 MenuDelegate::GetTooltipText(int id, +base::string16 MenuDelegate::GetTooltipText(int id, const gfx::Point& screen_loc) const { - return string16(); + return base::string16(); } bool MenuDelegate::GetAccelerator(int id, ui::Accelerator* accelerator) { @@ -57,7 +57,7 @@ bool MenuDelegate::IsCommandEnabled(int id) const { return true; } -bool MenuDelegate::GetContextualLabel(int id, string16* out) const { +bool MenuDelegate::GetContextualLabel(int id, base::string16* out) const { return false; } diff --git a/ui/views/controls/menu/menu_delegate.h b/ui/views/controls/menu/menu_delegate.h index f171d57..97ce185 100644 --- a/ui/views/controls/menu/menu_delegate.h +++ b/ui/views/controls/menu/menu_delegate.h @@ -61,7 +61,7 @@ class VIEWS_EXPORT MenuDelegate { // The string shown for the menu item. This is only invoked when an item is // added with an empty label. - virtual string16 GetLabel(int id) const; + virtual base::string16 GetLabel(int id) const; // The font for the menu item label. virtual const gfx::Font* GetLabelFont(int id) const; @@ -82,7 +82,8 @@ class VIEWS_EXPORT MenuDelegate { // The tooltip shown for the menu item. This is invoked when the user // hovers over the item, and no tooltip text has been set for that item. - virtual string16 GetTooltipText(int id, const gfx::Point& screen_loc) const; + virtual base::string16 GetTooltipText(int id, + const gfx::Point& screen_loc) const; // If there is an accelerator for the menu item with id |id| it is set in // |accelerator| and true is returned. @@ -104,7 +105,7 @@ class VIEWS_EXPORT MenuDelegate { // Controller virtual bool SupportsCommand(int id) const; virtual bool IsCommandEnabled(int id) const; - virtual bool GetContextualLabel(int id, string16* out) const; + virtual bool GetContextualLabel(int id, base::string16* out) const; virtual void ExecuteCommand(int id) { } diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc index 2adc1ad..97a43cc 100644 --- a/ui/views/controls/menu/menu_item_view.cc +++ b/ui/views/controls/menu/menu_item_view.cc @@ -47,7 +47,7 @@ class EmptyMenuMenuItem : public MenuItemView { } virtual bool GetTooltipText(const gfx::Point& p, - string16* tooltip) const OVERRIDE { + base::string16* tooltip) const OVERRIDE { // Empty menu items shouldn't have a tooltip. return false; } @@ -116,7 +116,7 @@ void MenuItemView::ChildPreferredSizeChanged(View* child) { } bool MenuItemView::GetTooltipText(const gfx::Point& p, - string16* tooltip) const { + base::string16* tooltip) const { *tooltip = tooltip_; if (!tooltip->empty()) return true; @@ -150,7 +150,7 @@ bool MenuItemView::GetTooltipText(const gfx::Point& p, void MenuItemView::GetAccessibleState(ui::AccessibleViewState* state) { state->role = ui::AccessibilityTypes::ROLE_MENUITEM; - string16 item_text; + base::string16 item_text; if (IsContainer()) { // The first child is taking over, just use its accessible name instead of // |title_|. @@ -189,14 +189,14 @@ bool MenuItemView::IsBubble(MenuItemView::AnchorPosition anchor) { } // static -string16 MenuItemView::GetAccessibleNameForMenuItem( - const string16& item_text, const string16& minor_text) { - string16 accessible_name = item_text; +base::string16 MenuItemView::GetAccessibleNameForMenuItem( + const base::string16& item_text, const base::string16& minor_text) { + base::string16 accessible_name = item_text; // Filter out the "&" for accessibility clients. size_t index = 0; const char16 amp = '&'; - while ((index = accessible_name.find(amp, index)) != string16::npos && + while ((index = accessible_name.find(amp, index)) != base::string16::npos && index + 1 < accessible_name.length()) { accessible_name.replace(index, accessible_name.length() - index, accessible_name.substr(index + 1)); @@ -225,9 +225,9 @@ void MenuItemView::Cancel() { MenuItemView* MenuItemView::AddMenuItemAt( int index, int item_id, - const string16& label, - const string16& sublabel, - const string16& minor_text, + const base::string16& label, + const base::string16& sublabel, + const base::string16& minor_text, const gfx::ImageSkia& icon, Type type, ui::MenuSeparatorType separator_style) { @@ -271,51 +271,52 @@ void MenuItemView::RemoveMenuItemAt(int index) { } MenuItemView* MenuItemView::AppendMenuItem(int item_id, - const string16& label, + const base::string16& label, Type type) { - return AppendMenuItemImpl(item_id, label, string16(), string16(), + return AppendMenuItemImpl(item_id, label, base::string16(), base::string16(), gfx::ImageSkia(), type, ui::NORMAL_SEPARATOR); } MenuItemView* MenuItemView::AppendSubMenu(int item_id, - const string16& label) { - return AppendMenuItemImpl(item_id, label, string16(), string16(), + const base::string16& label) { + return AppendMenuItemImpl(item_id, label, base::string16(), base::string16(), gfx::ImageSkia(), SUBMENU, ui::NORMAL_SEPARATOR); } MenuItemView* MenuItemView::AppendSubMenuWithIcon(int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon) { - return AppendMenuItemImpl(item_id, label, string16(), string16(), icon, - SUBMENU, ui::NORMAL_SEPARATOR); + return AppendMenuItemImpl(item_id, label, base::string16(), base::string16(), + icon, SUBMENU, ui::NORMAL_SEPARATOR); } -MenuItemView* MenuItemView::AppendMenuItemWithLabel(int item_id, - const string16& label) { +MenuItemView* MenuItemView::AppendMenuItemWithLabel( + int item_id, + const base::string16& label) { return AppendMenuItem(item_id, label, NORMAL); } MenuItemView* MenuItemView::AppendDelegateMenuItem(int item_id) { - return AppendMenuItem(item_id, string16(), NORMAL); + return AppendMenuItem(item_id, base::string16(), NORMAL); } void MenuItemView::AppendSeparator() { - AppendMenuItemImpl(0, string16(), string16(), string16(), gfx::ImageSkia(), - SEPARATOR, ui::NORMAL_SEPARATOR); + AppendMenuItemImpl(0, base::string16(), base::string16(), base::string16(), + gfx::ImageSkia(), SEPARATOR, ui::NORMAL_SEPARATOR); } MenuItemView* MenuItemView::AppendMenuItemWithIcon(int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon) { - return AppendMenuItemImpl(item_id, label, string16(), string16(), icon, - NORMAL, ui::NORMAL_SEPARATOR); + return AppendMenuItemImpl(item_id, label, base::string16(), base::string16(), + icon, NORMAL, ui::NORMAL_SEPARATOR); } MenuItemView* MenuItemView::AppendMenuItemImpl( int item_id, - const string16& label, - const string16& sublabel, - const string16& minor_text, + const base::string16& label, + const base::string16& sublabel, + const base::string16& minor_text, const gfx::ImageSkia& icon, Type type, ui::MenuSeparatorType separator_style) { @@ -338,17 +339,17 @@ SubmenuView* MenuItemView::GetSubmenu() const { return submenu_; } -void MenuItemView::SetTitle(const string16& title) { +void MenuItemView::SetTitle(const base::string16& title) { title_ = title; invalidate_dimensions(); // Triggers preferred size recalculation. } -void MenuItemView::SetSubtitle(const string16& subtitle) { +void MenuItemView::SetSubtitle(const base::string16& subtitle) { subtitle_ = subtitle; invalidate_dimensions(); // Triggers preferred size recalculation. } -void MenuItemView::SetMinorText(const string16& minor_text) { +void MenuItemView::SetMinorText(const base::string16& minor_text) { minor_text_ = minor_text; invalidate_dimensions(); // Triggers preferred size recalculation. } @@ -358,7 +359,7 @@ void MenuItemView::SetSelected(bool selected) { SchedulePaint(); } -void MenuItemView::SetTooltip(const string16& tooltip, int item_id) { +void MenuItemView::SetTooltip(const base::string16& tooltip, int item_id) { MenuItemView* item = GetMenuItemByID(item_id); DCHECK(item); item->tooltip_ = tooltip; @@ -448,7 +449,7 @@ char16 MenuItemView::GetMnemonic() { size_t index = 0; do { index = title_.find('&', index); - if (index != string16::npos) { + if (index != base::string16::npos) { if (index + 1 != title_.size() && title_[index + 1] != '&') { char16 char_array[] = { title_[index + 1], 0 }; // TODO(jshin): What about Turkish locale? See http://crbug.com/81719. @@ -459,7 +460,7 @@ char16 MenuItemView::GetMnemonic() { } index++; } - } while (index != string16::npos); + } while (index != base::string16::npos); return 0; } @@ -850,7 +851,7 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { void MenuItemView::PaintMinorText(gfx::Canvas* canvas, bool render_selection) { - string16 minor_text = GetMinorText(); + base::string16 minor_text = GetMinorText(); if (minor_text.empty()) return; @@ -983,7 +984,7 @@ MenuItemView::MenuItemDimensions MenuItemView::CalculateDimensions() { dimensions.standard_width = string_width + label_start + item_right_margin_; // Determine the length of the right-side text. - string16 minor_text = GetMinorText(); + base::string16 minor_text = GetMinorText(); dimensions.minor_text_width = minor_text.empty() ? 0 : GetFont().GetStringWidth(minor_text); @@ -1005,10 +1006,10 @@ int MenuItemView::GetLabelStartForThisItem() { return label_start; } -string16 MenuItemView::GetMinorText() { +base::string16 MenuItemView::GetMinorText() { if (id() == kEmptyMenuItemViewID) { // Don't query the delegate for menus that represent no children. - return string16(); + return base::string16(); } ui::Accelerator accelerator; diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h index 2d394ba..118d949 100644 --- a/ui/views/controls/menu/menu_item_view.h +++ b/ui/views/controls/menu/menu_item_view.h @@ -132,7 +132,7 @@ class VIEWS_EXPORT MenuItemView : public View { // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, - string16* tooltip) const OVERRIDE; + base::string16* tooltip) const OVERRIDE; virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; // Returns the preferred height of menu items. This is only valid when the @@ -147,8 +147,8 @@ class VIEWS_EXPORT MenuItemView : public View { // Returns the accessible name to be used with screen readers. Mnemonics are // removed and the menu item accelerator text is appended. - static string16 GetAccessibleNameForMenuItem( - const string16& item_text, const string16& accelerator_text); + static base::string16 GetAccessibleNameForMenuItem( + const base::string16& item_text, const base::string16& accelerator_text); // Hides and cancels the menu. This does nothing if the menu is not open. void Cancel(); @@ -157,9 +157,9 @@ class VIEWS_EXPORT MenuItemView : public View { // called after adding menu items if the menu may be active. MenuItemView* AddMenuItemAt(int index, int item_id, - const string16& label, - const string16& sublabel, - const string16& minor_text, + const base::string16& label, + const base::string16& sublabel, + const base::string16& minor_text, const gfx::ImageSkia& icon, Type type, ui::MenuSeparatorType separator_style); @@ -177,24 +177,24 @@ class VIEWS_EXPORT MenuItemView : public View { // label The text label shown. // type The type of item. MenuItemView* AppendMenuItem(int item_id, - const string16& label, + const base::string16& label, Type type); // Append a submenu to this menu. // The returned pointer is owned by this menu. MenuItemView* AppendSubMenu(int item_id, - const string16& label); + const base::string16& label); // Append a submenu with an icon to this menu. // The returned pointer is owned by this menu. MenuItemView* AppendSubMenuWithIcon(int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon); // This is a convenience for standard text label menu items where the label // is provided with this call. MenuItemView* AppendMenuItemWithLabel(int item_id, - const string16& label); + const base::string16& label); // This is a convenience for text label menu items where the label is // provided by the delegate. @@ -207,14 +207,14 @@ class VIEWS_EXPORT MenuItemView : public View { // needs an icon. Calling this function forces the Menu class to draw // the menu, instead of relying on Windows. MenuItemView* AppendMenuItemWithIcon(int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon); // All the AppendXXX methods funnel into this. MenuItemView* AppendMenuItemImpl(int item_id, - const string16& label, - const string16& sublabel, - const string16& minor_text, + const base::string16& label, + const base::string16& sublabel, + const base::string16& minor_text, const gfx::ImageSkia& icon, Type type, ui::MenuSeparatorType separator_style); @@ -234,14 +234,14 @@ class VIEWS_EXPORT MenuItemView : public View { const MenuItemView* GetParentMenuItem() const { return parent_menu_item_; } // Sets/Gets the title. - void SetTitle(const string16& title); - const string16& title() const { return title_; } + void SetTitle(const base::string16& title); + const base::string16& title() const { return title_; } // Sets the subtitle. - void SetSubtitle(const string16& subtitle); + void SetSubtitle(const base::string16& subtitle); // Sets the minor text. - void SetMinorText(const string16& minor_text); + void SetMinorText(const base::string16& minor_text); // Returns the type of this menu. const Type& GetType() const { return type_; } @@ -254,7 +254,7 @@ class VIEWS_EXPORT MenuItemView : public View { bool IsSelected() const { return selected_; } // Sets the |tooltip| for a menu item view with |item_id| identifier. - void SetTooltip(const string16& tooltip, int item_id); + void SetTooltip(const base::string16& tooltip, int item_id); // Sets the icon for the descendant identified by item_id. void SetIcon(const gfx::ImageSkia& icon, int item_id); @@ -403,7 +403,7 @@ class VIEWS_EXPORT MenuItemView : public View { // Returns the text that should be displayed on the end (right) of the menu // item. This will be the accelerator (if one exists), otherwise |subtitle_|. - string16 GetMinorText(); + base::string16 GetMinorText(); // Calculates and returns the MenuItemDimensions. MenuItemDimensions CalculateDimensions(); @@ -464,13 +464,13 @@ class VIEWS_EXPORT MenuItemView : public View { SubmenuView* submenu_; // Title. - string16 title_; + base::string16 title_; // Subtitle/sublabel. - string16 subtitle_; + base::string16 subtitle_; // Minor text. - string16 minor_text_; + base::string16 minor_text_; // Does the title have a mnemonic? Only useful on the root menu item. bool has_mnemonics_; @@ -486,7 +486,7 @@ class VIEWS_EXPORT MenuItemView : public View { View* icon_view_; // The tooltip to show on hover for this menu item. - string16 tooltip_; + base::string16 tooltip_; // Width of a menu icon area. static int icon_area_width_; diff --git a/ui/views/controls/menu/menu_model_adapter.cc b/ui/views/controls/menu/menu_model_adapter.cc index 07f1f40..6b29e7e 100644 --- a/ui/views/controls/menu/menu_model_adapter.cc +++ b/ui/views/controls/menu/menu_model_adapter.cc @@ -59,7 +59,7 @@ MenuItemView* MenuModelAdapter::AddMenuItemFromModelAt(ui::MenuModel* model, int item_id) { gfx::Image icon; model->GetIconAt(model_index, &icon); - string16 label, sublabel, minor_text; + base::string16 label, sublabel, minor_text; ui::MenuSeparatorType separator_style = ui::NORMAL_SEPARATOR; MenuItemView::Type type; ui::MenuModel::ItemType menu_type = model->GetTypeAt(model_index); @@ -171,14 +171,14 @@ bool MenuModelAdapter::GetAccelerator(int id, return false; } -string16 MenuModelAdapter::GetLabel(int id) const { +base::string16 MenuModelAdapter::GetLabel(int id) const { ui::MenuModel* model = menu_model_; int index = 0; if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) return model->GetLabelAt(index); NOTREACHED(); - return string16(); + return base::string16(); } const gfx::Font* MenuModelAdapter::GetLabelFont(int id) const { diff --git a/ui/views/controls/menu/menu_model_adapter.h b/ui/views/controls/menu/menu_model_adapter.h index 4db9dbe..f8f6e19 100644 --- a/ui/views/controls/menu/menu_model_adapter.h +++ b/ui/views/controls/menu/menu_model_adapter.h @@ -68,7 +68,7 @@ class VIEWS_EXPORT MenuModelAdapter : public MenuDelegate { const ui::Event& e) OVERRIDE; virtual bool GetAccelerator(int id, ui::Accelerator* accelerator) OVERRIDE; - virtual string16 GetLabel(int id) const OVERRIDE; + virtual base::string16 GetLabel(int id) const OVERRIDE; virtual const gfx::Font* GetLabelFont(int id) const OVERRIDE; virtual bool IsCommandEnabled(int id) const OVERRIDE; virtual bool IsItemChecked(int id) const OVERRIDE; diff --git a/ui/views/controls/menu/menu_model_adapter_unittest.cc b/ui/views/controls/menu/menu_model_adapter_unittest.cc index 6ce3a37..6d2428a 100644 --- a/ui/views/controls/menu/menu_model_adapter_unittest.cc +++ b/ui/views/controls/menu/menu_model_adapter_unittest.cc @@ -51,7 +51,7 @@ class MenuModelBase : public ui::MenuModel { return index + command_id_base_; } - virtual string16 GetLabelAt(int index) const OVERRIDE { + virtual base::string16 GetLabelAt(int index) const OVERRIDE { return items_[index].label; } @@ -133,7 +133,7 @@ class MenuModelBase : public ui::MenuModel { } ItemType type; - string16 label; + base::string16 label; ui::MenuModel* submenu; }; diff --git a/ui/views/controls/menu/menu_win.cc b/ui/views/controls/menu/menu_win.cc index d88659f..8eeba5a 100644 --- a/ui/views/controls/menu/menu_win.cc +++ b/ui/views/controls/menu/menu_win.cc @@ -38,7 +38,7 @@ static MenuHostWindow* active_host_window = NULL; // The data of menu items needed to display. struct MenuWin::ItemData { - string16 label; + base::string16 label; gfx::ImageSkia icon; bool submenu; }; @@ -109,7 +109,7 @@ class MenuHostWindow : public gfx::WindowImpl { if (data->submenu) lpmis->itemWidth += kArrowWidth; // If the label contains an accelerator, make room for tab. - if (data->label.find(L'\t') != string16::npos) + if (data->label.find(L'\t') != base::string16::npos) lpmis->itemWidth += font.GetStringWidth(L" "); lpmis->itemHeight = font.GetHeight() + kItemBottomMargin + kItemTopMargin; } else { @@ -165,10 +165,10 @@ class MenuHostWindow : public gfx::WindowImpl { // left and the accelerator on the right. // TODO(jungshik): This will break in RTL UI. Currently, he/ar use the // window system UI font and will not hit here. - string16 label = data->label; - string16 accel; - string16::size_type tab_pos = label.find(L'\t'); - if (tab_pos != string16::npos) { + base::string16 label = data->label; + base::string16 accel; + base::string16::size_type tab_pos = label.find(L'\t'); + if (tab_pos != base::string16::npos) { accel = label.substr(tab_pos); label = label.substr(0, tab_pos); } @@ -262,7 +262,7 @@ MenuWin::~MenuWin() { void MenuWin::AddMenuItemWithIcon(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon) { owner_draw_ = true; Menu::AddMenuItemWithIcon(index, item_id, label, icon); @@ -270,7 +270,7 @@ void MenuWin::AddMenuItemWithIcon(int index, Menu* MenuWin::AddSubMenuWithIcon(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon) { MenuWin* submenu = new MenuWin(this); submenus_.push_back(submenu); @@ -296,7 +296,7 @@ void MenuWin::EnableMenuItemAt(int index, bool enabled) { EnableMenuItem(menu_, index, MF_BYPOSITION | enable_flags); } -void MenuWin::SetMenuLabel(int item_id, const string16& label) { +void MenuWin::SetMenuLabel(int item_id, const base::string16& label) { MENUITEMINFO mii = {0}; mii.cbSize = sizeof(mii); mii.fMask = MIIM_STRING; @@ -385,7 +385,7 @@ int MenuWin::ItemCount() { void MenuWin::AddMenuItemInternal(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon, MenuItemType type) { AddMenuItemInternal(index, item_id, label, icon, NULL, type); @@ -393,7 +393,7 @@ void MenuWin::AddMenuItemInternal(int index, void MenuWin::AddMenuItemInternal(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon, HMENU submenu, MenuItemType type) { @@ -437,7 +437,8 @@ void MenuWin::AddMenuItemInternal(int index, item_data_.push_back(data); data->submenu = submenu != NULL; - string16 actual_label(label.empty() ? delegate()->GetLabel(item_id) : label); + base::string16 actual_label( + label.empty() ? delegate()->GetLabel(item_id) : label); // Find out if there is a shortcut we need to append to the label. ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE); @@ -495,7 +496,7 @@ void MenuWin::SetMenuInfo() { // Validate the label. If there is a contextual label, use it, otherwise // default to the static label - string16 label; + base::string16 label; if (!delegate()->GetContextualLabel(id, &label)) label = labels_[i - sep_count]; diff --git a/ui/views/controls/menu/menu_win.h b/ui/views/controls/menu/menu_win.h index 284f26a..7e0a127 100644 --- a/ui/views/controls/menu/menu_win.h +++ b/ui/views/controls/menu/menu_win.h @@ -48,16 +48,16 @@ class MenuWin : public Menu { // Overridden from Menu: virtual void AddMenuItemWithIcon(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon) OVERRIDE; virtual Menu* AddSubMenuWithIcon(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon) OVERRIDE; virtual void AddSeparator(int index) OVERRIDE; virtual void EnableMenuItemByID(int item_id, bool enabled) OVERRIDE; virtual void EnableMenuItemAt(int index, bool enabled) OVERRIDE; - virtual void SetMenuLabel(int item_id, const string16& label) OVERRIDE; + virtual void SetMenuLabel(int item_id, const base::string16& label) OVERRIDE; virtual bool SetIcon(const gfx::ImageSkia& icon, int item_id) OVERRIDE; virtual void RunMenuAt(int x, int y) OVERRIDE; virtual void Cancel() OVERRIDE; @@ -73,7 +73,7 @@ class MenuWin : public Menu { protected: virtual void AddMenuItemInternal(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon, MenuItemType type) OVERRIDE; @@ -85,7 +85,7 @@ class MenuWin : public Menu { void AddMenuItemInternal(int index, int item_id, - const string16& label, + const base::string16& label, const gfx::ImageSkia& icon, HMENU submenu, MenuItemType type); @@ -110,7 +110,7 @@ class MenuWin : public Menu { // This list is used to store the default labels for the menu items. // We may use contextual labels when RunMenu is called, so we must save // a copy of default ones here. - std::vector<string16> labels_; + std::vector<base::string16> labels_; // A flag to indicate whether this menu will be drawn by the Menu class. // If it's true, all the menu items will be owner drawn. Otherwise, diff --git a/ui/views/controls/menu/native_menu_win.cc b/ui/views/controls/menu/native_menu_win.cc index c260af9..2a6e8b8 100644 --- a/ui/views/controls/menu/native_menu_win.cc +++ b/ui/views/controls/menu/native_menu_win.cc @@ -51,7 +51,7 @@ struct NativeMenuWin::ItemData { // The Windows API requires that whoever creates the menus must own the // strings used for labels, and keep them around for the lifetime of the // created menu. So be it. - string16 label; + base::string16 label; // Someone needs to own submenus, it may as well be us. scoped_ptr<Menu2> submenu; @@ -178,7 +178,7 @@ class NativeMenuWin::MenuHostWindow { if (data->submenu.get()) measure_item_struct->itemWidth += kArrowWidth; // If the label contains an accelerator, make room for tab. - if (data->label.find(L'\t') != string16::npos) + if (data->label.find(L'\t') != base::string16::npos) measure_item_struct->itemWidth += font.GetStringWidth(L" "); measure_item_struct->itemHeight = font.GetHeight() + kItemBottomMargin + kItemTopMargin; @@ -234,10 +234,10 @@ class NativeMenuWin::MenuHostWindow { // left and the accelerator on the right. // TODO(jungshik): This will break in RTL UI. Currently, he/ar use the // window system UI font and will not hit here. - string16 label = data->label; - string16 accel; - string16::size_type tab_pos = label.find(L'\t'); - if (tab_pos != string16::npos) { + base::string16 label = data->label; + base::string16 accel; + base::string16::size_type tab_pos = label.find(L'\t'); + if (tab_pos != base::string16::npos) { accel = label.substr(tab_pos); label = label.substr(0, tab_pos); } @@ -626,7 +626,7 @@ void NativeMenuWin::AddMenuItemAt(int menu_index, int model_index) { mii.fType = MFT_OWNERDRAW; ItemData* item_data = new ItemData; - item_data->label = string16(); + item_data->label = base::string16(); ui::MenuModel::ItemType type = model_->GetTypeAt(model_index); if (type == ui::MenuModel::TYPE_SUBMENU) { item_data->submenu.reset(new Menu2(model_->GetSubmenuModelAt(model_index))); @@ -678,7 +678,7 @@ void NativeMenuWin::SetMenuItemState(int menu_index, bool enabled, bool checked, void NativeMenuWin::SetMenuItemLabel(int menu_index, int model_index, - const string16& label) { + const base::string16& label) { if (IsSeparatorItemAt(menu_index)) return; @@ -690,8 +690,8 @@ void NativeMenuWin::SetMenuItemLabel(int menu_index, void NativeMenuWin::UpdateMenuItemInfoForString(MENUITEMINFO* mii, int model_index, - const string16& label) { - string16 formatted = label; + const base::string16& label) { + base::string16 formatted = label; ui::MenuModel::ItemType type = model_->GetTypeAt(model_index); // Strip out any tabs, otherwise they get interpreted as accelerators and can // lead to weird behavior. diff --git a/ui/views/controls/menu/native_menu_win.h b/ui/views/controls/menu/native_menu_win.h index ca6f37b..ce3a072 100644 --- a/ui/views/controls/menu/native_menu_win.h +++ b/ui/views/controls/menu/native_menu_win.h @@ -74,7 +74,7 @@ class VIEWS_EXPORT NativeMenuWin : public MenuWrapper { // Sets the label of the item at the specified index. void SetMenuItemLabel(int menu_index, int model_index, - const string16& label); + const base::string16& label); // Updates the local data structure with the correctly formatted version of // |label| at the specified model_index, and adds string data to |mii| if @@ -82,7 +82,7 @@ class VIEWS_EXPORT NativeMenuWin : public MenuWrapper { // of the peculiarities of the Windows menu API. void UpdateMenuItemInfoForString(MENUITEMINFO* mii, int model_index, - const string16& label); + const base::string16& label); // Returns the alignment flags to be passed to TrackPopupMenuEx, based on the // supplied alignment and the UI text direction. diff --git a/ui/views/controls/message_box_view.cc b/ui/views/controls/message_box_view.cc index 3c2cde9..284b6d5 100644 --- a/ui/views/controls/message_box_view.cc +++ b/ui/views/controls/message_box_view.cc @@ -44,8 +44,8 @@ bool IsParagraphSeparator(char16 c) { // Splits |text| into a vector of paragraphs. // Given an example "\nabc\ndef\n\n\nhij\n", the split results should be: // "", "abc", "def", "", "", "hij", and "". -void SplitStringIntoParagraphs(const string16& text, - std::vector<string16>* paragraphs) { +void SplitStringIntoParagraphs(const base::string16& text, + std::vector<base::string16>* paragraphs) { paragraphs->clear(); size_t start = 0; @@ -65,7 +65,7 @@ namespace views { /////////////////////////////////////////////////////////////////////////////// // MessageBoxView, public: -MessageBoxView::InitParams::InitParams(const string16& message) +MessageBoxView::InitParams::InitParams(const base::string16& message) : options(NO_OPTIONS), message(message), message_width(kDefaultMessageWidth), @@ -85,8 +85,8 @@ MessageBoxView::MessageBoxView(const InitParams& params) MessageBoxView::~MessageBoxView() {} -string16 MessageBoxView::GetInputText() { - return prompt_field_ ? prompt_field_->text() : string16(); +base::string16 MessageBoxView::GetInputText() { + return prompt_field_ ? prompt_field_->text() : base::string16(); } bool MessageBoxView::IsCheckBoxSelected() { @@ -101,7 +101,7 @@ void MessageBoxView::SetIcon(const gfx::ImageSkia& icon) { ResetLayoutManager(); } -void MessageBoxView::SetCheckBoxLabel(const string16& label) { +void MessageBoxView::SetCheckBoxLabel(const base::string16& label) { if (!checkbox_) checkbox_ = new Checkbox(label); else @@ -115,7 +115,8 @@ void MessageBoxView::SetCheckBoxSelected(bool selected) { checkbox_->SetChecked(selected); } -void MessageBoxView::SetLink(const string16& text, LinkListener* listener) { +void MessageBoxView::SetLink(const base::string16& text, + LinkListener* listener) { if (text.empty()) { DCHECK(!listener); delete link_; @@ -162,7 +163,7 @@ bool MessageBoxView::AcceleratorPressed(const ui::Accelerator& accelerator) { return false; ui::ScopedClipboardWriter scw(clipboard, ui::CLIPBOARD_TYPE_COPY_PASTE); - string16 text = message_labels_[0]->text(); + base::string16 text = message_labels_[0]->text(); for (size_t i = 1; i < message_labels_.size(); ++i) text += message_labels_[i]->text(); scw.WriteText(text); @@ -174,7 +175,7 @@ bool MessageBoxView::AcceleratorPressed(const ui::Accelerator& accelerator) { void MessageBoxView::Init(const InitParams& params) { if (params.options & DETECT_DIRECTIONALITY) { - std::vector<string16> texts; + std::vector<base::string16> texts; SplitStringIntoParagraphs(params.message, &texts); // If the text originates from a web page, its alignment is based on its // first character with strong directionality. diff --git a/ui/views/controls/message_box_view.h b/ui/views/controls/message_box_view.h index 1d92a37..27403e7 100644 --- a/ui/views/controls/message_box_view.h +++ b/ui/views/controls/message_box_view.h @@ -42,12 +42,12 @@ class VIEWS_EXPORT MessageBoxView : public View { }; struct VIEWS_EXPORT InitParams { - explicit InitParams(const string16& message); + explicit InitParams(const base::string16& message); ~InitParams(); uint16 options; - string16 message; - string16 default_prompt; + base::string16 message; + base::string16 default_prompt; int message_width; int inter_row_vertical_spacing; }; @@ -60,7 +60,7 @@ class VIEWS_EXPORT MessageBoxView : public View { views::Textfield* text_box() { return prompt_field_; } // Returns user entered data in the prompt field. - string16 GetInputText(); + base::string16 GetInputText(); // Returns true if a checkbox is selected, false otherwise. (And false if // the message box has no checkbox.) @@ -73,14 +73,14 @@ class VIEWS_EXPORT MessageBoxView : public View { // Adds a checkbox with the specified label to the message box if this is the // first call. Otherwise, it changes the label of the current checkbox. To // start, the message box has no checkbox until this function is called. - void SetCheckBoxLabel(const string16& label); + void SetCheckBoxLabel(const base::string16& label); // Sets the state of the check-box. void SetCheckBoxSelected(bool selected); // Sets the text and the listener of the link. If |text| is empty, the link // is removed. - void SetLink(const string16& text, LinkListener* listener); + void SetLink(const base::string16& text, LinkListener* listener); // View: virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; diff --git a/ui/views/controls/prefix_delegate.h b/ui/views/controls/prefix_delegate.h index 41d30d4..07d8598 100644 --- a/ui/views/controls/prefix_delegate.h +++ b/ui/views/controls/prefix_delegate.h @@ -23,7 +23,7 @@ class VIEWS_EXPORT PrefixDelegate : public View { virtual void SetSelectedRow(int row) = 0; // Returns the item at the specified row. - virtual string16 GetTextForRow(int row) = 0; + virtual base::string16 GetTextForRow(int row) = 0; protected: virtual ~PrefixDelegate() {} diff --git a/ui/views/controls/prefix_selector.cc b/ui/views/controls/prefix_selector.cc index d66a034..538972f 100644 --- a/ui/views/controls/prefix_selector.cc +++ b/ui/views/controls/prefix_selector.cc @@ -47,12 +47,12 @@ void PrefixSelector::ConfirmCompositionText() { void PrefixSelector::ClearCompositionText() { } -void PrefixSelector::InsertText(const string16& text) { +void PrefixSelector::InsertText(const base::string16& text) { OnTextInput(text); } void PrefixSelector::InsertChar(char16 ch, int flags) { - OnTextInput(string16(1, ch)); + OnTextInput(base::string16(1, ch)); } gfx::NativeWindow PrefixSelector::GetAttachedWindow() const { @@ -115,7 +115,7 @@ bool PrefixSelector::DeleteRange(const gfx::Range& range) { } bool PrefixSelector::GetTextFromRange(const gfx::Range& range, - string16* text) const { + base::string16* text) const { return false; } @@ -143,7 +143,7 @@ void PrefixSelector::OnCandidateWindowUpdated() { void PrefixSelector::OnCandidateWindowHidden() { } -void PrefixSelector::OnTextInput(const string16& text) { +void PrefixSelector::OnTextInput(const base::string16& text) { // Small hack to filter out 'tab' and 'enter' input, as the expectation is // that they are control characters and will not affect the currently-active // prefix. @@ -171,7 +171,7 @@ void PrefixSelector::OnTextInput(const string16& text) { time_of_last_key_ = now; const int start_row = row; - const string16 lower_text(base::i18n::ToLower(current_text_)); + const base::string16 lower_text(base::i18n::ToLower(current_text_)); do { if (TextAtRowMatchesText(row, current_text_)) { prefix_delegate_->SetSelectedRow(row); @@ -182,8 +182,8 @@ void PrefixSelector::OnTextInput(const string16& text) { } bool PrefixSelector::TextAtRowMatchesText(int row, - const string16& lower_text) { - const string16 model_text( + const base::string16& lower_text) { + const base::string16 model_text( base::i18n::ToLower(prefix_delegate_->GetTextForRow(row))); return (model_text.size() >= lower_text.size()) && (model_text.compare(0, lower_text.size(), lower_text) == 0); diff --git a/ui/views/controls/prefix_selector.h b/ui/views/controls/prefix_selector.h index 57f6dcf..0ae3cfe 100644 --- a/ui/views/controls/prefix_selector.h +++ b/ui/views/controls/prefix_selector.h @@ -29,7 +29,7 @@ class VIEWS_EXPORT PrefixSelector : public ui::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; @@ -45,7 +45,7 @@ class VIEWS_EXPORT PrefixSelector : public ui::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; @@ -57,10 +57,10 @@ class VIEWS_EXPORT PrefixSelector : public ui::TextInputClient { private: // Invoked when text is typed. Tries to change the selection appropriately. - void OnTextInput(const string16& text); + void OnTextInput(const base::string16& text); // Returns true if the text of the node at |row| starts with |lower_text|. - bool TextAtRowMatchesText(int row, const string16& lower_text); + bool TextAtRowMatchesText(int row, const base::string16& lower_text); // Clears |current_text_| and resets |time_of_last_key_|. void ClearText(); @@ -70,7 +70,7 @@ class VIEWS_EXPORT PrefixSelector : public ui::TextInputClient { // Time OnTextInput() was last invoked. base::TimeTicks time_of_last_key_; - string16 current_text_; + base::string16 current_text_; DISALLOW_COPY_AND_ASSIGN(PrefixSelector); }; diff --git a/ui/views/controls/prefix_selector_unittest.cc b/ui/views/controls/prefix_selector_unittest.cc index c39e6cc..14356df 100644 --- a/ui/views/controls/prefix_selector_unittest.cc +++ b/ui/views/controls/prefix_selector_unittest.cc @@ -36,12 +36,12 @@ class TestPrefixDelegate : public PrefixDelegate { selected_row_ = row; } - virtual string16 GetTextForRow(int row) OVERRIDE { + virtual base::string16 GetTextForRow(int row) OVERRIDE { return rows_[row]; } private: - std::vector<string16> rows_; + std::vector<base::string16> rows_; int selected_row_; DISALLOW_COPY_AND_ASSIGN(TestPrefixDelegate); diff --git a/ui/views/controls/progress_bar.cc b/ui/views/controls/progress_bar.cc index 087c2df..1b6bba0 100644 --- a/ui/views/controls/progress_bar.cc +++ b/ui/views/controls/progress_bar.cc @@ -167,11 +167,12 @@ void ProgressBar::SetValue(double value) { } } -void ProgressBar::SetTooltipText(const string16& tooltip_text) { +void ProgressBar::SetTooltipText(const base::string16& tooltip_text) { tooltip_text_ = tooltip_text; } -bool ProgressBar::GetTooltipText(const gfx::Point& p, string16* tooltip) const { +bool ProgressBar::GetTooltipText(const gfx::Point& p, + base::string16* tooltip) const { DCHECK(tooltip); *tooltip = tooltip_text_; return !tooltip_text_.empty(); diff --git a/ui/views/controls/progress_bar.h b/ui/views/controls/progress_bar.h index 1f3d595..6584dc8 100644 --- a/ui/views/controls/progress_bar.h +++ b/ui/views/controls/progress_bar.h @@ -35,11 +35,11 @@ class VIEWS_EXPORT ProgressBar : public View { // Sets the tooltip text. Default behavior for a progress bar is to show no // tooltip on mouse hover. Calling this lets you set a custom tooltip. To // revert to default behavior, call this with an empty string. - void SetTooltipText(const string16& tooltip_text); + void SetTooltipText(const base::string16& tooltip_text); // Overridden from View: virtual bool GetTooltipText(const gfx::Point& p, - string16* tooltip) const OVERRIDE; + base::string16* tooltip) const OVERRIDE; virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; private: @@ -58,7 +58,7 @@ class VIEWS_EXPORT ProgressBar : public View { double current_value_; // Tooltip text. - string16 tooltip_text_; + base::string16 tooltip_text_; DISALLOW_COPY_AND_ASSIGN(ProgressBar); }; diff --git a/ui/views/controls/progress_bar_unittest.cc b/ui/views/controls/progress_bar_unittest.cc index 78df2e1..de985e8 100644 --- a/ui/views/controls/progress_bar_unittest.cc +++ b/ui/views/controls/progress_bar_unittest.cc @@ -12,10 +12,10 @@ namespace views { TEST(ProgressBarTest, TooltipTextProperty) { ProgressBar bar; - string16 tooltip = ASCIIToUTF16("Some text"); + base::string16 tooltip = ASCIIToUTF16("Some text"); EXPECT_FALSE(bar.GetTooltipText(gfx::Point(), &tooltip)); - EXPECT_EQ(string16(), tooltip); - string16 tooltip_text = ASCIIToUTF16("My progress"); + EXPECT_EQ(base::string16(), tooltip); + base::string16 tooltip_text = ASCIIToUTF16("My progress"); bar.SetTooltipText(tooltip_text); EXPECT_TRUE(bar.GetTooltipText(gfx::Point(), &tooltip)); EXPECT_EQ(tooltip_text, tooltip); @@ -28,7 +28,7 @@ TEST(ProgressBarTest, Accessibility) { ui::AccessibleViewState state; bar.GetAccessibleState(&state); EXPECT_EQ(ui::AccessibilityTypes::ROLE_PROGRESSBAR, state.role); - EXPECT_EQ(string16(), state.name); + EXPECT_EQ(base::string16(), state.name); EXPECT_TRUE(ui::AccessibilityTypes::STATE_READONLY & state.state); } diff --git a/ui/views/controls/scrollbar/base_scroll_bar.cc b/ui/views/controls/scrollbar/base_scroll_bar.cc index 6271c2e..02f79dee 100644 --- a/ui/views/controls/scrollbar/base_scroll_bar.cc +++ b/ui/views/controls/scrollbar/base_scroll_bar.cc @@ -305,7 +305,7 @@ void BaseScrollBar::ShowContextMenuForView(View* source, /////////////////////////////////////////////////////////////////////////////// // BaseScrollBar, Menu::Delegate implementation: -string16 BaseScrollBar::GetLabel(int id) const { +base::string16 BaseScrollBar::GetLabel(int id) const { int ids_value = 0; switch (id) { case ScrollBarContextMenuCommand_ScrollHere: @@ -337,7 +337,7 @@ string16 BaseScrollBar::GetLabel(int id) const { NOTREACHED() << "Invalid BaseScrollBar Context Menu command!"; } - return ids_value ? l10n_util::GetStringUTF16(ids_value) : string16(); + return ids_value ? l10n_util::GetStringUTF16(ids_value) : base::string16(); } bool BaseScrollBar::IsCommandEnabled(int id) const { diff --git a/ui/views/controls/scrollbar/base_scroll_bar.h b/ui/views/controls/scrollbar/base_scroll_bar.h index a517b6c..b380376 100644 --- a/ui/views/controls/scrollbar/base_scroll_bar.h +++ b/ui/views/controls/scrollbar/base_scroll_bar.h @@ -93,7 +93,7 @@ class VIEWS_EXPORT BaseScrollBar : public ScrollBar, ui::MenuSourceType source_type) OVERRIDE; // Menu::Delegate overrides: - virtual string16 GetLabel(int id) const OVERRIDE; + virtual base::string16 GetLabel(int id) const OVERRIDE; virtual bool IsCommandEnabled(int id) const OVERRIDE; virtual void ExecuteCommand(int id) OVERRIDE; diff --git a/ui/views/controls/single_split_view.cc b/ui/views/controls/single_split_view.cc index 85dab92..add105c 100644 --- a/ui/views/controls/single_split_view.cc +++ b/ui/views/controls/single_split_view.cc @@ -148,7 +148,7 @@ void SingleSplitView::CalculateChildrenBounds( } } -void SingleSplitView::SetAccessibleName(const string16& name) { +void SingleSplitView::SetAccessibleName(const base::string16& name) { accessible_name_ = name; } diff --git a/ui/views/controls/single_split_view.h b/ui/views/controls/single_split_view.h index f4a336a..dbe69b3 100644 --- a/ui/views/controls/single_split_view.h +++ b/ui/views/controls/single_split_view.h @@ -77,7 +77,7 @@ class VIEWS_EXPORT SingleSplitView : public View { gfx::Rect* leading_bounds, gfx::Rect* trailing_bounds) const; - void SetAccessibleName(const string16& name); + void SetAccessibleName(const base::string16& name); protected: // View overrides. @@ -137,7 +137,7 @@ class VIEWS_EXPORT SingleSplitView : public View { SingleSplitViewListener* listener_; // The accessible name of this view. - string16 accessible_name_; + base::string16 accessible_name_; DISALLOW_COPY_AND_ASSIGN(SingleSplitView); }; diff --git a/ui/views/controls/slider.cc b/ui/views/controls/slider.cc index 4be6f5a..69772ed 100644 --- a/ui/views/controls/slider.cc +++ b/ui/views/controls/slider.cc @@ -167,7 +167,7 @@ void Slider::UpdateState(bool control_on) { SchedulePaint(); } -void Slider::SetAccessibleName(const string16& name) { +void Slider::SetAccessibleName(const base::string16& name) { accessible_name_ = name; } diff --git a/ui/views/controls/slider.h b/ui/views/controls/slider.h index cec24c2..a2a81b5 100644 --- a/ui/views/controls/slider.h +++ b/ui/views/controls/slider.h @@ -57,7 +57,7 @@ class VIEWS_EXPORT Slider : public View, public gfx::AnimationDelegate { // Set the delta used for changing the value via keyboard. void SetKeyboardIncrement(float increment); - void SetAccessibleName(const string16& name); + void SetAccessibleName(const base::string16& name); void set_enable_accessibility_events(bool enabled) { accessibility_events_enabled_ = enabled; @@ -105,7 +105,7 @@ class VIEWS_EXPORT Slider : public View, public gfx::AnimationDelegate { float keyboard_increment_; float animating_value_; bool value_is_valid_; - string16 accessible_name_; + base::string16 accessible_name_; bool accessibility_events_enabled_; SkColor focus_border_color_; diff --git a/ui/views/controls/styled_label.cc b/ui/views/controls/styled_label.cc index 96cc275..73453a1 100644 --- a/ui/views/controls/styled_label.cc +++ b/ui/views/controls/styled_label.cc @@ -25,7 +25,7 @@ int CalculateLineHeight() { } scoped_ptr<Label> CreateLabelRange( - const string16& text, + const base::string16& text, const StyledLabel::RangeStyleInfo& style_info, views::LinkListener* link_listener) { scoped_ptr<Label> result; @@ -80,7 +80,8 @@ bool StyledLabel::StyleRange::operator<( return range.start() > other.range.start(); } -StyledLabel::StyledLabel(const string16& text, StyledLabelListener* listener) +StyledLabel::StyledLabel(const base::string16& text, + StyledLabelListener* listener) : listener_(listener), displayed_on_background_color_set_(false), auto_color_readability_enabled_(true) { @@ -89,7 +90,7 @@ StyledLabel::StyledLabel(const string16& text, StyledLabelListener* listener) StyledLabel::~StyledLabel() {} -void StyledLabel::SetText(const string16& text) { +void StyledLabel::SetText(const base::string16& text) { text_ = text; style_ranges_ = std::priority_queue<StyleRange>(); RemoveAllChildViews(true); @@ -162,7 +163,7 @@ int StyledLabel::CalculateAndDoLayout(int width, bool dry_run) { // bounds. int x = 0; - string16 remaining_string = text_; + base::string16 remaining_string = text_; std::priority_queue<StyleRange> style_ranges = style_ranges_; // Iterate over the text, creating a bunch of labels and links and laying them @@ -180,7 +181,7 @@ int StyledLabel::CalculateAndDoLayout(int width, bool dry_run) { const size_t position = text_.size() - remaining_string.size(); const gfx::Rect chunk_bounds(x, 0, width - x, 2 * line_height); - std::vector<string16> substrings; + std::vector<base::string16> substrings; gfx::FontList text_font_list; // If the start of the remaining text is inside a styled range, the font // style may differ from the base font. The font specified by the range @@ -197,7 +198,7 @@ int StyledLabel::CalculateAndDoLayout(int width, bool dry_run) { &substrings); DCHECK(!substrings.empty()); - string16 chunk = substrings[0]; + base::string16 chunk = substrings[0]; if (chunk.empty()) { // Nothing fits on this line. Start a new line. // If x is 0, first line may have leading whitespace that doesn't fit in a diff --git a/ui/views/controls/styled_label.h b/ui/views/controls/styled_label.h index adf5993..7376810 100644 --- a/ui/views/controls/styled_label.h +++ b/ui/views/controls/styled_label.h @@ -44,7 +44,7 @@ class VIEWS_EXPORT StyledLabel : public View, public LinkListener { SkColor color; // Tooltip for the range. - string16 tooltip; + base::string16 tooltip; // If set, the whole range will be put on a single line. bool disable_line_wrapping; @@ -54,11 +54,11 @@ class VIEWS_EXPORT StyledLabel : public View, public LinkListener { }; // Note that any trailing whitespace in |text| will be trimmed. - StyledLabel(const string16& text, StyledLabelListener* listener); + StyledLabel(const base::string16& text, StyledLabelListener* listener); virtual ~StyledLabel(); // Sets the text to be displayed, and clears any previous styling. - void SetText(const string16& text); + void SetText(const base::string16& text); // Marks the given range within |text_| with style defined by |style_info|. // |range| must be contained in |text_|. @@ -111,7 +111,7 @@ class VIEWS_EXPORT StyledLabel : public View, public LinkListener { int CalculateAndDoLayout(int width, bool dry_run); // The text to display. - string16 text_; + base::string16 text_; // The default style to use for any part of the text that isn't within // a range in |style_ranges_|. diff --git a/ui/views/controls/styled_label_unittest.cc b/ui/views/controls/styled_label_unittest.cc index 18595ed..c32d1f6 100644 --- a/ui/views/controls/styled_label_unittest.cc +++ b/ui/views/controls/styled_label_unittest.cc @@ -351,7 +351,7 @@ TEST_F(StyledLabelTest, StyledRangeWithTooltip) { styled()->child_at(3)->bounds().x()); EXPECT_EQ(0, styled()->child_at(4)->bounds().x()); - string16 tooltip; + base::string16 tooltip; EXPECT_TRUE( styled()->child_at(1)->GetTooltipText(gfx::Point(1, 1), &tooltip)); EXPECT_EQ(ASCIIToUTF16("tooltip"), tooltip); diff --git a/ui/views/controls/tabbed_pane/tabbed_pane.cc b/ui/views/controls/tabbed_pane/tabbed_pane.cc index 3f2d5da9..f32c3fe 100644 --- a/ui/views/controls/tabbed_pane/tabbed_pane.cc +++ b/ui/views/controls/tabbed_pane/tabbed_pane.cc @@ -33,7 +33,7 @@ const char TabbedPane::kViewClassName[] = "TabbedPane"; // The tab view shown in the tab strip. class Tab : public View { public: - Tab(TabbedPane* tabbed_pane, const string16& title, View* contents); + Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents); virtual ~Tab(); View* contents() const { return contents_; } @@ -85,7 +85,7 @@ class TabStrip : public View { DISALLOW_COPY_AND_ASSIGN(TabStrip); }; -Tab::Tab(TabbedPane* tabbed_pane, const string16& title, View* contents) +Tab::Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents) : tabbed_pane_(tabbed_pane), title_(new Label(title, gfx::Font().DeriveFont(0, gfx::Font::BOLD))), tab_state_(TAB_ACTIVE), @@ -255,12 +255,12 @@ View* TabbedPane::GetSelectedTab() { NULL : GetTabAt(selected_tab_index())->contents(); } -void TabbedPane::AddTab(const string16& title, View* contents) { +void TabbedPane::AddTab(const base::string16& title, View* contents) { AddTabAtIndex(tab_strip_->child_count(), title, contents); } void TabbedPane::AddTabAtIndex(int index, - const string16& title, + const base::string16& title, View* contents) { DCHECK(index >= 0 && index <= GetTabCount()); contents->SetVisible(false); diff --git a/ui/views/controls/tabbed_pane/tabbed_pane.h b/ui/views/controls/tabbed_pane/tabbed_pane.h index a837464..e7ea389 100644 --- a/ui/views/controls/tabbed_pane/tabbed_pane.h +++ b/ui/views/controls/tabbed_pane/tabbed_pane.h @@ -40,12 +40,12 @@ class VIEWS_EXPORT TabbedPane : public View { // Adds a new tab at the end of this TabbedPane with the specified |title|. // |contents| is the view displayed when the tab is selected and is owned by // the TabbedPane. - void AddTab(const string16& title, View* contents); + void AddTab(const base::string16& title, View* contents); // Adds a new tab at |index| with |title|. |contents| is the view displayed // when the tab is selected and is owned by the TabbedPane. If the tabbed pane // is currently empty, the new tab is selected. - void AddTabAtIndex(int index, const string16& title, View* contents); + void AddTabAtIndex(int index, const base::string16& title, View* contents); // Selects the tab at |index|, which must be valid. void SelectTabAt(int index); diff --git a/ui/views/controls/table/table_view.cc b/ui/views/controls/table/table_view.cc index 8a27a1f..a23c981 100644 --- a/ui/views/controls/table/table_view.cc +++ b/ui/views/controls/table/table_view.cc @@ -404,7 +404,7 @@ void TableView::OnGestureEvent(ui::GestureEvent* event) { } bool TableView::GetTooltipText(const gfx::Point& p, - string16* tooltip) const { + base::string16* tooltip) const { return GetTooltipImpl(p, tooltip, NULL); } @@ -871,7 +871,7 @@ GroupRange TableView::GetGroupRange(int model_index) const { } bool TableView::GetTooltipImpl(const gfx::Point& location, - string16* tooltip, + base::string16* tooltip, gfx::Point* tooltip_origin) const { const int row = location.y() / row_height_; if (row < 0 || row >= RowCount() || visible_columns_.empty()) @@ -883,7 +883,7 @@ bool TableView::GetTooltipImpl(const gfx::Point& location, x > (visible_columns_[column].x + visible_columns_[column].width)) return false; - const string16 text(model_->GetText(ViewToModel(row), + const base::string16 text(model_->GetText(ViewToModel(row), visible_columns_[column].column.id)); if (text.empty()) return false; diff --git a/ui/views/controls/table/table_view.h b/ui/views/controls/table/table_view.h index c2a9472..64cb2a4 100644 --- a/ui/views/controls/table/table_view.h +++ b/ui/views/controls/table/table_view.h @@ -171,7 +171,7 @@ class VIEWS_EXPORT TableView virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; virtual bool GetTooltipText(const gfx::Point& p, - string16* tooltip) const OVERRIDE; + base::string16* tooltip) const OVERRIDE; virtual bool GetTooltipTextOrigin(const gfx::Point& p, gfx::Point* loc) const OVERRIDE; @@ -291,7 +291,7 @@ class VIEWS_EXPORT TableView // sets |tooltip| and/or |tooltip_origin| as appropriate, each of which may be // NULL. bool GetTooltipImpl(const gfx::Point& location, - string16* tooltip, + base::string16* tooltip, gfx::Point* tooltip_origin) const; ui::TableModel* model_; diff --git a/ui/views/controls/table/table_view_unittest.cc b/ui/views/controls/table/table_view_unittest.cc index 70547ce..e381a13 100644 --- a/ui/views/controls/table/table_view_unittest.cc +++ b/ui/views/controls/table/table_view_unittest.cc @@ -67,7 +67,7 @@ class TestTableModel2 : public ui::TableModel { // ui::TableModel: virtual int RowCount() OVERRIDE; - virtual string16 GetText(int row, int column_id) OVERRIDE; + virtual base::string16 GetText(int row, int column_id) OVERRIDE; virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; virtual int CompareValues(int row1, int row2, int column_id) OVERRIDE; @@ -115,7 +115,7 @@ int TestTableModel2::RowCount() { return static_cast<int>(rows_.size()); } -string16 TestTableModel2::GetText(int row, int column_id) { +base::string16 TestTableModel2::GetText(int row, int column_id) { return base::IntToString16(rows_[row][column_id]); } diff --git a/ui/views/controls/table/test_table_model.cc b/ui/views/controls/table/test_table_model.cc index c855aa1..58e82d3 100644 --- a/ui/views/controls/table/test_table_model.cc +++ b/ui/views/controls/table/test_table_model.cc @@ -22,7 +22,7 @@ int TestTableModel::RowCount() { return row_count_; } -string16 TestTableModel::GetText(int row, int column_id) { +base::string16 TestTableModel::GetText(int row, int column_id) { return ASCIIToUTF16(base::IntToString(row) + "x" + base::IntToString(column_id)); } diff --git a/ui/views/controls/table/test_table_model.h b/ui/views/controls/table/test_table_model.h index d093102..8338aae 100644 --- a/ui/views/controls/table/test_table_model.h +++ b/ui/views/controls/table/test_table_model.h @@ -15,7 +15,7 @@ class TestTableModel : public ui::TableModel { // ui::TableModel overrides: virtual int RowCount() OVERRIDE; - virtual string16 GetText(int row, int column_id) OVERRIDE; + virtual base::string16 GetText(int row, int column_id) OVERRIDE; virtual gfx::ImageSkia GetIcon(int row) OVERRIDE; virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; diff --git a/ui/views/controls/textfield/native_textfield_views.cc b/ui/views/controls/textfield/native_textfield_views.cc index f8fc362..7e78dc5 100644 --- a/ui/views/controls/textfield/native_textfield_views.cc +++ b/ui/views/controls/textfield/native_textfield_views.cc @@ -318,7 +318,7 @@ int NativeTextfieldViews::OnPerformDrop(const ui::DropTargetEvent& event) { gfx::SelectionModel drop_destination_model = GetRenderText()->FindCursorPosition(event.location()); - string16 text; + base::string16 text; event.data().GetString(&text); text = GetTextForDisplay(text); @@ -493,7 +493,7 @@ bool NativeTextfieldViews::CanStartDragForView(View* sender, ///////////////////////////////////////////////////////////////// // NativeTextfieldViews, NativeTextifieldWrapper overrides: -string16 NativeTextfieldViews::GetText() const { +base::string16 NativeTextfieldViews::GetText() const { return model_->GetText(); } @@ -505,7 +505,7 @@ void NativeTextfieldViews::UpdateText() { ui::AccessibilityTypes::EVENT_TEXT_CHANGED, true); } -void NativeTextfieldViews::AppendText(const string16& text) { +void NativeTextfieldViews::AppendText(const base::string16& text) { if (text.empty()) return; model_->Append(GetTextForDisplay(text)); @@ -513,7 +513,7 @@ void NativeTextfieldViews::AppendText(const string16& text) { SchedulePaint(); } -void NativeTextfieldViews::InsertOrReplaceText(const string16& text) { +void NativeTextfieldViews::InsertOrReplaceText(const base::string16& text) { if (text.empty()) return; model_->InsertText(text); @@ -525,7 +525,7 @@ base::i18n::TextDirection NativeTextfieldViews::GetTextDirection() const { return GetRenderText()->GetTextDirection(); } -string16 NativeTextfieldViews::GetSelectedText() const { +base::string16 NativeTextfieldViews::GetSelectedText() const { return model_->GetSelectedText(); } @@ -749,7 +749,7 @@ bool NativeTextfieldViews::IsCommandIdEnabled(int command_id) const { return controller->IsCommandIdEnabled(command_id); bool editable = !textfield_->read_only(); - string16 result; + base::string16 result; switch (command_id) { case IDS_APP_UNDO: return editable && model_->CanUndo(); @@ -780,9 +780,11 @@ bool NativeTextfieldViews::IsItemForCommandIdDynamic(int command_id) const { return controller && controller->IsItemForCommandIdDynamic(command_id); } -string16 NativeTextfieldViews::GetLabelForCommandId(int command_id) const { +base::string16 NativeTextfieldViews::GetLabelForCommandId( + int command_id) const { const TextfieldController* controller = textfield_->GetController(); - return controller ? controller->GetLabelForCommandId(command_id) : string16(); + return controller ? controller->GetLabelForCommandId(command_id) : + base::string16(); } void NativeTextfieldViews::ExecuteCommand(int command_id, int event_flags) { @@ -911,7 +913,7 @@ void NativeTextfieldViews::ClearCompositionText() { OnAfterUserAction(); } -void NativeTextfieldViews::InsertText(const string16& text) { +void NativeTextfieldViews::InsertText(const base::string16& text) { // TODO(suzhe): Filter invalid characters. if (GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE || text.empty()) return; @@ -1070,7 +1072,7 @@ bool NativeTextfieldViews::DeleteRange(const gfx::Range& range) { bool NativeTextfieldViews::GetTextFromRange( const gfx::Range& range, - string16* text) const { + base::string16* text) const { if (!ImeEditingAllowed() || !range.IsValid()) return false; @@ -1137,7 +1139,8 @@ gfx::RenderText* NativeTextfieldViews::GetRenderText() const { return model_->render_text(); } -string16 NativeTextfieldViews::GetTextForDisplay(const string16& text) { +base::string16 NativeTextfieldViews::GetTextForDisplay( + const base::string16& text) { return textfield_->style() & Textfield::STYLE_LOWERCASE ? base::i18n::ToLower(text) : text; } @@ -1426,14 +1429,14 @@ bool NativeTextfieldViews::Paste() { if (textfield_->read_only()) return false; - const string16 original_text = GetText(); + const base::string16 original_text = GetText(); const bool success = model_->Paste(); if (success) { // As Paste is handled in model_->Paste(), the RenderText may contain // upper case characters. This is not consistent with other places // which keeps RenderText only containing lower case characters. - string16 new_text = GetTextForDisplay(GetText()); + base::string16 new_text = GetTextForDisplay(GetText()); model_->SetText(new_text); TextfieldController* controller = textfield_->GetController(); diff --git a/ui/views/controls/textfield/native_textfield_views.h b/ui/views/controls/textfield/native_textfield_views.h index e85f44d..a922ea1 100644 --- a/ui/views/controls/textfield/native_textfield_views.h +++ b/ui/views/controls/textfield/native_textfield_views.h @@ -102,12 +102,12 @@ class VIEWS_EXPORT NativeTextfieldViews : public View, const gfx::Point& p) OVERRIDE; // NativeTextfieldWrapper overrides: - virtual string16 GetText() const OVERRIDE; + virtual base::string16 GetText() const OVERRIDE; virtual void UpdateText() OVERRIDE; - virtual void AppendText(const string16& text) OVERRIDE; - virtual void InsertOrReplaceText(const string16& text) OVERRIDE; + virtual void AppendText(const base::string16& text) OVERRIDE; + virtual void InsertOrReplaceText(const base::string16& text) OVERRIDE; virtual base::i18n::TextDirection GetTextDirection() const OVERRIDE; - virtual string16 GetSelectedText() const OVERRIDE; + virtual base::string16 GetSelectedText() const OVERRIDE; virtual void SelectAll(bool reversed) OVERRIDE; virtual void ClearSelection() OVERRIDE; virtual void UpdateBorder() OVERRIDE; @@ -157,7 +157,7 @@ class VIEWS_EXPORT NativeTextfieldViews : public View, int command_id, ui::Accelerator* accelerator) OVERRIDE; virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; - virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; + virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; // class name of internal @@ -176,7 +176,7 @@ class VIEWS_EXPORT NativeTextfieldViews : public View, 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; @@ -192,7 +192,7 @@ class VIEWS_EXPORT NativeTextfieldViews : public View, 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; @@ -210,7 +210,7 @@ class VIEWS_EXPORT NativeTextfieldViews : public View, // Converts |text| according to textfield style, e.g. lower case if // |textfield_| has STYLE_LOWERCASE style. - string16 GetTextForDisplay(const string16& text); + base::string16 GetTextForDisplay(const base::string16& text); // Updates any colors that have not been explicitly set from the theme. void UpdateColorsFromTheme(const ui::NativeTheme* theme); diff --git a/ui/views/controls/textfield/native_textfield_views_unittest.cc b/ui/views/controls/textfield/native_textfield_views_unittest.cc index f351da0..e219383 100644 --- a/ui/views/controls/textfield/native_textfield_views_unittest.cc +++ b/ui/views/controls/textfield/native_textfield_views_unittest.cc @@ -87,11 +87,11 @@ class GetTextHelper { public: GetTextHelper() {} - void set_text(const string16& text) { text_ = text; } - const string16& text() const { return text_; } + void set_text(const base::string16& text) { text_ = text; } + const base::string16& text() const { return text_; } private: - string16 text_; + base::string16 text_; DISALLOW_COPY_AND_ASSIGN(GetTextHelper); }; @@ -142,7 +142,7 @@ class NativeTextfieldViewsTest : public ViewsTestBase, // TextfieldController: virtual void ContentsChanged(Textfield* sender, - const string16& new_contents) OVERRIDE { + const base::string16& new_contents) OVERRIDE { // Paste calls TextfieldController::ContentsChanged() explicitly even if the // paste action did not change the content. So |new_contents| may match // |last_contents_|. For more info, see http://crbug.com/79002 @@ -246,8 +246,8 @@ class NativeTextfieldViewsTest : public ViewsTestBase, } } - string16 GetClipboardText() const { - string16 text; + base::string16 GetClipboardText() const { + base::string16 text; ui::Clipboard::GetForCurrentThread()-> ReadText(ui::CLIPBOARD_TYPE_COPY_PASTE, &text); return text; @@ -338,7 +338,7 @@ class NativeTextfieldViewsTest : public ViewsTestBase, TextfieldViewsModel* model_; // The string from Controller::ContentsChanged callback. - string16 last_contents_; + base::string16 last_contents_; // For testing input method related behaviors. MockInputMethod* input_method_; @@ -370,7 +370,7 @@ TEST_F(NativeTextfieldViewsTest, ModelChangesTest) { EXPECT_STR_EQ("this is a test", textfield_->text()); EXPECT_TRUE(last_contents_.empty()); - EXPECT_EQ(string16(), textfield_->GetSelectedText()); + EXPECT_EQ(base::string16(), textfield_->GetSelectedText()); textfield_->SelectAll(false); EXPECT_STR_EQ("this is a test", textfield_->GetSelectedText()); EXPECT_TRUE(last_contents_.empty()); @@ -577,7 +577,7 @@ TEST_F(NativeTextfieldViewsTest, PasswordTest) { textfield_view_->ExecuteCommand(IDS_APP_COPY, 0); SendKeyEvent(ui::VKEY_C, false, true); SendKeyEvent(ui::VKEY_INSERT, false, true); - EXPECT_STR_EQ("foo", string16(GetClipboardText())); + EXPECT_STR_EQ("foo", base::string16(GetClipboardText())); EXPECT_STR_EQ("password", textfield_->text()); // [Shift]+[Delete] should just delete without copying text to the clipboard. textfield_->SelectAll(false); @@ -588,7 +588,7 @@ TEST_F(NativeTextfieldViewsTest, PasswordTest) { textfield_view_->ExecuteCommand(IDS_APP_PASTE, 0); SendKeyEvent(ui::VKEY_V, false, true); SendKeyEvent(ui::VKEY_INSERT, true, false); - EXPECT_STR_EQ("foo", string16(GetClipboardText())); + EXPECT_STR_EQ("foo", base::string16(GetClipboardText())); EXPECT_STR_EQ("foofoofoo", textfield_->text()); } @@ -671,7 +671,7 @@ TEST_F(NativeTextfieldViewsTest, OnKeyPressReturnValueTest) { textfield_->clear(); // Empty Textfield does not handle left/right. - textfield_->SetText(string16()); + textfield_->SetText(base::string16()); SendKeyEvent(ui::VKEY_LEFT); EXPECT_TRUE(textfield_->key_received()); EXPECT_FALSE(textfield_->key_handled()); @@ -863,11 +863,11 @@ TEST_F(NativeTextfieldViewsTest, DragToSelect) { EXPECT_TRUE(textfield_->GetSelectedText().empty()); // Check that dragging left selects the beginning of the string. textfield_view_->OnMouseDragged(drag_left); - string16 text_left = textfield_->GetSelectedText(); + base::string16 text_left = textfield_->GetSelectedText(); EXPECT_STR_EQ("hello", text_left); // Check that dragging right selects the rest of the string. textfield_view_->OnMouseDragged(drag_right); - string16 text_right = textfield_->GetSelectedText(); + base::string16 text_right = textfield_->GetSelectedText(); EXPECT_STR_EQ(" world", text_right); // Check that releasing in the same location does not alter the selection. textfield_view_->OnMouseReleased(release); @@ -885,7 +885,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) { textfield_->SetText(ASCIIToUTF16("hello world")); ui::OSExchangeData data; - string16 string(ASCIIToUTF16("string ")); + base::string16 string(ASCIIToUTF16("string ")); data.SetString(string); int formats = 0; std::set<OSExchangeData::CustomFormat> custom_formats; @@ -926,7 +926,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) { ui::OSExchangeData::CustomFormat fmt = ui::Clipboard::GetBitmapFormatType(); bad_data.SetPickledData(fmt, Pickle()); bad_data.SetFileContents(base::FilePath(L"x"), "x"); - bad_data.SetHtml(string16(ASCIIToUTF16("x")), GURL("x.org")); + bad_data.SetHtml(base::string16(ASCIIToUTF16("x")), GURL("x.org")); ui::OSExchangeData::DownloadFileInfo download(base::FilePath(), NULL); bad_data.SetDownloadFileInfo(download); #endif @@ -939,7 +939,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_InitiateDrag) { textfield_->SetText(ASCIIToUTF16("hello string world")); // Ensure the textfield will provide selected text for drag data. - string16 string; + base::string16 string; ui::OSExchangeData data; const gfx::Range kStringRange(6, 12); textfield_->SelectRange(kStringRange); @@ -985,7 +985,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_ToTheRight) { InitTextfield(Textfield::STYLE_DEFAULT); textfield_->SetText(ASCIIToUTF16("hello world")); - string16 string; + base::string16 string; ui::OSExchangeData data; int formats = 0; int operations = 0; @@ -1040,7 +1040,7 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_ToTheLeft) { InitTextfield(Textfield::STYLE_DEFAULT); textfield_->SetText(ASCIIToUTF16("hello world")); - string16 string; + base::string16 string; ui::OSExchangeData data; int formats = 0; int operations = 0; @@ -1149,7 +1149,7 @@ TEST_F(NativeTextfieldViewsTest, ReadOnlyTest) { textfield_view_->ExecuteCommand(IDS_APP_CUT, 0); SendKeyEvent(ui::VKEY_X, false, true); SendKeyEvent(ui::VKEY_DELETE, true, false); - EXPECT_STR_EQ("Test", string16(GetClipboardText())); + EXPECT_STR_EQ("Test", base::string16(GetClipboardText())); EXPECT_STR_EQ("read only", textfield_->text()); // Paste should be disabled. @@ -1163,13 +1163,13 @@ TEST_F(NativeTextfieldViewsTest, ReadOnlyTest) { SetClipboardText("Test"); EXPECT_TRUE(textfield_view_->IsCommandIdEnabled(IDS_APP_COPY)); textfield_view_->ExecuteCommand(IDS_APP_COPY, 0); - EXPECT_STR_EQ("read only", string16(GetClipboardText())); + EXPECT_STR_EQ("read only", base::string16(GetClipboardText())); SetClipboardText("Test"); SendKeyEvent(ui::VKEY_C, false, true); - EXPECT_STR_EQ("read only", string16(GetClipboardText())); + EXPECT_STR_EQ("read only", base::string16(GetClipboardText())); SetClipboardText("Test"); SendKeyEvent(ui::VKEY_INSERT, false, true); - EXPECT_STR_EQ("read only", string16(GetClipboardText())); + EXPECT_STR_EQ("read only", base::string16(GetClipboardText())); // SetText should work even in read only mode. textfield_->SetText(ASCIIToUTF16(" four five six ")); @@ -1206,7 +1206,7 @@ TEST_F(NativeTextfieldViewsTest, TextInputClientTest) { // This code can't be compiled because of a bug in base::Callback. #if 0 GetTextHelper helper; - base::Callback<void(string16)> callback = + base::Callback<void(base::string16)> callback = base::Bind(&GetTextHelper::set_text, base::Unretained(&helper)); EXPECT_TRUE(client->GetTextFromRange(range, callback)); @@ -1395,24 +1395,24 @@ TEST_F(NativeTextfieldViewsTest, CutCopyPaste) { textfield_->SelectAll(false); EXPECT_TRUE(textfield_view_->IsCommandIdEnabled(IDS_APP_CUT)); textfield_view_->ExecuteCommand(IDS_APP_CUT, 0); - EXPECT_STR_EQ("123", string16(GetClipboardText())); + EXPECT_STR_EQ("123", base::string16(GetClipboardText())); EXPECT_STR_EQ("", textfield_->text()); // Ensure [Ctrl]+[x] cuts and [Ctrl]+[Alt][x] does nothing. textfield_->SetText(ASCIIToUTF16("456")); textfield_->SelectAll(false); SendKeyEvent(ui::VKEY_X, true, false, true, false); - EXPECT_STR_EQ("123", string16(GetClipboardText())); + EXPECT_STR_EQ("123", base::string16(GetClipboardText())); EXPECT_STR_EQ("456", textfield_->text()); SendKeyEvent(ui::VKEY_X, false, true); - EXPECT_STR_EQ("456", string16(GetClipboardText())); + EXPECT_STR_EQ("456", base::string16(GetClipboardText())); EXPECT_STR_EQ("", textfield_->text()); // Ensure [Shift]+[Delete] cuts. textfield_->SetText(ASCIIToUTF16("123")); textfield_->SelectAll(false); SendKeyEvent(ui::VKEY_DELETE, true, false); - EXPECT_STR_EQ("123", string16(GetClipboardText())); + EXPECT_STR_EQ("123", base::string16(GetClipboardText())); EXPECT_STR_EQ("", textfield_->text()); // Ensure IDS_APP_COPY copies. @@ -1420,27 +1420,27 @@ TEST_F(NativeTextfieldViewsTest, CutCopyPaste) { textfield_->SelectAll(false); EXPECT_TRUE(textfield_view_->IsCommandIdEnabled(IDS_APP_COPY)); textfield_view_->ExecuteCommand(IDS_APP_COPY, 0); - EXPECT_STR_EQ("789", string16(GetClipboardText())); + EXPECT_STR_EQ("789", base::string16(GetClipboardText())); // Ensure [Ctrl]+[c] copies and [Ctrl]+[Alt][c] does nothing. textfield_->SetText(ASCIIToUTF16("012")); textfield_->SelectAll(false); SendKeyEvent(ui::VKEY_C, true, false, true, false); - EXPECT_STR_EQ("789", string16(GetClipboardText())); + EXPECT_STR_EQ("789", base::string16(GetClipboardText())); SendKeyEvent(ui::VKEY_C, false, true); - EXPECT_STR_EQ("012", string16(GetClipboardText())); + EXPECT_STR_EQ("012", base::string16(GetClipboardText())); // Ensure [Ctrl]+[Insert] copies. textfield_->SetText(ASCIIToUTF16("345")); textfield_->SelectAll(false); SendKeyEvent(ui::VKEY_INSERT, false, true); - EXPECT_STR_EQ("345", string16(GetClipboardText())); + EXPECT_STR_EQ("345", base::string16(GetClipboardText())); EXPECT_STR_EQ("345", textfield_->text()); // Ensure IDS_APP_PASTE, [Ctrl]+[V], and [Shift]+[Insert] pastes; // also ensure that [Ctrl]+[Alt]+[V] does nothing. SetClipboardText("abc"); - textfield_->SetText(string16()); + textfield_->SetText(base::string16()); EXPECT_TRUE(textfield_view_->IsCommandIdEnabled(IDS_APP_PASTE)); textfield_view_->ExecuteCommand(IDS_APP_PASTE, 0); EXPECT_STR_EQ("abc", textfield_->text()); @@ -1454,7 +1454,7 @@ TEST_F(NativeTextfieldViewsTest, CutCopyPaste) { // Ensure [Ctrl]+[Shift]+[Insert] is a no-op. textfield_->SelectAll(false); SendKeyEvent(ui::VKEY_INSERT, true, true); - EXPECT_STR_EQ("abc", string16(GetClipboardText())); + EXPECT_STR_EQ("abc", base::string16(GetClipboardText())); EXPECT_STR_EQ("abcabcabc", textfield_->text()); } @@ -1704,7 +1704,7 @@ TEST_F(NativeTextfieldViewsTest, HitOutsideTextAreaInRTLTest) { TEST_F(NativeTextfieldViewsTest, OverflowTest) { InitTextfield(Textfield::STYLE_DEFAULT); - string16 str; + base::string16 str; for (int i = 0; i < 500; ++i) SendKeyEvent('a'); SendKeyEvent(kHebrewLetterSamekh); @@ -1733,7 +1733,7 @@ TEST_F(NativeTextfieldViewsTest, OverflowInRTLTest) { InitTextfield(Textfield::STYLE_DEFAULT); - string16 str; + base::string16 str; for (int i = 0; i < 500; ++i) SendKeyEvent('a'); SendKeyEvent(kHebrewLetterSamekh); @@ -1761,7 +1761,7 @@ TEST_F(NativeTextfieldViewsTest, OverflowInRTLTest) { TEST_F(NativeTextfieldViewsTest, GetCompositionCharacterBoundsTest) { InitTextfield(Textfield::STYLE_DEFAULT); - string16 str; + base::string16 str; const uint32 char_count = 10UL; ui::CompositionText composition; composition.text = UTF8ToUTF16("0123456789"); diff --git a/ui/views/controls/textfield/native_textfield_wrapper.h b/ui/views/controls/textfield/native_textfield_wrapper.h index eafd2f5..6bd7219 100644 --- a/ui/views/controls/textfield/native_textfield_wrapper.h +++ b/ui/views/controls/textfield/native_textfield_wrapper.h @@ -37,23 +37,23 @@ class VIEWS_EXPORT NativeTextfieldWrapper { virtual ~NativeTextfieldWrapper() {} // Gets the text displayed in the wrapped native text field. - virtual string16 GetText() const = 0; + virtual base::string16 GetText() const = 0; // Updates the text displayed with the text held by the Textfield. virtual void UpdateText() = 0; // Adds the specified text to the text already displayed by the wrapped native // text field. - virtual void AppendText(const string16& text) = 0; + virtual void AppendText(const base::string16& text) = 0; // Inserts |text| at the current cursor position, replacing any selected text. - virtual void InsertOrReplaceText(const string16& text) = 0; + virtual void InsertOrReplaceText(const base::string16& text) = 0; // Returns the text direction. virtual base::i18n::TextDirection GetTextDirection() const = 0; // Gets the text that is selected in the wrapped native text field. - virtual string16 GetSelectedText() const = 0; + virtual base::string16 GetSelectedText() const = 0; // Select the entire text range. If |reversed| is true, the range will end at // the logical beginning of the text; this generally shows the leading portion diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc index de590dc..fa41ce1 100644 --- a/ui/views/controls/textfield/textfield.cc +++ b/ui/views/controls/textfield/textfield.cc @@ -163,19 +163,19 @@ void Textfield::SetTextInputType(ui::TextInputType type) { SetObscured(should_be_obscured); } -void Textfield::SetText(const string16& text) { +void Textfield::SetText(const base::string16& text) { text_ = text; if (native_wrapper_) native_wrapper_->UpdateText(); } -void Textfield::AppendText(const string16& text) { +void Textfield::AppendText(const base::string16& text) { text_ += text; if (native_wrapper_) native_wrapper_->AppendText(text); } -void Textfield::InsertOrReplaceText(const string16& text) { +void Textfield::InsertOrReplaceText(const base::string16& text) { if (native_wrapper_) { native_wrapper_->InsertOrReplaceText(text); text_ = native_wrapper_->GetText(); @@ -192,8 +192,9 @@ void Textfield::SelectAll(bool reversed) { native_wrapper_->SelectAll(reversed); } -string16 Textfield::GetSelectedText() const { - return native_wrapper_ ? native_wrapper_->GetSelectedText() : string16(); +base::string16 Textfield::GetSelectedText() const { + return native_wrapper_ ? native_wrapper_->GetSelectedText() : + base::string16(); } void Textfield::ClearSelection() const { @@ -345,7 +346,7 @@ void Textfield::UpdateAllProperties() { void Textfield::SyncText() { if (native_wrapper_) { - string16 new_text = native_wrapper_->GetText(); + base::string16 new_text = native_wrapper_->GetText(); if (new_text != text_) { text_ = new_text; if (controller_) @@ -400,7 +401,7 @@ void Textfield::ClearEditHistory() { native_wrapper_->ClearEditHistory(); } -void Textfield::SetAccessibleName(const string16& name) { +void Textfield::SetAccessibleName(const base::string16& name) { accessible_name_ = name; } @@ -559,7 +560,7 @@ gfx::Insets Textfield::GetTextInsets() const { return insets; } -void Textfield::AccessibilitySetValue(const string16& new_value) { +void Textfield::AccessibilitySetValue(const base::string16& new_value) { if (!read_only()) { SetText(new_value); ClearSelection(); diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h index 307e562..e76f866 100644 --- a/ui/views/controls/textfield/textfield.h +++ b/ui/views/controls/textfield/textfield.h @@ -90,25 +90,25 @@ class VIEWS_EXPORT Textfield : public View { void SetTextInputType(ui::TextInputType type); // Gets/Sets the text currently displayed in the Textfield. - const string16& text() const { return text_; } + const base::string16& text() const { return text_; } // Sets the text currently displayed in the Textfield. This doesn't // change the cursor position if the current cursor is within the // new text's range, or moves the cursor to the end if the cursor is // out of the new text's range. - void SetText(const string16& text); + void SetText(const base::string16& text); // Appends the given string to the previously-existing text in the field. - void AppendText(const string16& text); + void AppendText(const base::string16& text); // Inserts |text| at the current cursor position, replacing any selected text. - void InsertOrReplaceText(const string16& text); + void InsertOrReplaceText(const base::string16& text); // Returns the text direction. base::i18n::TextDirection GetTextDirection() const; // Returns the text that is currently selected. - string16 GetSelectedText() const; + base::string16 GetSelectedText() const; // Select the entire text range. If |reversed| is true, the range will end at // the logical beginning of the text; this generally shows the leading portion @@ -165,7 +165,7 @@ class VIEWS_EXPORT Textfield : public View { void RemoveBorder(); // Sets the text to display when empty. - void set_placeholder_text(const string16& text) { + void set_placeholder_text(const base::string16& text) { placeholder_text_ = text; } virtual base::string16 GetPlaceholderText() const; @@ -235,7 +235,7 @@ class VIEWS_EXPORT Textfield : public View { void ClearEditHistory(); // Set the accessible name of the text field. - void SetAccessibleName(const string16& name); + void SetAccessibleName(const base::string16& name); // Performs the action associated with the specified command id. void ExecuteCommand(int command_id); @@ -285,7 +285,7 @@ class VIEWS_EXPORT Textfield : public View { // Handles a request to change the value of this text field from software // using an accessibility API (typically automation software, screen readers // don't normally use this). Sets the value and clears the selection. - void AccessibilitySetValue(const string16& new_value); + void AccessibilitySetValue(const base::string16& new_value); // This is the current listener for events from this Textfield. TextfieldController* controller_; @@ -297,7 +297,7 @@ class VIEWS_EXPORT Textfield : public View { gfx::FontList font_list_; // The text displayed in the Textfield. - string16 text_; + base::string16 text_; // True if this Textfield cannot accept input and is read-only. bool read_only_; @@ -329,13 +329,13 @@ class VIEWS_EXPORT Textfield : public View { bool vertical_margins_were_set_; // Text to display when empty. - string16 placeholder_text_; + base::string16 placeholder_text_; // Placeholder text color. SkColor placeholder_text_color_; // The accessible name of the text field. - string16 accessible_name_; + base::string16 accessible_name_; // The input type of this text field. ui::TextInputType text_input_type_; diff --git a/ui/views/controls/textfield/textfield_controller.cc b/ui/views/controls/textfield/textfield_controller.cc index 8f72be8..e825796 100644 --- a/ui/views/controls/textfield/textfield_controller.cc +++ b/ui/views/controls/textfield/textfield_controller.cc @@ -31,8 +31,8 @@ bool TextfieldController::IsItemForCommandIdDynamic(int command_id) const { return false; } -string16 TextfieldController::GetLabelForCommandId(int command_id) const { - return string16(); +base::string16 TextfieldController::GetLabelForCommandId(int command_id) const { + return base::string16(); } bool TextfieldController::HandlesCommand(int command_id) const { diff --git a/ui/views/controls/textfield/textfield_controller.h b/ui/views/controls/textfield/textfield_controller.h index d72442b..bebec1c 100644 --- a/ui/views/controls/textfield/textfield_controller.h +++ b/ui/views/controls/textfield/textfield_controller.h @@ -29,7 +29,7 @@ class VIEWS_EXPORT TextfieldController { // user. It won't be called if the text is changed by calling // Textfield::SetText() or Textfield::AppendText(). virtual void ContentsChanged(Textfield* sender, - const string16& new_contents) {} + const base::string16& new_contents) {} // This method is called to get notified about keystrokes in the edit. // Returns true if the message was handled and should not be processed @@ -87,7 +87,7 @@ class VIEWS_EXPORT TextfieldController { virtual bool IsItemForCommandIdDynamic(int command_id) const; // Returns the label string for the |coomand_id|. - virtual string16 GetLabelForCommandId(int command_id) const; + virtual base::string16 GetLabelForCommandId(int command_id) const; // Returns whether the controller handles the specified command. This is used // to handle a command the textfield would normally handle. For example, to diff --git a/ui/views/controls/textfield/textfield_views_model.cc b/ui/views/controls/textfield/textfield_views_model.cc index 222d086..6179e8f 100644 --- a/ui/views/controls/textfield/textfield_views_model.cc +++ b/ui/views/controls/textfield/textfield_views_model.cc @@ -81,11 +81,11 @@ class Edit { Edit(Type type, MergeType merge_type, size_t old_cursor_pos, - const string16& old_text, + const base::string16& old_text, size_t old_text_start, bool delete_backward, size_t new_cursor_pos, - const string16& new_text, + const base::string16& new_text, size_t new_text_start) : type_(type), merge_type_(merge_type), @@ -125,7 +125,7 @@ class Edit { CHECK_EQ(REPLACE_EDIT, edit->type_); CHECK_EQ(0U, edit->old_text_start_); CHECK_EQ(0U, edit->new_text_start_); - string16 old_text = edit->old_text_; + base::string16 old_text = edit->old_text_; old_text.erase(new_text_start_, new_text_.length()); old_text.insert(old_text_start_, old_text_); // SetText() replaces entire text. Set |old_text_| to the entire @@ -146,7 +146,7 @@ class Edit { // Old cursor position. size_t old_cursor_pos_; // Deleted text by this edit. - string16 old_text_; + base::string16 old_text_; // The index of |old_text_|. size_t old_text_start_; // True if the deletion is made backward. @@ -154,7 +154,7 @@ class Edit { // New cursor position. size_t new_cursor_pos_; // Added text. - string16 new_text_; + base::string16 new_text_; // The index of |new_text_| size_t new_text_start_; @@ -163,11 +163,11 @@ class Edit { class InsertEdit : public Edit { public: - InsertEdit(bool mergeable, const string16& new_text, size_t at) + InsertEdit(bool mergeable, const base::string16& new_text, size_t at) : Edit(INSERT_EDIT, mergeable ? MERGEABLE : DO_NOT_MERGE, at /* old cursor */, - string16(), + base::string16(), at, false /* N/A */, at + new_text.length() /* new cursor */, @@ -191,12 +191,12 @@ class InsertEdit : public Edit { class ReplaceEdit : public Edit { public: ReplaceEdit(MergeType merge_type, - const string16& old_text, + const base::string16& old_text, size_t old_cursor_pos, size_t old_text_start, bool backward, size_t new_cursor_pos, - const string16& new_text, + const base::string16& new_text, size_t new_text_start) : Edit(REPLACE_EDIT, merge_type, old_cursor_pos, @@ -224,7 +224,7 @@ class ReplaceEdit : public Edit { class DeleteEdit : public Edit { public: DeleteEdit(bool mergeable, - const string16& text, + const base::string16& text, size_t text_start, bool backward) : Edit(DELETE_EDIT, @@ -234,7 +234,7 @@ class DeleteEdit : public Edit { text_start, backward, text_start, - string16(), + base::string16(), text_start) { } @@ -306,11 +306,11 @@ TextfieldViewsModel::~TextfieldViewsModel() { ClearComposition(); } -const string16& TextfieldViewsModel::GetText() const { +const base::string16& TextfieldViewsModel::GetText() const { return render_text_->text(); } -bool TextfieldViewsModel::SetText(const string16& text) { +bool TextfieldViewsModel::SetText(const base::string16& text) { bool changed = false; if (HasCompositionText()) { ConfirmCompositionText(); @@ -337,7 +337,7 @@ bool TextfieldViewsModel::SetText(const string16& text) { return changed; } -void TextfieldViewsModel::Append(const string16& text) { +void TextfieldViewsModel::Append(const base::string16& text) { if (HasCompositionText()) ConfirmCompositionText(); size_t save = GetCursorPosition(); @@ -423,7 +423,7 @@ bool TextfieldViewsModel::MoveCursorTo(const gfx::Point& point, bool select) { return render_text_->MoveCursorTo(point, select); } -string16 TextfieldViewsModel::GetSelectedText() const { +base::string16 TextfieldViewsModel::GetSelectedText() const { return GetText().substr(render_text_->selection().GetMin(), render_text_->selection().length()); } @@ -479,7 +479,7 @@ bool TextfieldViewsModel::Undo() { if (HasCompositionText()) // safe guard for release build. CancelCompositionText(); - string16 old = GetText(); + base::string16 old = GetText(); size_t old_cursor = GetCursorPosition(); (*current_edit_)->Commit(); (*current_edit_)->Undo(this); @@ -502,7 +502,7 @@ bool TextfieldViewsModel::Redo() { current_edit_ = edit_history_.begin(); else current_edit_ ++; - string16 old = GetText(); + base::string16 old = GetText(); size_t old_cursor = GetCursorPosition(); (*current_edit_)->Redo(this); return old != GetText() || old_cursor != GetCursorPosition(); @@ -537,7 +537,7 @@ bool TextfieldViewsModel::Copy() { } bool TextfieldViewsModel::Paste() { - string16 result; + base::string16 result; ui::Clipboard::GetForCurrentThread()->ReadText(ui::CLIPBOARD_TYPE_COPY_PASTE, &result); if (!result.empty()) { @@ -558,7 +558,7 @@ void TextfieldViewsModel::DeleteSelection() { } void TextfieldViewsModel::DeleteSelectionAndInsertTextAt( - const string16& text, size_t position) { + const base::string16& text, size_t position) { if (HasCompositionText()) CancelCompositionText(); ExecuteAndRecordReplace(DO_NOT_MERGE, @@ -568,10 +568,11 @@ void TextfieldViewsModel::DeleteSelectionAndInsertTextAt( position); } -string16 TextfieldViewsModel::GetTextFromRange(const gfx::Range& range) const { +base::string16 TextfieldViewsModel::GetTextFromRange( + const gfx::Range& range) const { if (range.IsValid() && range.GetMin() < GetText().length()) return GetText().substr(range.GetMin(), range.length()); - return string16(); + return base::string16(); } void TextfieldViewsModel::GetTextRange(gfx::Range* range) const { @@ -589,7 +590,7 @@ void TextfieldViewsModel::SetCompositionText( return; size_t cursor = GetCursorPosition(); - string16 new_text = GetText(); + base::string16 new_text = GetText(); render_text_->SetText(new_text.insert(cursor, composition.text)); gfx::Range range(cursor, cursor + composition.text.length()); render_text_->SetCompositionRange(range); @@ -618,7 +619,7 @@ void TextfieldViewsModel::SetCompositionText( void TextfieldViewsModel::ConfirmCompositionText() { DCHECK(HasCompositionText()); gfx::Range range = render_text_->GetCompositionRange(); - string16 text = GetText().substr(range.start(), range.length()); + base::string16 text = GetText().substr(range.start(), range.length()); // TODO(oshima): current behavior on ChromeOS is a bit weird and not // sure exactly how this should work. Find out and fix if necessary. AddOrMergeEditHistory(new InsertEdit(false, text, range.start())); @@ -632,7 +633,7 @@ void TextfieldViewsModel::CancelCompositionText() { DCHECK(HasCompositionText()); gfx::Range range = render_text_->GetCompositionRange(); ClearComposition(); - string16 new_text = GetText(); + base::string16 new_text = GetText(); render_text_->SetText(new_text.erase(range.start(), range.length())); render_text_->SetCursorPosition(range.start()); if (delegate_) @@ -654,7 +655,7 @@ bool TextfieldViewsModel::HasCompositionText() const { ///////////////////////////////////////////////////////////////// // TextfieldViewsModel: private -void TextfieldViewsModel::InsertTextInternal(const string16& text, +void TextfieldViewsModel::InsertTextInternal(const base::string16& text, bool mergeable) { if (HasCompositionText()) { CancelCompositionText(); @@ -667,7 +668,7 @@ void TextfieldViewsModel::InsertTextInternal(const string16& text, } } -void TextfieldViewsModel::ReplaceTextInternal(const string16& text, +void TextfieldViewsModel::ReplaceTextInternal(const base::string16& text, bool mergeable) { if (HasCompositionText()) { CancelCompositionText(); @@ -708,7 +709,7 @@ void TextfieldViewsModel::ClearRedoHistory() { void TextfieldViewsModel::ExecuteAndRecordDelete(gfx::Range range, bool mergeable) { size_t old_text_start = range.GetMin(); - const string16 text = GetText().substr(old_text_start, range.length()); + const base::string16 text = GetText().substr(old_text_start, range.length()); bool backward = range.is_reversed(); Edit* edit = new DeleteEdit(mergeable, text, old_text_start, backward); bool delete_edit = AddOrMergeEditHistory(edit); @@ -718,7 +719,7 @@ void TextfieldViewsModel::ExecuteAndRecordDelete(gfx::Range range, } void TextfieldViewsModel::ExecuteAndRecordReplaceSelection( - MergeType merge_type, const string16& new_text) { + MergeType merge_type, const base::string16& new_text) { size_t new_text_start = render_text_->selection().GetMin(); size_t new_cursor_pos = new_text_start + new_text.length(); ExecuteAndRecordReplace(merge_type, @@ -728,11 +729,12 @@ void TextfieldViewsModel::ExecuteAndRecordReplaceSelection( new_text_start); } -void TextfieldViewsModel::ExecuteAndRecordReplace(MergeType merge_type, - size_t old_cursor_pos, - size_t new_cursor_pos, - const string16& new_text, - size_t new_text_start) { +void TextfieldViewsModel::ExecuteAndRecordReplace( + MergeType merge_type, + size_t old_cursor_pos, + size_t new_cursor_pos, + const base::string16& new_text, + size_t new_text_start) { size_t old_text_start = render_text_->selection().GetMin(); bool backward = render_text_->selection().is_reversed(); Edit* edit = new ReplaceEdit(merge_type, @@ -749,7 +751,7 @@ void TextfieldViewsModel::ExecuteAndRecordReplace(MergeType merge_type, delete edit; } -void TextfieldViewsModel::ExecuteAndRecordInsert(const string16& text, +void TextfieldViewsModel::ExecuteAndRecordInsert(const base::string16& text, bool mergeable) { Edit* edit = new InsertEdit(mergeable, text, GetCursorPosition()); bool delete_edit = AddOrMergeEditHistory(edit); @@ -781,11 +783,11 @@ bool TextfieldViewsModel::AddOrMergeEditHistory(Edit* edit) { void TextfieldViewsModel::ModifyText(size_t delete_from, size_t delete_to, - const string16& new_text, + const base::string16& new_text, size_t new_text_insert_at, size_t new_cursor_pos) { DCHECK_LE(delete_from, delete_to); - string16 text = GetText(); + base::string16 text = GetText(); ClearComposition(); if (delete_from != delete_to) render_text_->SetText(text.erase(delete_from, delete_to - delete_from)); diff --git a/ui/views/controls/textfield/textfield_views_model.h b/ui/views/controls/textfield/textfield_views_model.h index 1af7340..4e625c4d 100644 --- a/ui/views/controls/textfield/textfield_views_model.h +++ b/ui/views/controls/textfield/textfield_views_model.h @@ -64,42 +64,42 @@ class VIEWS_EXPORT TextfieldViewsModel { // Edit related methods. - const string16& GetText() const; + const base::string16& GetText() const; // Sets the text. Returns true if the text has been modified. The // current composition text will be confirmed first. Setting // the same text will not add edit history because it's not user // visible change nor user-initiated change. This allow a client // code to set the same text multiple times without worrying about // messing edit history. - bool SetText(const string16& text); + bool SetText(const base::string16& text); gfx::RenderText* render_text() { return render_text_.get(); } // Inserts given |text| at the current cursor position. // The current composition text will be cleared. - void InsertText(const string16& text) { + void InsertText(const base::string16& text) { InsertTextInternal(text, false); } // Inserts a character at the current cursor position. void InsertChar(char16 c) { - InsertTextInternal(string16(&c, 1), true); + InsertTextInternal(base::string16(&c, 1), true); } // Replaces characters at the current position with characters in given text. // The current composition text will be cleared. - void ReplaceText(const string16& text) { + void ReplaceText(const base::string16& text) { ReplaceTextInternal(text, false); } // Replaces the char at the current position with given character. void ReplaceChar(char16 c) { - ReplaceTextInternal(string16(&c, 1), true); + ReplaceTextInternal(base::string16(&c, 1), true); } // Appends the text. // The current composition text will be confirmed. - void Append(const string16& text); + void Append(const base::string16& text); // Deletes the first character after the current cursor position (as if, the // the user has pressed delete key in the textfield). Returns true if @@ -136,7 +136,7 @@ class VIEWS_EXPORT TextfieldViewsModel { // Selection related method // Returns the selected text. - string16 GetSelectedText() const; + base::string16 GetSelectedText() const; // The current composition text will be confirmed. The selection starts with // the range's start position, and ends with the range's end position, @@ -198,10 +198,10 @@ class VIEWS_EXPORT TextfieldViewsModel { // Deletes the selected text (if any) and insert text at given // position. void DeleteSelectionAndInsertTextAt( - const string16& text, size_t position); + const base::string16& text, size_t position); // Retrieves the text content in a given range. - string16 GetTextFromRange(const gfx::Range& range) const; + base::string16 GetTextFromRange(const gfx::Range& range) const; // Retrieves the range containing all text in the model. void GetTextRange(gfx::Range* range) const; @@ -241,12 +241,12 @@ class VIEWS_EXPORT TextfieldViewsModel { // Insert the given |text|. |mergeable| indicates if this insert // operation can be merged to previous edit in the edit history. - void InsertTextInternal(const string16& text, bool mergeable); + void InsertTextInternal(const base::string16& text, bool mergeable); // Replace the current text with the given |text|. |mergeable| // indicates if this replace operation can be merged to previous // edit in the edit history. - void ReplaceTextInternal(const string16& text, bool mergeable); + void ReplaceTextInternal(const base::string16& text, bool mergeable); // Clears all edit history. void ClearEditHistory(); @@ -257,13 +257,13 @@ class VIEWS_EXPORT TextfieldViewsModel { // Executes and records edit operations. void ExecuteAndRecordDelete(gfx::Range range, bool mergeable); void ExecuteAndRecordReplaceSelection(internal::MergeType merge_type, - const string16& text); + const base::string16& text); void ExecuteAndRecordReplace(internal::MergeType merge_type, size_t old_cursor_pos, size_t new_cursor_pos, - const string16& text, + const base::string16& text, size_t new_text_start); - void ExecuteAndRecordInsert(const string16& text, bool mergeable); + void ExecuteAndRecordInsert(const base::string16& text, bool mergeable); // Adds or merge |edit| into edit history. Return true if the edit // has been merged and must be deleted after redo. @@ -276,7 +276,7 @@ class VIEWS_EXPORT TextfieldViewsModel { // 3) Move the cursor to |new_cursor_pos|. void ModifyText(size_t delete_from, size_t delete_to, - const string16& new_text, + const base::string16& new_text, size_t new_text_insert_at, size_t new_cursor_pos); diff --git a/ui/views/controls/textfield/textfield_views_model_unittest.cc b/ui/views/controls/textfield/textfield_views_model_unittest.cc index b23fb10..1c6734c 100644 --- a/ui/views/controls/textfield/textfield_views_model_unittest.cc +++ b/ui/views/controls/textfield/textfield_views_model_unittest.cc @@ -56,7 +56,7 @@ class TextfieldViewsModelTest : public ViewsTestBase, protected: void ResetModel(TextfieldViewsModel* model) const { - model->SetText(string16()); + model->SetText(base::string16()); model->ClearEditHistory(); } @@ -243,15 +243,15 @@ TEST_F(TextfieldViewsModelTest, EditString_ComplexScript) { TEST_F(TextfieldViewsModelTest, EmptyString) { TextfieldViewsModel model(NULL); - EXPECT_EQ(string16(), model.GetText()); - EXPECT_EQ(string16(), model.GetSelectedText()); + EXPECT_EQ(base::string16(), model.GetText()); + EXPECT_EQ(base::string16(), model.GetSelectedText()); model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_LEFT, true); EXPECT_EQ(0U, model.GetCursorPosition()); model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_RIGHT, true); EXPECT_EQ(0U, model.GetCursorPosition()); - EXPECT_EQ(string16(), model.GetSelectedText()); + EXPECT_EQ(base::string16(), model.GetSelectedText()); EXPECT_FALSE(model.Delete()); EXPECT_FALSE(model.Backspace()); @@ -271,7 +271,7 @@ TEST_F(TextfieldViewsModelTest, Selection) { model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, true); EXPECT_STR_EQ("ELLO", model.GetSelectedText()); model.ClearSelection(); - EXPECT_EQ(string16(), model.GetSelectedText()); + EXPECT_EQ(base::string16(), model.GetSelectedText()); // SelectAll(false) selects towards the end. model.SelectAll(false); @@ -336,7 +336,7 @@ TEST_F(TextfieldViewsModelTest, Selection_BidiWithNonSpacingMarks) { model.GetSelectedText()); model.ClearSelection(); - EXPECT_EQ(string16(), model.GetSelectedText()); + EXPECT_EQ(base::string16(), model.GetSelectedText()); model.SelectAll(false); EXPECT_EQ(WideToUTF16(L"abc\x05E9\x05BC\x05C1\x05B8\x05E0\x05B8" L"def"), model.GetSelectedText()); @@ -379,7 +379,7 @@ TEST_F(TextfieldViewsModelTest, Selection_BidiWithNonSpacingMarks) { EXPECT_EQ(WideToUTF16(L"\x05E9" L"b"), model.GetSelectedText()); model.ClearSelection(); - EXPECT_EQ(string16(), model.GetSelectedText()); + EXPECT_EQ(base::string16(), model.GetSelectedText()); model.SelectAll(false); EXPECT_EQ(WideToUTF16(L"a\x05E9" L"b"), model.GetSelectedText()); } @@ -456,7 +456,7 @@ TEST_F(TextfieldViewsModelTest, Word) { model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_LEFT, true); EXPECT_STR_EQ("The answer to Life", model.GetSelectedText()); model.ReplaceChar('4'); - EXPECT_EQ(string16(), model.GetSelectedText()); + EXPECT_EQ(base::string16(), model.GetSelectedText()); EXPECT_STR_EQ("42", model.GetText()); } @@ -476,18 +476,18 @@ TEST_F(TextfieldViewsModelTest, SetText) { model.SetText(ASCIIToUTF16("BYE")); // Setting shorter string moves the cursor to the end of the new string. EXPECT_EQ(3U, model.GetCursorPosition()); - EXPECT_EQ(string16(), model.GetSelectedText()); - model.SetText(string16()); + EXPECT_EQ(base::string16(), model.GetSelectedText()); + model.SetText(base::string16()); EXPECT_EQ(0U, model.GetCursorPosition()); } TEST_F(TextfieldViewsModelTest, Clipboard) { ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); - const string16 initial_clipboard_text = ASCIIToUTF16("initial text"); + const base::string16 initial_clipboard_text = ASCIIToUTF16("initial text"); ui::ScopedClipboardWriter(clipboard, ui::CLIPBOARD_TYPE_COPY_PASTE). WriteText(initial_clipboard_text); - string16 clipboard_text; + base::string16 clipboard_text; TextfieldViewsModel model(NULL); model.Append(ASCIIToUTF16("HELLO WORLD")); @@ -552,8 +552,10 @@ TEST_F(TextfieldViewsModelTest, Clipboard) { EXPECT_EQ(18U, model.GetCursorPosition()); } -static void SelectWordTestVerifier(const TextfieldViewsModel& model, - const string16 &expected_selected_string, size_t expected_cursor_pos) { +static void SelectWordTestVerifier( + const TextfieldViewsModel& model, + const base::string16 &expected_selected_string, + size_t expected_cursor_pos) { EXPECT_EQ(expected_selected_string, model.GetSelectedText()); EXPECT_EQ(expected_cursor_pos, model.GetCursorPosition()); } @@ -913,7 +915,7 @@ TEST_F(TextfieldViewsModelTest, CompositionTextTest) { composition_text_confirmed_or_cleared_ = false; EXPECT_STR_EQ("1234567890-678-", model.GetText()); - model.SetText(string16()); + model.SetText(base::string16()); model.SetCompositionText(composition); model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_LEFT, false); EXPECT_TRUE(composition_text_confirmed_or_cleared_); @@ -934,7 +936,7 @@ TEST_F(TextfieldViewsModelTest, CompositionTextTest) { composition_text_confirmed_or_cleared_ = false; EXPECT_STR_EQ("676788678", model.GetText()); - model.SetText(string16()); + model.SetText(base::string16()); model.SetCompositionText(composition); model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, false); EXPECT_TRUE(composition_text_confirmed_or_cleared_); diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc index 2c7bd55..3bed127 100644 --- a/ui/views/controls/tree/tree_view.cc +++ b/ui/views/controls/tree/tree_view.cc @@ -482,7 +482,7 @@ void TreeView::TreeNodeChanged(TreeModel* model, TreeModelNode* model_node) { } void TreeView::ContentsChanged(Textfield* sender, - const string16& new_contents) { + const base::string16& new_contents) { } bool TreeView::HandleKeyEvent(Textfield* sender, @@ -525,7 +525,7 @@ void TreeView::SetSelectedRow(int row) { SetSelectedNode(GetNodeForRow(row)); } -string16 TreeView::GetTextForRow(int row) { +base::string16 TreeView::GetTextForRow(int row) { return GetNodeForRow(row)->GetTitle(); } diff --git a/ui/views/controls/tree/tree_view.h b/ui/views/controls/tree/tree_view.h index de571c7..b7a4eca 100644 --- a/ui/views/controls/tree/tree_view.h +++ b/ui/views/controls/tree/tree_view.h @@ -141,7 +141,7 @@ class VIEWS_EXPORT TreeView : public ui::TreeModelObserver, // TextfieldController overrides: virtual void ContentsChanged(Textfield* sender, - const string16& new_contents) OVERRIDE; + const base::string16& new_contents) OVERRIDE; virtual bool HandleKeyEvent(Textfield* sender, const ui::KeyEvent& key_event) OVERRIDE; @@ -155,7 +155,7 @@ class VIEWS_EXPORT TreeView : public ui::TreeModelObserver, virtual int GetRowCount() OVERRIDE; virtual int GetSelectedRow() OVERRIDE; virtual void SetSelectedRow(int row) OVERRIDE; - virtual string16 GetTextForRow(int row) OVERRIDE; + virtual base::string16 GetTextForRow(int row) OVERRIDE; protected: // View overrides: diff --git a/ui/views/controls/tree/tree_view_unittest.cc b/ui/views/controls/tree/tree_view_unittest.cc index 1864ff9..ba89f69 100644 --- a/ui/views/controls/tree/tree_view_unittest.cc +++ b/ui/views/controls/tree/tree_view_unittest.cc @@ -68,7 +68,7 @@ class TreeViewTest : public ViewsTestBase { private: std::string InternalNodeAsString(TreeView::InternalNode* node); - TestNode* GetNodeByTitleImpl(TestNode* node, const string16& title); + TestNode* GetNodeByTitleImpl(TestNode* node, const base::string16& title); DISALLOW_COPY_AND_ASSIGN(TreeViewTest); }; @@ -118,7 +118,7 @@ int TreeViewTest::GetRowCount() { } TestNode* TreeViewTest::GetNodeByTitleImpl(TestNode* node, - const string16& title) { + const base::string16& title) { if (node->GetTitle() == title) return node; for (int i = 0; i < node->child_count(); ++i) { diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc index 7f88f02..4fed9cf 100644 --- a/ui/views/controls/webview/web_dialog_view.cc +++ b/ui/views/controls/webview/web_dialog_view.cc @@ -135,10 +135,10 @@ ui::ModalType WebDialogView::GetModalType() const { return GetDialogModalType(); } -string16 WebDialogView::GetWindowTitle() const { +base::string16 WebDialogView::GetWindowTitle() const { if (delegate_) return delegate_->GetDialogTitle(); - return string16(); + return base::string16(); } std::string WebDialogView::GetWindowName() const { @@ -188,7 +188,7 @@ ui::ModalType WebDialogView::GetDialogModalType() const { return ui::MODAL_TYPE_NONE; } -string16 WebDialogView::GetDialogTitle() const { +base::string16 WebDialogView::GetDialogTitle() const { return GetWindowTitle(); } diff --git a/ui/views/controls/webview/web_dialog_view.h b/ui/views/controls/webview/web_dialog_view.h index bb2eb39..51d67eb 100644 --- a/ui/views/controls/webview/web_dialog_view.h +++ b/ui/views/controls/webview/web_dialog_view.h @@ -63,7 +63,7 @@ class WEBVIEW_EXPORT WebDialogView : public views::ClientView, // Overridden from views::WidgetDelegate: virtual bool CanResize() const OVERRIDE; virtual ui::ModalType GetModalType() const OVERRIDE; - virtual string16 GetWindowTitle() const OVERRIDE; + virtual base::string16 GetWindowTitle() const OVERRIDE; virtual std::string GetWindowName() const OVERRIDE; virtual void WindowClosing() OVERRIDE; virtual views::View* GetContentsView() OVERRIDE; @@ -75,7 +75,7 @@ class WEBVIEW_EXPORT WebDialogView : public views::ClientView, // Overridden from ui::WebDialogDelegate: virtual ui::ModalType GetDialogModalType() const OVERRIDE; - virtual string16 GetDialogTitle() const OVERRIDE; + virtual base::string16 GetDialogTitle() const OVERRIDE; virtual GURL GetDialogContentURL() const OVERRIDE; virtual void GetWebUIMessageHandlers( std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE; diff --git a/ui/views/corewm/tooltip.h b/ui/views/corewm/tooltip.h index f714ac9..7fb15bc 100644 --- a/ui/views/corewm/tooltip.h +++ b/ui/views/corewm/tooltip.h @@ -27,7 +27,7 @@ class VIEWS_EXPORT Tooltip { // Updates the text on the tooltip and resizes to fit. virtual void SetText(aura::Window* window, - const string16& tooltip_text, + const base::string16& tooltip_text, const gfx::Point& location) = 0; // Shows the tooltip at the specified location (in screen coordinates). diff --git a/ui/views/corewm/tooltip_aura.cc b/ui/views/corewm/tooltip_aura.cc index 7c11bd8..0cfeb2e 100644 --- a/ui/views/corewm/tooltip_aura.cc +++ b/ui/views/corewm/tooltip_aura.cc @@ -86,7 +86,7 @@ TooltipAura::~TooltipAura() { // static void TooltipAura::TrimTooltipToFit(int max_width, - string16* text, + base::string16* text, int* width, int* line_count) { *width = 0; @@ -95,24 +95,24 @@ void TooltipAura::TrimTooltipToFit(int max_width, // Determine the available width for the tooltip. int available_width = std::min(kTooltipMaxWidthPixels, max_width); - std::vector<string16> lines; + std::vector<base::string16> lines; base::SplitString(*text, '\n', &lines); - std::vector<string16> result_lines; + std::vector<base::string16> result_lines; // Format each line to fit. gfx::Font font = GetDefaultFont(); - for (std::vector<string16>::iterator l = lines.begin(); l != lines.end(); - ++l) { + for (std::vector<base::string16>::iterator l = lines.begin(); + l != lines.end(); ++l) { // We break the line at word boundaries, then stuff as many words as we can // in the available width to the current line, and move the remaining words // to a new line. - std::vector<string16> words; + std::vector<base::string16> words; base::SplitStringDontTrim(*l, ' ', &words); int current_width = 0; - string16 line; - for (std::vector<string16>::iterator w = words.begin(); w != words.end(); - ++w) { - string16 word = *w; + base::string16 line; + for (std::vector<base::string16>::iterator w = words.begin(); + w != words.end(); ++w) { + base::string16 word = *w; if (w + 1 != words.end()) word.push_back(' '); int word_width = font.GetStringWidth(word); @@ -139,8 +139,8 @@ void TooltipAura::TrimTooltipToFit(int max_width, *line_count = result_lines.size(); // Flatten the result. - string16 result; - for (std::vector<string16>::iterator l = result_lines.begin(); + base::string16 result; + for (std::vector<base::string16>::iterator l = result_lines.begin(); l != result_lines.end(); ++l) { if (!result.empty()) result.push_back('\n'); @@ -234,11 +234,11 @@ void TooltipAura::DestroyWidget() { } void TooltipAura::SetText(aura::Window* window, - const string16& tooltip_text, + const base::string16& tooltip_text, const gfx::Point& location) { tooltip_window_ = window; int max_width, line_count; - string16 trimmed_text(tooltip_text); + base::string16 trimmed_text(tooltip_text); TrimTooltipToFit( GetMaxWidth(location), &trimmed_text, &max_width, &line_count); label_.SetText(trimmed_text); diff --git a/ui/views/corewm/tooltip_aura.h b/ui/views/corewm/tooltip_aura.h index 97f3737..f267236 100644 --- a/ui/views/corewm/tooltip_aura.h +++ b/ui/views/corewm/tooltip_aura.h @@ -28,7 +28,7 @@ class VIEWS_EXPORT TooltipAura : public Tooltip, public WidgetObserver { // give the location of the tooltip in screen coordinates. |max_width| comes // from GetMaxWidth(). static void TrimTooltipToFit(int max_width, - string16* text, + base::string16* text, int* width, int* line_count); @@ -53,7 +53,7 @@ class VIEWS_EXPORT TooltipAura : public Tooltip, public WidgetObserver { // Tooltip: virtual void SetText(aura::Window* window, - const string16& tooltip_text, + const base::string16& tooltip_text, const gfx::Point& location) OVERRIDE; virtual void Show() OVERRIDE; virtual void Hide() OVERRIDE; diff --git a/ui/views/corewm/tooltip_aura_unittest.cc b/ui/views/corewm/tooltip_aura_unittest.cc index 75814ab..82ee85d 100644 --- a/ui/views/corewm/tooltip_aura_unittest.cc +++ b/ui/views/corewm/tooltip_aura_unittest.cc @@ -23,7 +23,7 @@ gfx::Font GetDefaultFont() { TEST_F(TooltipAuraTest, TrimTooltipToFitTests) { const int max_width = 4000; - string16 tooltip; + base::string16 tooltip; int width, line_count, expect_lines; int max_pixel_width = 400; // copied from constants in tooltip_controller.cc int max_lines = 10; // copied from constants in tooltip_controller.cc diff --git a/ui/views/corewm/tooltip_controller.cc b/ui/views/corewm/tooltip_controller.cc index 23bea64..bd3c34d 100644 --- a/ui/views/corewm/tooltip_controller.cc +++ b/ui/views/corewm/tooltip_controller.cc @@ -267,7 +267,7 @@ void TooltipController::UpdateIfRequired() { return; } - string16 tooltip_text; + base::string16 tooltip_text; if (tooltip_window_) tooltip_text = aura::client::GetTooltipText(tooltip_window_); diff --git a/ui/views/corewm/tooltip_controller_test_helper.cc b/ui/views/corewm/tooltip_controller_test_helper.cc index 4794a6e..f96b08d 100644 --- a/ui/views/corewm/tooltip_controller_test_helper.cc +++ b/ui/views/corewm/tooltip_controller_test_helper.cc @@ -19,7 +19,7 @@ TooltipControllerTestHelper::TooltipControllerTestHelper( TooltipControllerTestHelper::~TooltipControllerTestHelper() { } -string16 TooltipControllerTestHelper::GetTooltipText() { +base::string16 TooltipControllerTestHelper::GetTooltipText() { return controller_->tooltip_text_; } @@ -55,7 +55,7 @@ TooltipTestView::~TooltipTestView() { } bool TooltipTestView::GetTooltipText(const gfx::Point& p, - string16* tooltip) const { + base::string16* tooltip) const { *tooltip = tooltip_text_; return true; } diff --git a/ui/views/corewm/tooltip_controller_test_helper.h b/ui/views/corewm/tooltip_controller_test_helper.h index 5838620..4451ff3 100644 --- a/ui/views/corewm/tooltip_controller_test_helper.h +++ b/ui/views/corewm/tooltip_controller_test_helper.h @@ -31,7 +31,7 @@ class TooltipControllerTestHelper { TooltipController* controller() { return controller_; } // These are mostly cover methods for TooltipController private methods. - string16 GetTooltipText(); + base::string16 GetTooltipText(); aura::Window* GetTooltipWindow(); void FireTooltipTimer(); bool IsTooltipTimerRunning(); @@ -51,14 +51,16 @@ class TooltipTestView : public views::View { TooltipTestView(); virtual ~TooltipTestView(); - void set_tooltip_text(string16 tooltip_text) { tooltip_text_ = tooltip_text; } + void set_tooltip_text(base::string16 tooltip_text) { + tooltip_text_ = tooltip_text; + } // Overridden from views::View virtual bool GetTooltipText(const gfx::Point& p, - string16* tooltip) const OVERRIDE; + base::string16* tooltip) const OVERRIDE; private: - string16 tooltip_text_; + base::string16 tooltip_text_; DISALLOW_COPY_AND_ASSIGN(TooltipTestView); }; diff --git a/ui/views/corewm/tooltip_controller_unittest.cc b/ui/views/corewm/tooltip_controller_unittest.cc index 53f84e3..f4b9606 100644 --- a/ui/views/corewm/tooltip_controller_unittest.cc +++ b/ui/views/corewm/tooltip_controller_unittest.cc @@ -135,15 +135,15 @@ class TooltipControllerTest : public aura::test::AuraTestBase { TEST_F(TooltipControllerTest, ViewTooltip) { view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text")); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(NULL, helper_->GetTooltipWindow()); generator_->MoveMouseToCenterOf(GetWindow()); EXPECT_EQ(GetWindow(), GetRootWindow()->GetEventHandlerForPoint( generator_->current_location())); - string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); + base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow())); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow()); // Fire tooltip timer so tooltip becomes visible. @@ -160,7 +160,7 @@ TEST_F(TooltipControllerTest, ViewTooltip) { TEST_F(TooltipControllerTest, TooltipsInMultipleViews) { view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text")); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(NULL, helper_->GetTooltipWindow()); PrepareSecondView(); @@ -176,7 +176,7 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleViews) { EXPECT_TRUE(helper_->IsTooltipVisible()); EXPECT_EQ(window, root_window->GetEventHandlerForPoint( generator_->current_location())); - string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); + base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); EXPECT_EQ(window, helper_->GetTooltipWindow()); @@ -186,7 +186,7 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleViews) { EXPECT_FALSE(helper_->IsTooltipVisible()); EXPECT_EQ(window, root_window->GetEventHandlerForPoint( generator_->current_location())); - string16 expected_tooltip; // = "" + base::string16 expected_tooltip; // = "" EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); EXPECT_EQ(window, helper_->GetTooltipWindow()); @@ -195,11 +195,11 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleViews) { TEST_F(TooltipControllerTest, EnableOrDisableTooltips) { view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text")); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(NULL, helper_->GetTooltipWindow()); generator_->MoveMouseRelativeTo(GetWindow(), view_->bounds().CenterPoint()); - string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); + base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); // Fire tooltip timer so tooltip becomes visible. helper_->FireTooltipTimer(); @@ -221,7 +221,7 @@ TEST_F(TooltipControllerTest, EnableOrDisableTooltips) { // Verifies tooltip isn't shown if tooltip text consists entirely of whitespace. TEST_F(TooltipControllerTest, DontShowEmptyTooltips) { view_->set_tooltip_text(ASCIIToUTF16(" ")); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(NULL, helper_->GetTooltipWindow()); generator_->MoveMouseRelativeTo(GetWindow(), view_->bounds().CenterPoint()); @@ -232,7 +232,7 @@ TEST_F(TooltipControllerTest, DontShowEmptyTooltips) { TEST_F(TooltipControllerTest, TooltipHidesOnKeyPressAndStaysHiddenUntilChange) { view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text for view 1")); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(NULL, helper_->GetTooltipWindow()); TooltipTestView* view2 = PrepareSecondView(); @@ -261,7 +261,7 @@ TEST_F(TooltipControllerTest, TooltipHidesOnKeyPressAndStaysHiddenUntilChange) { EXPECT_EQ(window, GetRootWindow()->GetEventHandlerForPoint( generator_->current_location())); - string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 1"); + base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 1"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); EXPECT_EQ(window, helper_->GetTooltipWindow()); @@ -273,7 +273,7 @@ TEST_F(TooltipControllerTest, TooltipHidesOnKeyPressAndStaysHiddenUntilChange) { helper_->FireTooltipTimer(); EXPECT_TRUE(helper_->IsTooltipVisible()); EXPECT_TRUE(helper_->IsTooltipShownTimerRunning()); - string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 2"); + base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 2"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); EXPECT_EQ(window, helper_->GetTooltipWindow()); @@ -281,7 +281,7 @@ TEST_F(TooltipControllerTest, TooltipHidesOnKeyPressAndStaysHiddenUntilChange) { TEST_F(TooltipControllerTest, TooltipHidesOnTimeoutAndStaysHiddenUntilChange) { view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text for view 1")); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(NULL, helper_->GetTooltipWindow()); TooltipTestView* view2 = PrepareSecondView(); @@ -309,7 +309,7 @@ TEST_F(TooltipControllerTest, TooltipHidesOnTimeoutAndStaysHiddenUntilChange) { EXPECT_FALSE(helper_->IsTooltipShownTimerRunning()); EXPECT_EQ(window, GetRootWindow()->GetEventHandlerForPoint( generator_->current_location())); - string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 1"); + base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 1"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); EXPECT_EQ(window, helper_->GetTooltipWindow()); @@ -321,7 +321,7 @@ TEST_F(TooltipControllerTest, TooltipHidesOnTimeoutAndStaysHiddenUntilChange) { helper_->FireTooltipTimer(); EXPECT_TRUE(helper_->IsTooltipVisible()); EXPECT_TRUE(helper_->IsTooltipShownTimerRunning()); - string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 2"); + base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 2"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); EXPECT_EQ(window, helper_->GetTooltipWindow()); @@ -331,9 +331,9 @@ TEST_F(TooltipControllerTest, TooltipHidesOnTimeoutAndStaysHiddenUntilChange) { TEST_F(TooltipControllerTest, HideOnExit) { view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text")); generator_->MoveMouseToCenterOf(GetWindow()); - string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); + base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow())); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow()); // Fire tooltip timer so tooltip becomes visible. @@ -459,9 +459,9 @@ TEST_F(TooltipControllerCaptureTest, CloseOnCaptureLost) { view_->GetWidget()->SetCapture(view_); view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text")); generator_->MoveMouseToCenterOf(GetWindow()); - string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); + base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow())); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow()); // Fire tooltip timer so tooltip becomes visible. @@ -482,8 +482,8 @@ TEST_F(TooltipControllerCaptureTest, CloseOnCaptureLost) { #endif // Verifies the correct window is found for tooltips when there is a capture. TEST_F(TooltipControllerCaptureTest, MAYBE_Capture) { - const string16 tooltip_text(ASCIIToUTF16("1")); - const string16 tooltip_text2(ASCIIToUTF16("2")); + const base::string16 tooltip_text(ASCIIToUTF16("1")); + const base::string16 tooltip_text2(ASCIIToUTF16("2")); widget_->SetBounds(gfx::Rect(0, 0, 200, 200)); view_->set_tooltip_text(tooltip_text); @@ -535,7 +535,7 @@ TEST_F(TooltipControllerCaptureTest, MAYBE_Capture) { // window when mouse moves are dispatched to it. TEST_F(TooltipControllerTest, TooltipsInMultipleRootWindows) { view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text For RootWindow1")); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(NULL, helper_->GetTooltipWindow()); aura::Window* window = GetWindow(); @@ -550,7 +550,7 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleRootWindows) { EXPECT_TRUE(helper_->IsTooltipVisible()); EXPECT_EQ(window, root_window->GetEventHandlerForPoint( generator_->current_location())); - string16 expected_tooltip = + base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text For RootWindow1"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); @@ -583,7 +583,8 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleRootWindows) { EXPECT_TRUE(helper_->IsTooltipVisible()); EXPECT_EQ(window2, root_window2->GetEventHandlerForPoint( generator_->current_location())); - string16 expected_tooltip = ASCIIToUTF16("Tooltip Text For RootWindow2"); + base::string16 expected_tooltip = + ASCIIToUTF16("Tooltip Text For RootWindow2"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window2)); EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); EXPECT_EQ(window2, helper_->GetTooltipWindow()); @@ -605,15 +606,15 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleRootWindows) { // top of the ZOrder in its root window after activation changes. TEST_F(TooltipControllerTest, TooltipAtTopOfZOrderAfterActivation) { view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text")); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(NULL, helper_->GetTooltipWindow()); generator_->MoveMouseToCenterOf(GetWindow()); EXPECT_EQ(GetWindow(), GetRootWindow()->GetEventHandlerForPoint( generator_->current_location())); - string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); + base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow())); - EXPECT_EQ(string16(), helper_->GetTooltipText()); + EXPECT_EQ(base::string16(), helper_->GetTooltipText()); EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow()); // Fire tooltip timer so tooltip becomes visible. diff --git a/ui/views/examples/bubble_example.cc b/ui/views/examples/bubble_example.cc index 6869b46..1b00db2 100644 --- a/ui/views/examples/bubble_example.cc +++ b/ui/views/examples/bubble_example.cc @@ -26,7 +26,7 @@ BubbleBorder::Arrow arrows[] = { BubbleBorder::BOTTOM_LEFT, BubbleBorder::LEFT_BOTTOM, BubbleBorder::LEFT_CENTER, BubbleBorder::LEFT_TOP }; -string16 GetArrowName(BubbleBorder::Arrow arrow) { +base::string16 GetArrowName(BubbleBorder::Arrow arrow) { switch (arrow) { case BubbleBorder::TOP_LEFT: return ASCIIToUTF16("TOP_LEFT"); case BubbleBorder::TOP_RIGHT: return ASCIIToUTF16("TOP_RIGHT"); diff --git a/ui/views/examples/combobox_example.cc b/ui/views/examples/combobox_example.cc index 4c2a1b8..a5b2dbc 100644 --- a/ui/views/examples/combobox_example.cc +++ b/ui/views/examples/combobox_example.cc @@ -22,7 +22,7 @@ int ComboboxModelExample::GetItemCount() const { return 10; } -string16 ComboboxModelExample::GetItemAt(int index) { +base::string16 ComboboxModelExample::GetItemAt(int index) { return UTF8ToUTF16(base::StringPrintf("Item %d", index)); } diff --git a/ui/views/examples/combobox_example.h b/ui/views/examples/combobox_example.h index 263782d..6449e91 100644 --- a/ui/views/examples/combobox_example.h +++ b/ui/views/examples/combobox_example.h @@ -22,7 +22,7 @@ class ComboboxModelExample : public ui::ComboboxModel { // Overridden from ui::ComboboxModel: virtual int GetItemCount() const OVERRIDE; - virtual string16 GetItemAt(int index) OVERRIDE; + virtual base::string16 GetItemAt(int index) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(ComboboxModelExample); diff --git a/ui/views/examples/example_combobox_model.cc b/ui/views/examples/example_combobox_model.cc index 255ef15..9b4066f 100644 --- a/ui/views/examples/example_combobox_model.cc +++ b/ui/views/examples/example_combobox_model.cc @@ -20,7 +20,7 @@ int ExampleComboboxModel::GetItemCount() const { return count_; } -string16 ExampleComboboxModel::GetItemAt(int index) { +base::string16 ExampleComboboxModel::GetItemAt(int index) { return ASCIIToUTF16(strings_[index]); } diff --git a/ui/views/examples/example_combobox_model.h b/ui/views/examples/example_combobox_model.h index 74262d8..2c5ee80 100644 --- a/ui/views/examples/example_combobox_model.h +++ b/ui/views/examples/example_combobox_model.h @@ -19,7 +19,7 @@ class ExampleComboboxModel : public ui::ComboboxModel { // Overridden from ui::ComboboxModel: virtual int GetItemCount() const OVERRIDE; - virtual string16 GetItemAt(int index) OVERRIDE; + virtual base::string16 GetItemAt(int index) OVERRIDE; private: const char** strings_; diff --git a/ui/views/examples/examples_window.cc b/ui/views/examples/examples_window.cc index 0411992..b8bcf50 100644 --- a/ui/views/examples/examples_window.cc +++ b/ui/views/examples/examples_window.cc @@ -51,7 +51,7 @@ class ComboboxModelExampleList : public ui::ComboboxModel { // Overridden from ui::ComboboxModel: virtual int GetItemCount() const OVERRIDE { return example_list_.size(); } - virtual string16 GetItemAt(int index) OVERRIDE { + virtual base::string16 GetItemAt(int index) OVERRIDE { return UTF8ToUTF16(example_list_[index]->example_title()); } @@ -97,7 +97,7 @@ class ExamplesWindowContents : public WidgetDelegateView, // Overridden from WidgetDelegateView: virtual bool CanResize() const OVERRIDE { return true; } virtual bool CanMaximize() const OVERRIDE { return true; } - virtual string16 GetWindowTitle() const OVERRIDE { + virtual base::string16 GetWindowTitle() const OVERRIDE { return ASCIIToUTF16("Views Examples"); } virtual View* GetContentsView() OVERRIDE { return this; } diff --git a/ui/views/examples/examples_window_with_content.cc b/ui/views/examples/examples_window_with_content.cc index 3e4e4bd..c29ba5c 100644 --- a/ui/views/examples/examples_window_with_content.cc +++ b/ui/views/examples/examples_window_with_content.cc @@ -53,7 +53,7 @@ class ComboboxModelExampleList : public ui::ComboboxModel { // Overridden from ui::ComboboxModel: virtual int GetItemCount() const OVERRIDE { return example_list_.size(); } - virtual string16 GetItemAt(int index) OVERRIDE { + virtual base::string16 GetItemAt(int index) OVERRIDE { return UTF8ToUTF16(example_list_[index]->example_title()); } @@ -101,7 +101,7 @@ class ExamplesWindowContents : public WidgetDelegateView, // Overridden from WidgetDelegateView: virtual bool CanResize() const OVERRIDE { return true; } virtual bool CanMaximize() const OVERRIDE { return true; } - virtual string16 GetWindowTitle() const OVERRIDE { + virtual base::string16 GetWindowTitle() const OVERRIDE { return ASCIIToUTF16("Views Examples"); } virtual View* GetContentsView() OVERRIDE { return this; } diff --git a/ui/views/examples/menu_example.cc b/ui/views/examples/menu_example.cc index 307a6ca..434904c 100644 --- a/ui/views/examples/menu_example.cc +++ b/ui/views/examples/menu_example.cc @@ -58,7 +58,7 @@ class ExampleMenuModel : public ui::SimpleMenuModel, class ExampleMenuButton : public MenuButton, public MenuButtonListener { public: - explicit ExampleMenuButton(const string16& test); + explicit ExampleMenuButton(const base::string16& test); virtual ~ExampleMenuButton(); private: @@ -176,7 +176,7 @@ void ExampleMenuModel::ExecuteCommand(int command_id, int event_flags) { // ExampleMenuButton ----------------------------------------------------------- -ExampleMenuButton::ExampleMenuButton(const string16& test) +ExampleMenuButton::ExampleMenuButton(const base::string16& test) : MenuButton(NULL, test, this, true) { } diff --git a/ui/views/examples/multiline_example.cc b/ui/views/examples/multiline_example.cc index b192384..b7d971e 100644 --- a/ui/views/examples/multiline_example.cc +++ b/ui/views/examples/multiline_example.cc @@ -56,7 +56,7 @@ class MultilineExample::RenderTextView : public View { return height; } - void SetText(const string16& new_contents) { + void SetText(const base::string16& new_contents) { // Color and style the text inside |test_range| to test colors and styles. gfx::Range test_range(1, 21); test_range.set_start(std::min(test_range.start(), new_contents.length())); @@ -139,7 +139,7 @@ void MultilineExample::CreateExampleView(View* container) { } void MultilineExample::ContentsChanged(Textfield* sender, - const string16& new_contents) { + const base::string16& new_contents) { render_text_view_->SetText(new_contents); if (label_checkbox_->checked()) label_->SetText(new_contents); @@ -154,7 +154,8 @@ bool MultilineExample::HandleKeyEvent(Textfield* sender, void MultilineExample::ButtonPressed(Button* sender, const ui::Event& event) { DCHECK_EQ(sender, label_checkbox_); - label_->SetText(label_checkbox_->checked() ? textfield_->text() : string16()); + label_->SetText(label_checkbox_->checked() ? textfield_->text() : + base::string16()); container()->Layout(); container()->SchedulePaint(); } diff --git a/ui/views/examples/multiline_example.h b/ui/views/examples/multiline_example.h index 2757c4a..56613bd 100644 --- a/ui/views/examples/multiline_example.h +++ b/ui/views/examples/multiline_example.h @@ -36,7 +36,7 @@ class MultilineExample : public ExampleBase, // TextfieldController: virtual void ContentsChanged(Textfield* sender, - const string16& new_contents) OVERRIDE; + const base::string16& new_contents) OVERRIDE; virtual bool HandleKeyEvent(Textfield* sender, const ui::KeyEvent& key_event) OVERRIDE; diff --git a/ui/views/examples/tabbed_pane_example.cc b/ui/views/examples/tabbed_pane_example.cc index f0f6691..9c4bdde 100644 --- a/ui/views/examples/tabbed_pane_example.cc +++ b/ui/views/examples/tabbed_pane_example.cc @@ -57,7 +57,7 @@ void TabbedPaneExample::ButtonPressed(Button* sender, const ui::Event& event) { if (sender == add_) { AddButton("Added"); } else if (sender == add_at_) { - const string16 label = ASCIIToUTF16("Added at 1"); + const base::string16 label = ASCIIToUTF16("Added at 1"); tabbed_pane_->AddTabAtIndex(1, label, new LabelButton(NULL, label)); } else if (sender == select_at_) { if (tabbed_pane_->GetTabCount() > 1) diff --git a/ui/views/examples/table_example.cc b/ui/views/examples/table_example.cc index 87032c7..fcd79d8 100644 --- a/ui/views/examples/table_example.cc +++ b/ui/views/examples/table_example.cc @@ -107,9 +107,9 @@ int TableExample::RowCount() { return 10; } -string16 TableExample::GetText(int row, int column_id) { +base::string16 TableExample::GetText(int row, int column_id) { if (row == -1) - return string16(); + return base::string16(); const char* const cells[5][4] = { { "Orange", "Orange", "South america", "$5" }, diff --git a/ui/views/examples/table_example.h b/ui/views/examples/table_example.h index d715a10..a0f7327 100644 --- a/ui/views/examples/table_example.h +++ b/ui/views/examples/table_example.h @@ -41,7 +41,7 @@ class TableExample : public ExampleBase, // ui::TableModel: virtual int RowCount() OVERRIDE; - virtual string16 GetText(int row, int column_id) OVERRIDE; + virtual base::string16 GetText(int row, int column_id) OVERRIDE; virtual gfx::ImageSkia GetIcon(int row) OVERRIDE; virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; diff --git a/ui/views/examples/text_example.cc b/ui/views/examples/text_example.cc index ec43ac1..63c51e1 100644 --- a/ui/views/examples/text_example.cc +++ b/ui/views/examples/text_example.cc @@ -108,8 +108,8 @@ class TextExample::TextExampleView : public View { int text_flags() const { return text_flags_; } void set_text_flags(int text_flags) { text_flags_ = text_flags; } - const string16& text() const { return text_; } - void set_text(const string16& text) { text_ = text; } + const base::string16& text() const { return text_; } + void set_text(const base::string16& text) { text_ = text; } bool halo() const { return halo_; } void set_halo(bool halo) { halo_ = halo; } @@ -132,7 +132,7 @@ class TextExample::TextExampleView : public View { gfx::FontList font_list_; // The text to draw. - string16 text_; + base::string16 text_; // Text flags for passing to |DrawStringInt()|. int text_flags_; diff --git a/ui/views/examples/textfield_example.cc b/ui/views/examples/textfield_example.cc index ec18cf7..a33421c 100644 --- a/ui/views/examples/textfield_example.cc +++ b/ui/views/examples/textfield_example.cc @@ -77,7 +77,7 @@ void TextfieldExample::CreateExampleView(View* container) { } void TextfieldExample::ContentsChanged(Textfield* sender, - const string16& new_contents) { + const base::string16& new_contents) { if (sender == name_) { PrintStatus("Name [%s]", UTF16ToUTF8(new_contents).c_str()); } else if (sender == password_) { @@ -102,7 +102,7 @@ void TextfieldExample::ButtonPressed(Button* sender, const ui::Event& event) { if (sender == show_password_) { PrintStatus("Password [%s]", UTF16ToUTF8(password_->text()).c_str()); } else if (sender == clear_all_) { - string16 empty; + base::string16 empty; name_->SetText(empty); password_->SetText(empty); read_only_->SetText(empty); diff --git a/ui/views/examples/textfield_example.h b/ui/views/examples/textfield_example.h index b363c6e..9862544 100644 --- a/ui/views/examples/textfield_example.h +++ b/ui/views/examples/textfield_example.h @@ -34,7 +34,7 @@ class TextfieldExample : public ExampleBase, private: // TextfieldController: virtual void ContentsChanged(Textfield* sender, - const string16& new_contents) OVERRIDE; + const base::string16& new_contents) OVERRIDE; virtual bool HandleKeyEvent(Textfield* sender, const ui::KeyEvent& key_event) OVERRIDE; virtual bool HandleMouseEvent(Textfield* sender, diff --git a/ui/views/examples/widget_example.cc b/ui/views/examples/widget_example.cc index 0d42a65..c4042b5 100644 --- a/ui/views/examples/widget_example.cc +++ b/ui/views/examples/widget_example.cc @@ -22,7 +22,7 @@ class DialogExample : public DialogDelegateView { public: DialogExample(); virtual ~DialogExample(); - virtual string16 GetWindowTitle() const OVERRIDE; + virtual base::string16 GetWindowTitle() const OVERRIDE; virtual View* CreateExtraView() OVERRIDE; virtual View* CreateTitlebarExtraView() OVERRIDE; virtual View* CreateFootnoteView() OVERRIDE; @@ -36,7 +36,7 @@ DialogExample::DialogExample() { DialogExample::~DialogExample() {} -string16 DialogExample::GetWindowTitle() const { +base::string16 DialogExample::GetWindowTitle() const { return ASCIIToUTF16("Dialog Widget Example"); } diff --git a/ui/views/focus/focus_manager_unittest.cc b/ui/views/focus/focus_manager_unittest.cc index fcb82b7..d04bdf4 100644 --- a/ui/views/focus/focus_manager_unittest.cc +++ b/ui/views/focus/focus_manager_unittest.cc @@ -537,7 +537,8 @@ class FocusManagerDtorTest : public FocusManagerTest { class LabelButtonDtorTracked : public LabelButton { public: - LabelButtonDtorTracked(const string16& text, DtorTrackVector* dtor_tracker) + LabelButtonDtorTracked(const base::string16& text, + DtorTrackVector* dtor_tracker) : LabelButton(NULL, text), dtor_tracker_(dtor_tracker) { SetStyle(STYLE_NATIVE_TEXTBUTTON); diff --git a/ui/views/focus/focus_traversal_unittest.cc b/ui/views/focus/focus_traversal_unittest.cc index c3e8159..0976a4c 100644 --- a/ui/views/focus/focus_traversal_unittest.cc +++ b/ui/views/focus/focus_traversal_unittest.cc @@ -89,7 +89,7 @@ class DummyComboboxModel : public ui::ComboboxModel { public: // Overridden from ui::ComboboxModel: virtual int GetItemCount() const OVERRIDE { return 10; } - virtual string16 GetItemAt(int index) OVERRIDE { + virtual base::string16 GetItemAt(int index) OVERRIDE { return ASCIIToUTF16("Item ") + base::IntToString16(index); } }; diff --git a/ui/views/ime/input_method_bridge.cc b/ui/views/ime/input_method_bridge.cc index f2e00ce..a55f928 100644 --- a/ui/views/ime/input_method_bridge.cc +++ b/ui/views/ime/input_method_bridge.cc @@ -198,7 +198,7 @@ void InputMethodBridge::ClearCompositionText() { client->ClearCompositionText(); } -void InputMethodBridge::InsertText(const string16& text) { +void InputMethodBridge::InsertText(const base::string16& text) { TextInputClient* client = GetTextInputClient(); if (client) client->InsertText(text); @@ -280,7 +280,7 @@ bool InputMethodBridge::DeleteRange(const gfx::Range& range) { } bool InputMethodBridge::GetTextFromRange(const gfx::Range& range, - string16* text) const { + base::string16* text) const { TextInputClient* client = GetTextInputClient(); return client ? client->GetTextFromRange(range, text) : false; } diff --git a/ui/views/ime/input_method_bridge.h b/ui/views/ime/input_method_bridge.h index 5e28a03..3a70e88 100644 --- a/ui/views/ime/input_method_bridge.h +++ b/ui/views/ime/input_method_bridge.h @@ -54,7 +54,7 @@ class InputMethodBridge : public InputMethodBase, 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; @@ -70,7 +70,7 @@ class InputMethodBridge : public InputMethodBase, 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/views/ime/mock_input_method.cc b/ui/views/ime/mock_input_method.cc index b04dafb..9e3ebf4 100644 --- a/ui/views/ime/mock_input_method.cc +++ b/ui/views/ime/mock_input_method.cc @@ -159,7 +159,7 @@ void MockInputMethod::SetCompositionTextForNextKey( composition_ = composition; } -void MockInputMethod::SetResultTextForNextKey(const string16& result) { +void MockInputMethod::SetResultTextForNextKey(const base::string16& result) { result_text_ = result; } diff --git a/ui/views/ime/mock_input_method.h b/ui/views/ime/mock_input_method.h index fad5315..5c5833f 100644 --- a/ui/views/ime/mock_input_method.h +++ b/ui/views/ime/mock_input_method.h @@ -52,7 +52,7 @@ class VIEWS_EXPORT MockInputMethod : public InputMethodBase { void Clear(); void SetCompositionTextForNextKey(const ui::CompositionText& composition); - void SetResultTextForNextKey(const string16& result); + void SetResultTextForNextKey(const base::string16& result); void SetInputLocale(const std::string& locale); void SetInputTextDirection(base::i18n::TextDirection direction); @@ -75,7 +75,7 @@ class VIEWS_EXPORT MockInputMethod : public InputMethodBase { // Result text for the next key event. It'll be cleared automatically after // dispatching the next key event. - string16 result_text_; + base::string16 result_text_; // Record call state of corresponding methods. They will be set to false // automatically before dispatching a key event. diff --git a/ui/views/linux_ui/linux_ui.h b/ui/views/linux_ui/linux_ui.h index 152b364..3a27067 100644 --- a/ui/views/linux_ui/linux_ui.h +++ b/ui/views/linux_ui/linux_ui.h @@ -86,7 +86,7 @@ class VIEWS_EXPORT LinuxUI : public ui::LinuxInputMethodContextFactory, // Create a native status icon. virtual scoped_ptr<StatusIconLinux> CreateLinuxStatusIcon( const gfx::ImageSkia& image, - const string16& tool_tip) const = 0; + const base::string16& tool_tip) const = 0; // Returns the icon for a given content type from the icon theme. // TODO(davidben): Add an observer for the theme changing, so we can drop the diff --git a/ui/views/linux_ui/status_icon_linux.h b/ui/views/linux_ui/status_icon_linux.h index 5ed8be2..b7ed3c7 100644 --- a/ui/views/linux_ui/status_icon_linux.h +++ b/ui/views/linux_ui/status_icon_linux.h @@ -38,7 +38,7 @@ class VIEWS_EXPORT StatusIconLinux { virtual void SetImage(const gfx::ImageSkia& image) = 0; virtual void SetPressedImage(const gfx::ImageSkia& image) = 0; - virtual void SetToolTip(const string16& tool_tip) = 0; + virtual void SetToolTip(const base::string16& tool_tip) = 0; // Invoked after a call to SetContextMenu() to let the platform-specific // subclass update the native context menu based on the new model. The diff --git a/ui/views/test/child_modal_window.cc b/ui/views/test/child_modal_window.cc index 510275c..a7eda417 100644 --- a/ui/views/test/child_modal_window.cc +++ b/ui/views/test/child_modal_window.cc @@ -65,7 +65,7 @@ class ChildModalWindow : public WidgetDelegateView { // Overridden from WidgetDelegate: virtual View* GetContentsView() OVERRIDE; - virtual string16 GetWindowTitle() const OVERRIDE; + virtual base::string16 GetWindowTitle() const OVERRIDE; virtual bool CanResize() const OVERRIDE; virtual ui::ModalType GetModalType() const OVERRIDE; @@ -95,7 +95,7 @@ View* ChildModalWindow::GetContentsView() { return this; } -string16 ChildModalWindow::GetWindowTitle() const { +base::string16 ChildModalWindow::GetWindowTitle() const { return ASCIIToUTF16("Examples: Child Modal Window"); } @@ -159,7 +159,7 @@ View* ChildModalParent::GetContentsView() { return this; } -string16 ChildModalParent::GetWindowTitle() const { +base::string16 ChildModalParent::GetWindowTitle() const { return ASCIIToUTF16("Examples: Child Modal Parent"); } diff --git a/ui/views/test/child_modal_window.h b/ui/views/test/child_modal_window.h index 96265ce..1e86eae 100644 --- a/ui/views/test/child_modal_window.h +++ b/ui/views/test/child_modal_window.h @@ -35,7 +35,7 @@ class ChildModalParent : public WidgetDelegateView, // Overridden from WidgetDelegate: virtual View* GetContentsView() OVERRIDE; - virtual string16 GetWindowTitle() const OVERRIDE; + virtual base::string16 GetWindowTitle() const OVERRIDE; virtual bool CanResize() const OVERRIDE; virtual void DeleteDelegate() OVERRIDE; virtual void Layout() OVERRIDE; diff --git a/ui/views/test/test_views_delegate.h b/ui/views/test/test_views_delegate.h index aa7110b3..4a7e296 100644 --- a/ui/views/test/test_views_delegate.h +++ b/ui/views/test/test_views_delegate.h @@ -41,8 +41,8 @@ class TestViewsDelegate : public ViewsDelegate { virtual void NotifyAccessibilityEvent( View* view, ui::AccessibilityTypes::Event event_type) OVERRIDE {} - virtual void NotifyMenuItemFocused(const string16& menu_name, - const string16& menu_item_name, + virtual void NotifyMenuItemFocused(const base::string16& menu_name, + const base::string16& menu_item_name, int item_index, int item_count, bool has_submenu) OVERRIDE {} diff --git a/ui/views/touchui/touch_editing_menu.cc b/ui/views/touchui/touch_editing_menu.cc index dec9113..0eeea85 100644 --- a/ui/views/touchui/touch_editing_menu.cc +++ b/ui/views/touchui/touch_editing_menu.cc @@ -125,8 +125,9 @@ void TouchEditingMenuView::CreateButtons() { Layout(); } -Button* TouchEditingMenuView::CreateButton(const string16& title, int tag) { - string16 label = gfx::RemoveAcceleratorChar(title, '&', NULL, NULL); +Button* TouchEditingMenuView::CreateButton(const base::string16& title, + int tag) { + base::string16 label = gfx::RemoveAcceleratorChar(title, '&', NULL, NULL); LabelButton* button = new LabelButton(this, label); button->SetFocusable(true); button->set_request_focus_on_press(false); diff --git a/ui/views/touchui/touch_editing_menu.h b/ui/views/touchui/touch_editing_menu.h index 5dfeaef..e4fe549 100644 --- a/ui/views/touchui/touch_editing_menu.h +++ b/ui/views/touchui/touch_editing_menu.h @@ -69,7 +69,7 @@ class VIEWS_EXPORT TouchEditingMenuView : public BubbleDelegateView, void CreateButtons(); // Helper method to create a single button. - Button* CreateButton(const string16& title, int tag); + Button* CreateButton(const base::string16& title, int tag); TouchEditingMenuController* controller_; diff --git a/ui/views/view.cc b/ui/views/view.cc index 0cec760..a00b6ec 100644 --- a/ui/views/view.cc +++ b/ui/views/view.cc @@ -1252,7 +1252,7 @@ FocusTraversable* View::GetPaneFocusTraversable() { // Tooltips -------------------------------------------------------------------- -bool View::GetTooltipText(const gfx::Point& p, string16* tooltip) const { +bool View::GetTooltipText(const gfx::Point& p, base::string16* tooltip) const { return false; } diff --git a/ui/views/view.h b/ui/views/view.h index 848d847..7f4de42 100644 --- a/ui/views/view.h +++ b/ui/views/view.h @@ -832,7 +832,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, // Any time the tooltip text that a View is displaying changes, it must // invoke TooltipTextChanged. // |p| provides the coordinates of the mouse (relative to this view). - virtual bool GetTooltipText(const gfx::Point& p, string16* tooltip) const; + virtual bool GetTooltipText(const gfx::Point& p, + base::string16* tooltip) const; // Returns the location (relative to this View) for the text on the tooltip // to display. If false is returned (the default), the tooltip is placed at diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc index c15478b..91bba05 100644 --- a/ui/views/view_unittest.cc +++ b/ui/views/view_unittest.cc @@ -1434,10 +1434,10 @@ TEST_F(ViewTest, NotifyEnterExitOnChild) { } TEST_F(ViewTest, Textfield) { - const string16 kText = ASCIIToUTF16("Reality is that which, when you stop " - "believing it, doesn't go away."); - const string16 kExtraText = ASCIIToUTF16("Pretty deep, Philip!"); - const string16 kEmptyString; + const base::string16 kText = ASCIIToUTF16( + "Reality is that which, when you stop believing it, doesn't go away."); + const base::string16 kExtraText = ASCIIToUTF16("Pretty deep, Philip!"); + const base::string16 kEmptyString; Widget* widget = new Widget; Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); @@ -1453,7 +1453,7 @@ TEST_F(ViewTest, Textfield) { EXPECT_EQ(kText, textfield->text()); textfield->AppendText(kExtraText); EXPECT_EQ(kText + kExtraText, textfield->text()); - textfield->SetText(string16()); + textfield->SetText(base::string16()); EXPECT_EQ(kEmptyString, textfield->text()); // Test selection related methods. @@ -1469,9 +1469,10 @@ TEST_F(ViewTest, Textfield) { // Tests that the Textfield view respond appropiately to cut/copy/paste. TEST_F(ViewTest, TextfieldCutCopyPaste) { - const string16 kNormalText = ASCIIToUTF16("Normal"); - const string16 kReadOnlyText = ASCIIToUTF16("Read only"); - const string16 kPasswordText = ASCIIToUTF16("Password! ** Secret stuff **"); + const base::string16 kNormalText = ASCIIToUTF16("Normal"); + const base::string16 kReadOnlyText = ASCIIToUTF16("Read only"); + const base::string16 kPasswordText = + ASCIIToUTF16("Password! ** Secret stuff **"); ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); @@ -1500,7 +1501,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) { normal->SelectAll(false); normal->ExecuteCommand(IDS_APP_CUT); - string16 result; + base::string16 result; clipboard->ReadText(ui::CLIPBOARD_TYPE_COPY_PASTE, &result); EXPECT_EQ(kNormalText, result); normal->SetText(kNormalText); // Let's revert to the original content. diff --git a/ui/views/views_delegate.h b/ui/views/views_delegate.h index 8227865..9ae48eec 100644 --- a/ui/views/views_delegate.h +++ b/ui/views/views_delegate.h @@ -80,8 +80,8 @@ class VIEWS_EXPORT ViewsDelegate { // For accessibility, notify the delegate that a menu item was focused // so that alternate feedback (speech / magnified text) can be provided. - virtual void NotifyMenuItemFocused(const string16& menu_name, - const string16& menu_item_name, + virtual void NotifyMenuItemFocused(const base::string16& menu_name, + const base::string16& menu_item_name, int item_index, int item_count, bool has_submenu) = 0; diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc index 8a008b5..4db5a00 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc @@ -587,7 +587,7 @@ void DesktopNativeWidgetAura::GetWindowPlacement( desktop_root_window_host_->GetWindowPlacement(bounds, maximized); } -bool DesktopNativeWidgetAura::SetWindowTitle(const string16& title) { +bool DesktopNativeWidgetAura::SetWindowTitle(const base::string16& title) { if (!content_window_) return false; return desktop_root_window_host_->SetWindowTitle(title); diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h index ca4bca2..c5ac716 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h @@ -117,7 +117,7 @@ class VIEWS_EXPORT DesktopNativeWidgetAura virtual void GetWindowPlacement( gfx::Rect* bounds, ui::WindowShowState* maximized) const OVERRIDE; - virtual bool SetWindowTitle(const string16& title) OVERRIDE; + virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) OVERRIDE; virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host.h b/ui/views/widget/desktop_aura/desktop_root_window_host.h index c66cee9..fed998e 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host.h +++ b/ui/views/widget/desktop_aura/desktop_root_window_host.h @@ -113,7 +113,7 @@ class VIEWS_EXPORT DesktopRootWindowHost { virtual bool IsAlwaysOnTop() const = 0; // Returns true if the title changed. - virtual bool SetWindowTitle(const string16& title) = 0; + virtual bool SetWindowTitle(const base::string16& title) = 0; virtual void ClearNativeFocus() = 0; diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc index c258f84..de0ae61 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc @@ -334,7 +334,7 @@ bool DesktopRootWindowHostWin::IsAlwaysOnTop() const { return message_handler_->IsAlwaysOnTop(); } -bool DesktopRootWindowHostWin::SetWindowTitle(const string16& title) { +bool DesktopRootWindowHostWin::SetWindowTitle(const base::string16& title) { return message_handler_->SetTitle(title); } diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.h b/ui/views/widget/desktop_aura/desktop_root_window_host_win.h index bfe42e1..59f64f8 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.h @@ -80,7 +80,7 @@ class VIEWS_EXPORT DesktopRootWindowHostWin virtual bool HasCapture() const OVERRIDE; virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; virtual bool IsAlwaysOnTop() const OVERRIDE; - virtual bool SetWindowTitle(const string16& title) OVERRIDE; + virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; virtual void ClearNativeFocus() OVERRIDE; virtual Widget::MoveLoopResult RunMoveLoop( const gfx::Vector2d& drag_offset, diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc index 2c6bbfe..9620ff5 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc @@ -523,7 +523,7 @@ bool DesktopRootWindowHostX11::IsAlwaysOnTop() const { return is_always_on_top_; } -bool DesktopRootWindowHostX11::SetWindowTitle(const string16& title) { +bool DesktopRootWindowHostX11::SetWindowTitle(const base::string16& title) { if (window_title_ == title) return false; window_title_ = title; diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h index 291512c..2c55162 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.h @@ -107,7 +107,7 @@ class VIEWS_EXPORT DesktopRootWindowHostX11 : virtual bool HasCapture() const OVERRIDE; virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; virtual bool IsAlwaysOnTop() const OVERRIDE; - virtual bool SetWindowTitle(const string16& title) OVERRIDE; + virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; virtual void ClearNativeFocus() OVERRIDE; virtual Widget::MoveLoopResult RunMoveLoop( const gfx::Vector2d& drag_offset, @@ -284,7 +284,7 @@ private: scoped_ptr<X11ScopedCapture> x11_capture_; - string16 window_title_; + base::string16 window_title_; DISALLOW_COPY_AND_ASSIGN(DesktopRootWindowHostX11); }; diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index c5c9307..d395fa7 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -345,7 +345,7 @@ void NativeWidgetAura::GetWindowPlacement( ui::SHOW_STATE_DEFAULT; } -bool NativeWidgetAura::SetWindowTitle(const string16& title) { +bool NativeWidgetAura::SetWindowTitle(const base::string16& title) { if (!window_) return false; if (window_->title() == title) diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h index c79c003..3d97819 100644 --- a/ui/views/widget/native_widget_aura.h +++ b/ui/views/widget/native_widget_aura.h @@ -79,7 +79,7 @@ class VIEWS_EXPORT NativeWidgetAura virtual void GetWindowPlacement( gfx::Rect* bounds, ui::WindowShowState* maximized) const OVERRIDE; - virtual bool SetWindowTitle(const string16& title) OVERRIDE; + virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) OVERRIDE; virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; diff --git a/ui/views/widget/native_widget_private.h b/ui/views/widget/native_widget_private.h index 2cee953..4118c9c 100644 --- a/ui/views/widget/native_widget_private.h +++ b/ui/views/widget/native_widget_private.h @@ -152,7 +152,7 @@ class VIEWS_EXPORT NativeWidgetPrivate : public NativeWidget { ui::WindowShowState* show_state) const = 0; // Sets the NativeWindow title. Returns true if the title changed. - virtual bool SetWindowTitle(const string16& title) = 0; + virtual bool SetWindowTitle(const base::string16& title) = 0; // Sets the Window icons. |window_icon| is a 16x16 icon suitable for use in // a title bar. |app_icon| is a larger size for use in the host environment diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc index afe0973..1810916 100644 --- a/ui/views/widget/native_widget_win.cc +++ b/ui/views/widget/native_widget_win.cc @@ -232,7 +232,7 @@ void NativeWidgetWin::GetWindowPlacement( *bounds = gfx::win::ScreenToDIPRect(*bounds); } -bool NativeWidgetWin::SetWindowTitle(const string16& title) { +bool NativeWidgetWin::SetWindowTitle(const base::string16& title) { return message_handler_->SetTitle(title); } diff --git a/ui/views/widget/native_widget_win.h b/ui/views/widget/native_widget_win.h index 8f27e09..9b76304 100644 --- a/ui/views/widget/native_widget_win.h +++ b/ui/views/widget/native_widget_win.h @@ -94,7 +94,7 @@ class VIEWS_EXPORT NativeWidgetWin : public internal::NativeWidgetPrivate, virtual void GetWindowPlacement( gfx::Rect* bounds, ui::WindowShowState* show_state) const OVERRIDE; - virtual bool SetWindowTitle(const string16& title) OVERRIDE; + virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, const gfx::ImageSkia& app_icon) OVERRIDE; virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; diff --git a/ui/views/widget/tooltip_manager_aura.cc b/ui/views/widget/tooltip_manager_aura.cc index 1735979..2b33a1a 100644 --- a/ui/views/widget/tooltip_manager_aura.cc +++ b/ui/views/widget/tooltip_manager_aura.cc @@ -124,7 +124,7 @@ void TooltipManagerAura::UpdateTooltipForTarget(View* target, if (target) { gfx::Point view_point = point; View::ConvertPointFromWidget(target, &view_point); - string16 new_tooltip_text; + base::string16 new_tooltip_text; if (!target->GetTooltipText(view_point, &new_tooltip_text)) tooltip_text_.clear(); else diff --git a/ui/views/widget/tooltip_manager_aura.h b/ui/views/widget/tooltip_manager_aura.h index ed69c6d..e723299 100644 --- a/ui/views/widget/tooltip_manager_aura.h +++ b/ui/views/widget/tooltip_manager_aura.h @@ -52,7 +52,7 @@ class TooltipManagerAura : public TooltipManager { aura::Window* GetWindow(); Widget* widget_; - string16 tooltip_text_; + base::string16 tooltip_text_; DISALLOW_COPY_AND_ASSIGN(TooltipManagerAura); }; diff --git a/ui/views/widget/tooltip_manager_win.cc b/ui/views/widget/tooltip_manager_win.cc index f9965f9..eac960a 100644 --- a/ui/views/widget/tooltip_manager_win.cc +++ b/ui/views/widget/tooltip_manager_win.cc @@ -315,7 +315,7 @@ void TooltipManagerWin::UpdateTooltip(const gfx::Point& mouse_pos) { // text has changed. gfx::Point view_point = mouse_pos; View::ConvertPointToTarget(root_view, last_tooltip_view_, &view_point); - string16 new_tooltip_text; + base::string16 new_tooltip_text; bool has_tooltip_text = last_tooltip_view_->GetTooltipText(view_point, &new_tooltip_text); if (!has_tooltip_text || (new_tooltip_text != tooltip_text_)) { diff --git a/ui/views/widget/tooltip_manager_win.h b/ui/views/widget/tooltip_manager_win.h index e12dfbb..7d8e7a6 100644 --- a/ui/views/widget/tooltip_manager_win.h +++ b/ui/views/widget/tooltip_manager_win.h @@ -116,10 +116,10 @@ class TooltipManagerWin : public TooltipManager { bool last_view_out_of_sync_; // Text for tooltip from the view. - string16 tooltip_text_; + base::string16 tooltip_text_; // The clipped tooltip. - string16 clipped_text_; + base::string16 clipped_text_; // Number of lines in the tooltip. int line_count_; diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index 05d2060..179ccc6 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -796,7 +796,7 @@ void Widget::UpdateWindowTitle() { // Update the native frame's text. We do this regardless of whether or not // the native frame is being used, since this also updates the taskbar, etc. - string16 window_title = widget_delegate_->GetWindowTitle(); + base::string16 window_title = widget_delegate_->GetWindowTitle(); base::i18n::AdjustStringForLocaleDirection(&window_title); if (!native_widget_->SetWindowTitle(window_title)) return; diff --git a/ui/views/widget/widget_delegate.cc b/ui/views/widget/widget_delegate.cc index fbace27..a3da957 100644 --- a/ui/views/widget/widget_delegate.cc +++ b/ui/views/widget/widget_delegate.cc @@ -61,12 +61,12 @@ ui::AccessibilityTypes::Role WidgetDelegate::GetAccessibleWindowRole() const { return ui::AccessibilityTypes::ROLE_WINDOW; } -string16 WidgetDelegate::GetAccessibleWindowTitle() const { +base::string16 WidgetDelegate::GetAccessibleWindowTitle() const { return GetWindowTitle(); } -string16 WidgetDelegate::GetWindowTitle() const { - return string16(); +base::string16 WidgetDelegate::GetWindowTitle() const { + return base::string16(); } bool WidgetDelegate::ShouldShowWindowTitle() const { diff --git a/ui/views/widget/widget_delegate.h b/ui/views/widget/widget_delegate.h index 16e29a8..f313c97 100644 --- a/ui/views/widget/widget_delegate.h +++ b/ui/views/widget/widget_delegate.h @@ -63,10 +63,10 @@ class VIEWS_EXPORT WidgetDelegate { virtual ui::AccessibilityTypes::Role GetAccessibleWindowRole() const; // Returns the title to be read with screen readers. - virtual string16 GetAccessibleWindowTitle() const; + virtual base::string16 GetAccessibleWindowTitle() const; // Returns the text to be displayed in the window title. - virtual string16 GetWindowTitle() const; + virtual base::string16 GetWindowTitle() const; // Returns true if the window should show a title in the title bar. virtual bool ShouldShowWindowTitle() const; diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index b8800d1..cb4af52 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc @@ -1603,10 +1603,10 @@ class WidgetWindowTitleTest : public WidgetTest { internal::NativeWidgetPrivate* native_widget = widget->native_widget_private(); - string16 empty; - string16 s1(UTF8ToUTF16("Title1")); - string16 s2(UTF8ToUTF16("Title2")); - string16 s3(UTF8ToUTF16("TitleLong")); + base::string16 empty; + base::string16 s1(UTF8ToUTF16("Title1")); + base::string16 s2(UTF8ToUTF16("Title2")); + base::string16 s3(UTF8ToUTF16("TitleLong")); // The widget starts with no title, setting empty should not change // anything. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 1c25faf..396184e 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -753,8 +753,8 @@ void HWNDMessageHandler::SetVisibilityChangedAnimationsEnabled(bool enabled) { } } -bool HWNDMessageHandler::SetTitle(const string16& title) { - string16 current_title; +bool HWNDMessageHandler::SetTitle(const base::string16& title) { + base::string16 current_title; size_t len_with_null = GetWindowTextLength(hwnd()) + 1; if (len_with_null == 1 && title.length() == 0) return false; diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h index 9bcec62..e02ef56 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h @@ -176,7 +176,7 @@ class VIEWS_EXPORT HWNDMessageHandler : void SetVisibilityChangedAnimationsEnabled(bool enabled); // Returns true if the title changed. - bool SetTitle(const string16& title); + bool SetTitle(const base::string16& title); void SetCursor(HCURSOR cursor); diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc index bfb870e..ed9fce2 100644 --- a/ui/views/window/dialog_client_view.cc +++ b/ui/views/window/dialog_client_view.cc @@ -359,7 +359,7 @@ void DialogClientView::ChildVisibilityChanged(View* child) { // DialogClientView, private: LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) { - const string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); + const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type); LabelButton* button = NULL; if (GetDialogDelegate()->UseNewStyleForThisDialog() && GetDialogDelegate()->GetDefaultDialogButton() == type && diff --git a/ui/views/window/dialog_delegate_unittest.cc b/ui/views/window/dialog_delegate_unittest.cc index f56073a..5398ed0 100644 --- a/ui/views/window/dialog_delegate_unittest.cc +++ b/ui/views/window/dialog_delegate_unittest.cc @@ -38,7 +38,7 @@ class TestDialog : public DialogDelegateView, public ButtonListener { // DialogDelegateView overrides: virtual gfx::Size GetPreferredSize() OVERRIDE { return gfx::Size(200, 200); } - virtual string16 GetWindowTitle() const OVERRIDE { return title_; } + virtual base::string16 GetWindowTitle() const OVERRIDE { return title_; } // ButtonListener override: virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE { @@ -73,7 +73,7 @@ class TestDialog : public DialogDelegateView, public ButtonListener { GetWidget()->Close(); } - void set_title(const string16& title) { title_ = title; } + void set_title(const base::string16& title) { title_ = title; } private: bool canceled_; @@ -81,7 +81,7 @@ class TestDialog : public DialogDelegateView, public ButtonListener { // Prevent the dialog from closing, for repeated ok and cancel button clicks. bool closeable_; Button* last_pressed_button_; - string16 title_; + base::string16 title_; DISALLOW_COPY_AND_ASSIGN(TestDialog); }; @@ -121,21 +121,21 @@ TEST_F(DialogTest, DefaultButtons) { dialog()->PressEnterAndCheckStates(ok_button); // Focus another button in the dialog, it should become the default. - LabelButton* button_1 = new LabelButton(dialog(), string16()); + LabelButton* button_1 = new LabelButton(dialog(), base::string16()); client_view->AddChildView(button_1); client_view->OnWillChangeFocus(ok_button, button_1); EXPECT_TRUE(button_1->is_default()); dialog()->PressEnterAndCheckStates(button_1); // Focus a Checkbox (not a push button), OK should become the default again. - Checkbox* checkbox = new Checkbox(string16()); + Checkbox* checkbox = new Checkbox(base::string16()); client_view->AddChildView(checkbox); client_view->OnWillChangeFocus(button_1, checkbox); EXPECT_FALSE(button_1->is_default()); dialog()->PressEnterAndCheckStates(ok_button); // Focus yet another button in the dialog, it should become the default. - LabelButton* button_2 = new LabelButton(dialog(), string16()); + LabelButton* button_2 = new LabelButton(dialog(), base::string16()); client_view->AddChildView(button_2); client_view->OnWillChangeFocus(checkbox, button_2); EXPECT_FALSE(button_1->is_default()); diff --git a/ui/views/window/non_client_view.cc b/ui/views/window/non_client_view.cc index f7cd70e..fbdbce2 100644 --- a/ui/views/window/non_client_view.cc +++ b/ui/views/window/non_client_view.cc @@ -127,7 +127,7 @@ void NonClientView::LayoutFrameView() { frame_view_->Layout(); } -void NonClientView::SetAccessibleName(const string16& name) { +void NonClientView::SetAccessibleName(const base::string16& name) { accessible_name_ = name; } diff --git a/ui/views/window/non_client_view.h b/ui/views/window/non_client_view.h index 2c3b1d9..ecfe984 100644 --- a/ui/views/window/non_client_view.h +++ b/ui/views/window/non_client_view.h @@ -208,7 +208,7 @@ class VIEWS_EXPORT NonClientView : public View { void LayoutFrameView(); // Set the accessible name of this view. - void SetAccessibleName(const string16& name); + void SetAccessibleName(const base::string16& name); // NonClientView, View overrides: virtual gfx::Size GetPreferredSize() OVERRIDE; @@ -243,7 +243,7 @@ class VIEWS_EXPORT NonClientView : public View { View* overlay_view_; // The accessible name of this view. - string16 accessible_name_; + base::string16 accessible_name_; DISALLOW_COPY_AND_ASSIGN(NonClientView); }; |