0

[LSC] Replace base::string16 with std::u16string in //[a-e]*

This change replaces base::string16 with std::u16string in //[a-e]*.

Reproduction steps:
$ git grep -lw 'base::string16' [a-e]* | \
      xargs sed -i 's/\bbase::string16\b/std::u16string/g'
$ git cl format

Bug: 1184339
Change-Id: I7930c2c3ae510b6d2232cc1b3a927ad90515ffe9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2752407
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Owners-Override: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#862191}
This commit is contained in:
Jan Wilken Dörrie
2021-03-11 23:38:47 +00:00
committed by Chromium LUCI CQ
parent ed5e3edcd1
commit 85285b04a0
787 changed files with 2244 additions and 2261 deletions
android_webview
apps
ash
accelerators
accessibility
ambient
app_list
app_menu
assistant
capture_mode
child_accounts
clipboard
debug.cc
detachable_base
display
drag_drop
hud_display
ime
in_session_auth
login
media
multi_device_setup
projector
public
quick_answers
search_box
session
shelf
shortcut_viewer
system
accessibility
audio
bluetooth
caps_lock_notification_controller.cc
cast
dark_mode
gesture_education
holding_space
ime
ime_menu
locale
media
message_center
model
nearby_share
network
night_light
overview
palette
pcie_peripheral
phonehub
power
privacy_screen
rotation
screen_layout_observer.ccscreen_layout_observer.hscreen_layout_observer_unittest.cc
screen_security
session
supervised
time
toast
tracing_notification_controller.cc
tray
unified
update
user
virtual_keyboard
tooltips
touch
wm
base
build
cloud_print/virtual_driver/win/install
device
docs
extensions
browser
api
app_window
extension_error.ccextension_error.hextension_error_test_util.ccextension_icon_placeholder.ccextension_icon_placeholder.h
guest_view
install
management_policy.ccmanagement_policy.hmanagement_policy_unittest.ccpath_util.ccpath_util.hpolicy_check.ccpolicy_check.hpolicy_check_unittest.ccpreload_check.ccpreload_check.hrequirements_checker.ccrequirements_checker.hsandboxed_unpacker.ccsandboxed_unpacker.hsandboxed_unpacker_unittest.cctest_management_policy.cctest_management_policy.hwarning_set.cc
common
api
csp_validator.cccsp_validator.hcsp_validator_unittest.ccerror_utils.ccerror_utils.hextension.ccextension.hextension_messages.hextension_urls.ccextension_urls.hmanifest.ccmanifest.hmanifest_handler.ccmanifest_handler.hmanifest_handler_helpers.ccmanifest_handler_helpers.hmanifest_handler_unittest.cc
manifest_handlers
manifest_url_handlers.ccmanifest_url_handlers.h
permissions
stack_frame.ccstack_frame.hstack_frame_unittest.cc
components
renderer
shell

@ -138,13 +138,13 @@ void AwAutofillClient::OnUnmaskVerificationResult(PaymentsRpcResult result) {
}
void AwAutofillClient::ConfirmAccountNameFixFlow(
base::OnceCallback<void(const base::string16&)> callback) {
base::OnceCallback<void(const std::u16string&)> callback) {
NOTIMPLEMENTED();
}
void AwAutofillClient::ConfirmExpirationDateFixFlow(
const autofill::CreditCard& card,
base::OnceCallback<void(const base::string16&, const base::string16&)>
base::OnceCallback<void(const std::u16string&, const std::u16string&)>
callback) {
NOTIMPLEMENTED();
}
@ -205,8 +205,8 @@ void AwAutofillClient::ShowAutofillPopup(
}
void AwAutofillClient::UpdateAutofillPopupDataListValues(
const std::vector<base::string16>& values,
const std::vector<base::string16>& labels) {
const std::vector<std::u16string>& values,
const std::vector<std::u16string>& labels) {
// Leaving as an empty method since updating autofill popup window
// dynamically does not seem to be a useful feature for android webview.
// See crrev.com/18102002 if need to implement.
@ -257,8 +257,8 @@ void AwAutofillClient::PropagateAutofillPredictions(
const std::vector<autofill::FormStructure*>& forms) {}
void AwAutofillClient::DidFillOrPreviewField(
const base::string16& autofilled_value,
const base::string16& profile_full_name) {}
const std::u16string& autofilled_value,
const std::u16string& profile_full_name) {}
bool AwAutofillClient::IsContextSecure() const {
content::SSLStatus ssl_status;

@ -84,10 +84,10 @@ class AwAutofillClient : public autofill::AutofillClient,
base::WeakPtr<autofill::CardUnmaskDelegate> delegate) override;
void OnUnmaskVerificationResult(PaymentsRpcResult result) override;
void ConfirmAccountNameFixFlow(
base::OnceCallback<void(const base::string16&)> callback) override;
base::OnceCallback<void(const std::u16string&)> callback) override;
void ConfirmExpirationDateFixFlow(
const autofill::CreditCard& card,
base::OnceCallback<void(const base::string16&, const base::string16&)>
base::OnceCallback<void(const std::u16string&, const std::u16string&)>
callback) override;
void ConfirmSaveCreditCardLocally(
const autofill::CreditCard& card,
@ -110,8 +110,8 @@ class AwAutofillClient : public autofill::AutofillClient,
const autofill::AutofillClient::PopupOpenArgs& open_args,
base::WeakPtr<autofill::AutofillPopupDelegate> delegate) override;
void UpdateAutofillPopupDataListValues(
const std::vector<base::string16>& values,
const std::vector<base::string16>& labels) override;
const std::vector<std::u16string>& values,
const std::vector<std::u16string>& labels) override;
base::span<const autofill::Suggestion> GetPopupSuggestions() const override;
void PinPopupView() override;
autofill::AutofillClient::PopupOpenArgs GetReopenPopupArgs() const override;
@ -122,8 +122,8 @@ class AwAutofillClient : public autofill::AutofillClient,
void PropagateAutofillPredictions(
content::RenderFrameHost* rfh,
const std::vector<autofill::FormStructure*>& forms) override;
void DidFillOrPreviewField(const base::string16& autofilled_value,
const base::string16& profile_full_name) override;
void DidFillOrPreviewField(const std::u16string& autofilled_value,
const std::u16string& profile_full_name) override;
bool IsContextSecure() const override;
bool ShouldShowSigninPromo() override;
bool AreServerCardsSupported() const override;

@ -762,7 +762,7 @@ bool AwContentBrowserClient::ShouldOverrideUrlLoading(
if (client_bridge == nullptr)
return true;
base::string16 url = base::UTF8ToUTF16(gurl.possibly_invalid_spec());
std::u16string url = base::UTF8ToUTF16(gurl.possibly_invalid_spec());
return client_bridge->ShouldOverrideUrlLoading(
url, has_user_gesture, is_redirect, is_main_frame, ignore_navigation);
}

@ -535,12 +535,12 @@ void AwContents::AddVisitedLinks(
const JavaParamRef<jobject>& obj,
const JavaParamRef<jobjectArray>& jvisited_links) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
std::vector<base::string16> visited_link_strings;
std::vector<std::u16string> visited_link_strings;
base::android::AppendJavaStringArrayToStringVector(env, jvisited_links,
&visited_link_strings);
std::vector<GURL> visited_link_gurls;
std::vector<base::string16>::const_iterator itr;
std::vector<std::u16string>::const_iterator itr;
for (itr = visited_link_strings.begin(); itr != visited_link_strings.end();
++itr) {
visited_link_gurls.push_back(GURL(*itr));
@ -1381,12 +1381,12 @@ base::android::ScopedJavaLocalRef<jstring> AwContents::AddWebMessageListener(
const base::android::JavaParamRef<jobject>& listener,
const base::android::JavaParamRef<jstring>& js_object_name,
const base::android::JavaParamRef<jobjectArray>& allowed_origin_rules) {
base::string16 native_js_object_name =
std::u16string native_js_object_name =
base::android::ConvertJavaStringToUTF16(env, js_object_name);
std::vector<std::string> native_allowed_origin_rule_strings;
AppendJavaStringArrayToStringVector(env, allowed_origin_rules,
&native_allowed_origin_rule_strings);
const base::string16 error_message =
const std::u16string error_message =
GetJsCommunicationHost()->AddWebMessageHostFactory(
std::make_unique<AwWebMessageHostFactory>(listener),
native_js_object_name, native_allowed_origin_rule_strings);

@ -293,15 +293,15 @@ void AwContentsClientBridge::ProvideClientCertificateResponse(
void AwContentsClientBridge::RunJavaScriptDialog(
content::JavaScriptDialogType dialog_type,
const GURL& origin_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const std::u16string& message_text,
const std::u16string& default_prompt_text,
content::JavaScriptDialogManager::DialogClosedCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
if (!obj) {
std::move(callback).Run(false, base::string16());
std::move(callback).Run(false, std::u16string());
return;
}
@ -347,11 +347,11 @@ void AwContentsClientBridge::RunBeforeUnloadDialog(
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
if (!obj) {
std::move(callback).Run(false, base::string16());
std::move(callback).Run(false, std::u16string());
return;
}
const base::string16 message_text =
const std::u16string message_text =
l10n_util::GetStringUTF16(IDS_BEFOREUNLOAD_MESSAGEBOX_MESSAGE);
int callback_id = pending_js_dialog_callbacks_.Add(
@ -367,7 +367,7 @@ void AwContentsClientBridge::RunBeforeUnloadDialog(
callback_id);
}
bool AwContentsClientBridge::ShouldOverrideUrlLoading(const base::string16& url,
bool AwContentsClientBridge::ShouldOverrideUrlLoading(const std::u16string& url,
bool has_user_gesture,
bool is_redirect,
bool is_main_frame,
@ -553,7 +553,7 @@ void AwContentsClientBridge::ConfirmJsResult(JNIEnv* env,
LOG(WARNING) << "Unexpected JS dialog confirm. " << id;
return;
}
base::string16 prompt_text;
std::u16string prompt_text;
if (prompt) {
prompt_text = ConvertJavaStringToUTF16(env, prompt);
}
@ -588,7 +588,7 @@ void AwContentsClientBridge::CancelJsResult(JNIEnv*,
LOG(WARNING) << "Unexpected JS dialog cancel. " << id;
return;
}
std::move(*callback).Run(false, base::string16());
std::move(*callback).Run(false, std::u16string());
pending_js_dialog_callbacks_.Remove(id);
}

@ -91,13 +91,13 @@ class AwContentsClientBridge {
void RunJavaScriptDialog(
content::JavaScriptDialogType dialog_type,
const GURL& origin_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
const std::u16string& message_text,
const std::u16string& default_prompt_text,
content::JavaScriptDialogManager::DialogClosedCallback callback);
void RunBeforeUnloadDialog(
const GURL& origin_url,
content::JavaScriptDialogManager::DialogClosedCallback callback);
bool ShouldOverrideUrlLoading(const base::string16& url,
bool ShouldOverrideUrlLoading(const std::u16string& url,
bool has_user_gesture,
bool is_redirect,
bool is_main_frame,

@ -21,14 +21,14 @@ void AwJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents,
content::RenderFrameHost* render_frame_host,
content::JavaScriptDialogType dialog_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
const std::u16string& message_text,
const std::u16string& default_prompt_text,
DialogClosedCallback callback,
bool* did_suppress_message) {
AwContentsClientBridge* bridge =
AwContentsClientBridge::FromWebContents(web_contents);
if (!bridge) {
std::move(callback).Run(false, base::string16());
std::move(callback).Run(false, std::u16string());
return;
}
@ -45,7 +45,7 @@ void AwJavaScriptDialogManager::RunBeforeUnloadDialog(
AwContentsClientBridge* bridge =
AwContentsClientBridge::FromWebContents(web_contents);
if (!bridge) {
std::move(callback).Run(false, base::string16());
std::move(callback).Run(false, std::u16string());
return;
}

@ -19,8 +19,8 @@ class AwJavaScriptDialogManager : public content::JavaScriptDialogManager {
void RunJavaScriptDialog(content::WebContents* web_contents,
content::RenderFrameHost* render_frame_host,
content::JavaScriptDialogType dialog_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
const std::u16string& message_text,
const std::u16string& default_prompt_text,
DialogClosedCallback callback,
bool* did_suppress_message) override;
void RunBeforeUnloadDialog(content::WebContents* web_contents,

@ -262,9 +262,9 @@ class Bindings : public proxy_resolver::ProxyResolverV8Tracing::Bindings {
public:
Bindings(HostResolver* host_resolver) : host_resolver_(host_resolver) {}
void Alert(const base::string16& message) override {}
void Alert(const std::u16string& message) override {}
void OnError(int line_number, const base::string16& message) override {}
void OnError(int line_number, const std::u16string& message) override {}
proxy_resolver::ProxyHostResolver* GetHostResolver() override {
return host_resolver_;

@ -207,14 +207,14 @@ void AwQuotaManagerBridge::DeleteAllDataOnUiThread() {
void AwQuotaManagerBridge::DeleteOrigin(JNIEnv* env,
const JavaParamRef<jobject>& object,
const JavaParamRef<jstring>& origin) {
base::string16 origin_string(
std::u16string origin_string(
base::android::ConvertJavaStringToUTF16(env, origin));
RunOnUIThread(base::BindOnce(&AwQuotaManagerBridge::DeleteOriginOnUiThread,
this, origin_string));
}
void AwQuotaManagerBridge::DeleteOriginOnUiThread(
const base::string16& origin) {
const std::u16string& origin) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
StoragePartition* storage_partition = GetStoragePartition();
storage_partition->ClearDataForOrigin(
@ -285,7 +285,7 @@ void AwQuotaManagerBridge::GetUsageAndQuotaForOrigin(
const JavaParamRef<jstring>& origin,
jint callback_id,
bool is_quota) {
base::string16 origin_string(
std::u16string origin_string(
base::android::ConvertJavaStringToUTF16(env, origin));
RunOnUIThread(
base::BindOnce(&AwQuotaManagerBridge::GetUsageAndQuotaForOriginOnUiThread,
@ -293,7 +293,7 @@ void AwQuotaManagerBridge::GetUsageAndQuotaForOrigin(
}
void AwQuotaManagerBridge::GetUsageAndQuotaForOriginOnUiThread(
const base::string16& origin,
const std::u16string& origin,
jint callback_id,
bool is_quota) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);

@ -69,9 +69,9 @@ class AwQuotaManagerBridge
storage::QuotaManager* GetQuotaManager() const;
void DeleteAllDataOnUiThread();
void DeleteOriginOnUiThread(const base::string16& origin);
void DeleteOriginOnUiThread(const std::u16string& origin);
void GetOriginsOnUiThread(jint callback_id);
void GetUsageAndQuotaForOriginOnUiThread(const base::string16& origin,
void GetUsageAndQuotaForOriginOnUiThread(const std::u16string& origin,
jint callback_id,
bool is_quota);

@ -338,7 +338,7 @@ static void JNI_AwWebContentsDelegate_FilesSelectedInChooser(
}
std::vector<std::string> file_path_str;
std::vector<base::string16> display_name_str;
std::vector<std::u16string> display_name_str;
// Note file_paths maybe NULL, but this will just yield a zero-length vector.
base::android::AppendJavaStringArrayToStringVector(env, file_paths,
&file_path_str);

@ -31,7 +31,7 @@ void FindHelper::SetListener(Listener* listener) {
listener_ = listener;
}
void FindHelper::FindAllAsync(const base::string16& search_string) {
void FindHelper::FindAllAsync(const std::u16string& search_string) {
// Stop any ongoing asynchronous request.
web_contents()->StopFinding(content::STOP_FIND_ACTION_KEEP_SELECTION);
@ -87,7 +87,7 @@ void FindHelper::ClearMatches() {
last_active_ordinal_ = -1;
}
bool FindHelper::MaybeHandleEmptySearch(const base::string16& search_string) {
bool FindHelper::MaybeHandleEmptySearch(const std::u16string& search_string) {
if (!search_string.empty())
return false;
@ -96,7 +96,7 @@ bool FindHelper::MaybeHandleEmptySearch(const base::string16& search_string) {
return true;
}
void FindHelper::StartNewSession(const base::string16& search_string) {
void FindHelper::StartNewSession(const std::u16string& search_string) {
current_request_id_ = find_request_id_counter_++;
current_session_id_ = current_request_id_;
last_search_string_ = search_string;

@ -32,7 +32,7 @@ class FindHelper : public content::WebContentsObserver {
void SetListener(Listener* listener);
// Asynchronous API.
void FindAllAsync(const base::string16& search_string);
void FindAllAsync(const std::u16string& search_string);
void HandleFindReply(int request_id,
int match_count,
int active_ordinal,
@ -43,8 +43,8 @@ class FindHelper : public content::WebContentsObserver {
void ClearMatches();
private:
void StartNewSession(const base::string16& search_string);
bool MaybeHandleEmptySearch(const base::string16& search_string);
void StartNewSession(const std::u16string& search_string);
bool MaybeHandleEmptySearch(const std::u16string& search_string);
void NotifyResults(int active_ordinal, int match_count, bool finished);
// Listener results are reported to.
@ -63,7 +63,7 @@ class FindHelper : public content::WebContentsObserver {
int current_session_id_;
// Required by FindNext and the incremental find replies.
base::string16 last_search_string_;
std::u16string last_search_string_;
int last_match_count_;
int last_active_ordinal_;

@ -26,7 +26,7 @@ namespace {
void ShouldOverrideUrlLoadingOnUI(
content::WebContents* web_contents,
const base::string16& url,
const std::u16string& url,
bool has_user_gesture,
bool is_redirect,
bool is_main_frame,
@ -206,7 +206,7 @@ void AwRenderViewHostExt::ContentsSizeChanged(const gfx::Size& contents_size) {
}
void AwRenderViewHostExt::ShouldOverrideUrlLoading(
const base::string16& url,
const std::u16string& url,
bool has_user_gesture,
bool is_redirect,
bool is_main_frame,

@ -90,7 +90,7 @@ class AwRenderViewHostExt : public content::WebContentsObserver,
android_webview::mojom::HitTestDataPtr hit_test_data) override;
void ContentsSizeChanged(const gfx::Size& contents_size) override;
void ShouldOverrideUrlLoading(
const base::string16& url,
const std::u16string& url,
bool has_user_gesture,
bool is_redirect,
bool is_main_frame,

@ -233,7 +233,7 @@ bool RestoreNavigationEntryFromPickle(uint32_t state_version,
}
{
base::string16 title;
std::u16string title;
if (!iterator->ReadString16(&title))
return false;
entry->SetTitle(title);

@ -33,7 +33,7 @@ std::unique_ptr<content::NavigationEntry> CreateNavigationEntry() {
content::Referrer referrer;
referrer.url = GURL("http://referrer_url");
referrer.policy = network::mojom::ReferrerPolicy::kOrigin;
const base::string16 title(base::UTF8ToUTF16("title"));
const std::u16string title(base::UTF8ToUTF16("title"));
const bool has_post_data = true;
const GURL original_request_url("http://original_request_url");
const GURL base_url_for_data_url("http://base_url");
@ -182,7 +182,7 @@ TEST_F(AndroidWebViewStateSerializerTest,
GURL virtual_url("https://example.com/virtual_url");
content::Referrer referrer(GURL("https://example.com/referrer"),
network::mojom::ReferrerPolicy::kDefault);
base::string16 title = base::UTF8ToUTF16("title");
std::u16string title = base::UTF8ToUTF16("title");
std::string empty_encoded_page_state = "";
bool has_post_data = false;
GURL original_request_url("https://example.com/original");

@ -36,7 +36,7 @@ void AwContentClient::AddAdditionalSchemes(Schemes* schemes) {
schemes->allow_non_standard_schemes_in_origins = true;
}
base::string16 AwContentClient::GetLocalizedString(int message_id) {
std::u16string AwContentClient::GetLocalizedString(int message_id) {
// TODO(boliu): Used only by WebKit, so only bundle those resources for
// Android WebView.
return l10n_util::GetStringUTF16(message_id);

@ -26,7 +26,7 @@ class AwContentClient : public content::ContentClient {
~AwContentClient() override;
// ContentClient implementation.
void AddAdditionalSchemes(Schemes* schemes) override;
base::string16 GetLocalizedString(int message_id) override;
std::u16string GetLocalizedString(int message_id) override;
base::StringPiece GetDataResource(int resource_id,
ui::ScaleFactor scale_factor) override;
base::RefCountedMemory* GetDataResourceBytes(int resource_id) override;

@ -136,7 +136,7 @@ bool AwContentRendererClient::HandleNavigation(
}
bool ignore_navigation = false;
base::string16 url = request.Url().GetString().Utf16();
std::u16string url = request.Url().GetString().Utf16();
bool has_user_gesture = request.HasUserGesture();
mojo::AssociatedRemote<mojom::FrameHost> frame_host_remote;

@ -41,12 +41,12 @@ const char kEmailPrefix[] = "mailto:";
const char kPhoneNumberPrefix[] = "tel:";
GURL GetAbsoluteUrl(const blink::WebNode& node,
const base::string16& url_fragment) {
const std::u16string& url_fragment) {
return GURL(node.GetDocument().CompleteURL(
blink::WebString::FromUTF16(url_fragment)));
}
base::string16 GetHref(const blink::WebElement& element) {
std::u16string GetHref(const blink::WebElement& element) {
// Get the actual 'href' attribute, which might relative if valid or can
// possibly contain garbage otherwise, so not using absoluteLinkURL here.
return element.GetAttribute("href").Utf16();

@ -216,7 +216,7 @@ IN_PROC_BROWSER_TEST_F(LoadAndLaunchPlatformAppBrowserTest,
#endif
IN_PROC_BROWSER_TEST_F(LoadAndLaunchExtensionBrowserTest,
MAYBE_LoadAndLaunchExtension) {
const std::vector<base::string16>* errors =
const std::vector<std::u16string>* errors =
extensions::LoadErrorReporter::GetInstance()->GetErrors();
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
@ -225,7 +225,7 @@ IN_PROC_BROWSER_TEST_F(LoadAndLaunchExtensionBrowserTest,
#else
// Expect |extension_instead_of_app_error|.
EXPECT_EQ(1u, errors->size());
EXPECT_NE(base::string16::npos,
EXPECT_NE(std::u16string::npos,
errors->at(0).find(base::ASCIIToUTF16(
"App loading flags cannot be used to load extensions")));
#endif

@ -188,8 +188,8 @@ void RecordTabletVolumeAdjustTypeHistogram(TabletModeVolumeAdjustType type) {
// Ensures that there are no word breaks at the "+"s in the shortcut texts such
// as "Ctrl+Shift+Space".
void EnsureNoWordBreaks(base::string16* shortcut_text) {
std::vector<base::string16> keys =
void EnsureNoWordBreaks(std::u16string* shortcut_text) {
std::vector<std::u16string> keys =
base::SplitString(*shortcut_text, base::ASCIIToUTF16("+"),
base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
@ -198,7 +198,7 @@ void EnsureNoWordBreaks(base::string16* shortcut_text) {
// The plus sign surrounded by the word joiner to guarantee an non-breaking
// shortcut.
const base::string16 non_breaking_plus =
const std::u16string non_breaking_plus =
base::UTF8ToUTF16("\xe2\x81\xa0+\xe2\x81\xa0");
shortcut_text->clear();
for (size_t i = 0; i < keys.size() - 1; ++i) {
@ -211,11 +211,11 @@ void EnsureNoWordBreaks(base::string16* shortcut_text) {
// Gets the notification message after it formats it in such a way that there
// are no line breaks in the middle of the shortcut texts.
base::string16 GetNotificationText(int message_id,
std::u16string GetNotificationText(int message_id,
int old_shortcut_id,
int new_shortcut_id) {
base::string16 old_shortcut = l10n_util::GetStringUTF16(old_shortcut_id);
base::string16 new_shortcut = l10n_util::GetStringUTF16(new_shortcut_id);
std::u16string old_shortcut = l10n_util::GetStringUTF16(old_shortcut_id);
std::u16string new_shortcut = l10n_util::GetStringUTF16(new_shortcut_id);
EnsureNoWordBreaks(&old_shortcut);
EnsureNoWordBreaks(&new_shortcut);
@ -227,7 +227,7 @@ void ShowDeprecatedAcceleratorNotification(const char* const notification_id,
int message_id,
int old_shortcut_id,
int new_shortcut_id) {
const base::string16 message =
const std::u16string message =
GetNotificationText(message_id, old_shortcut_id, new_shortcut_id);
auto delegate =
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
@ -239,7 +239,7 @@ void ShowDeprecatedAcceleratorNotification(const char* const notification_id,
std::unique_ptr<Notification> notification = ash::CreateSystemNotification(
message_center::NOTIFICATION_TYPE_SIMPLE, notification_id,
l10n_util::GetStringUTF16(IDS_DEPRECATED_SHORTCUT_TITLE), message,
base::string16(), GURL(),
std::u16string(), GURL(),
message_center::NotifierId(message_center::NotifierType::SYSTEM_COMPONENT,
kNotifierAccelerator),
message_center::RichNotificationData(), std::move(delegate),
@ -248,7 +248,7 @@ void ShowDeprecatedAcceleratorNotification(const char* const notification_id,
std::move(notification));
}
void ShowToast(std::string id, const base::string16& text) {
void ShowToast(std::string id, const std::u16string& text) {
ToastData toast(id, text, kToastDurationMs, base::nullopt,
/*visible_on_lock_screen=*/true);
Shell::Get()->toast_manager()->Show(toast);
@ -1255,13 +1255,13 @@ bool CanHandleToggleOverview() {
return true;
}
void CreateAndShowStickyNotification(const base::string16& title,
const base::string16& message,
void CreateAndShowStickyNotification(const std::u16string& title,
const std::u16string& message,
const std::string& notification_id,
const gfx::VectorIcon& icon) {
std::unique_ptr<Notification> notification = ash::CreateSystemNotification(
message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, title, message,
base::string16() /* display source */, GURL(),
std::u16string() /* display source */, GURL(),
message_center::NotifierId(message_center::NotifierType::SYSTEM_COMPONENT,
kNotifierAccelerator),
message_center::RichNotificationData(), nullptr, icon,
@ -1285,7 +1285,7 @@ void NotifyAccessibilityFeatureDisabledByAdmin(
int feature_name_id,
bool feature_state,
const std::string& notification_id) {
const base::string16 organization_manager =
const std::u16string organization_manager =
base::UTF8ToUTF16(Shell::Get()
->system_tray_model()
->enterprise_domain()

@ -79,8 +79,8 @@ class ExitWarningWidgetDelegateView : public views::WidgetDelegateView {
}
private:
base::string16 text_;
base::string16 accessible_name_;
std::u16string text_;
std::u16string accessible_name_;
int text_width_;
DISALLOW_COPY_AND_ASSIGN(ExitWarningWidgetDelegateView);

@ -325,8 +325,8 @@ void ShowAccessibilityNotification(A11yNotificationType type) {
if (type == A11yNotificationType::kNone)
return;
base::string16 text;
base::string16 title;
std::u16string text;
std::u16string title;
if (type == A11yNotificationType::kBrailleDisplayConnected) {
text = l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_BRAILLE_DISPLAY_CONNECTED);
@ -350,7 +350,7 @@ void ShowAccessibilityNotification(A11yNotificationType type) {
std::unique_ptr<message_center::Notification> notification =
ash::CreateSystemNotification(
message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, title,
text, base::string16(), GURL(),
text, std::u16string(), GURL(),
message_center::NotifierId(
message_center::NotifierType::SYSTEM_COMPONENT,
kNotifierAccessibility),
@ -1886,7 +1886,7 @@ void AccessibilityControllerImpl::
NotifyAccessibilityStatusChanged();
}
base::string16 AccessibilityControllerImpl::GetBatteryDescription() const {
std::u16string AccessibilityControllerImpl::GetBatteryDescription() const {
// Pass battery status as string to callback function.
return PowerStatus::Get()->GetAccessibleNameString(
/*full_description=*/true);

@ -381,7 +381,7 @@ class ASH_EXPORT AccessibilityControllerImpl : public AccessibilityController,
void ToggleDictationFromSource(DictationToggleSource source) override;
void HandleAutoclickScrollableBoundsFound(
gfx::Rect& bounds_in_screen) override;
base::string16 GetBatteryDescription() const override;
std::u16string GetBatteryDescription() const override;
void SetVirtualKeyboardVisible(bool is_visible) override;
void PerformAcceleratorAction(AcceleratorAction accelerator_action) override;
void NotifyAccessibilityStatusChanged() override;

@ -914,9 +914,9 @@ TEST_F(AccessibilityControllerTest, SetDarkenScreen) {
}
TEST_F(AccessibilityControllerTest, ShowNotificationOnSpokenFeedback) {
const base::string16 kChromeVoxEnabledTitle =
const std::u16string kChromeVoxEnabledTitle =
base::ASCIIToUTF16("ChromeVox enabled");
const base::string16 kChromeVoxEnabled =
const std::u16string kChromeVoxEnabled =
base::ASCIIToUTF16("Press Ctrl + Alt + Z to disable spoken feedback.");
AccessibilityControllerImpl* controller =
Shell::Get()->accessibility_controller();
@ -945,11 +945,11 @@ TEST_F(AccessibilityControllerTest, ShowNotificationOnSpokenFeedback) {
TEST_F(AccessibilityControllerTest,
ShowNotificationOnBrailleDisplayStateChanged) {
const base::string16 kBrailleConnected =
const std::u16string kBrailleConnected =
base::ASCIIToUTF16("Braille display connected.");
const base::string16 kChromeVoxEnabled =
const std::u16string kChromeVoxEnabled =
base::ASCIIToUTF16("Press Ctrl + Alt + Z to disable spoken feedback.");
const base::string16 kBrailleConnectedAndChromeVoxEnabledTitle =
const std::u16string kBrailleConnectedAndChromeVoxEnabledTitle =
base::ASCIIToUTF16("Braille and ChromeVox are enabled");
AccessibilityControllerImpl* controller =
Shell::Get()->accessibility_controller();
@ -962,7 +962,7 @@ TEST_F(AccessibilityControllerTest,
message_center::NotificationList::Notifications notifications =
MessageCenter::Get()->GetVisibleNotifications();
ASSERT_EQ(1u, notifications.size());
EXPECT_EQ(base::string16(), (*notifications.begin())->title());
EXPECT_EQ(std::u16string(), (*notifications.begin())->title());
EXPECT_EQ(kBrailleConnected, (*notifications.begin())->message());
// Neither disconnecting a braille display, nor disabling spoken feedback

@ -118,7 +118,7 @@ void AmbientBackgroundImageView::UpdateImage(
}
void AmbientBackgroundImageView::UpdateImageDetails(
const base::string16& details) {
const std::u16string& details) {
ambient_info_view_->UpdateImageDetails(details);
}

@ -46,7 +46,7 @@ class ASH_EXPORT AmbientBackgroundImageView : public views::View,
const gfx::ImageSkia& related_image);
// Updates the details for the currently displayed image.
void UpdateImageDetails(const base::string16& details);
void UpdateImageDetails(const std::u16string& details);
const gfx::ImageSkia& GetCurrentImage();

@ -39,7 +39,7 @@ AmbientInfoView::AmbientInfoView(AmbientViewDelegate* delegate)
AmbientInfoView::~AmbientInfoView() = default;
void AmbientInfoView::UpdateImageDetails(const base::string16& details) {
void AmbientInfoView::UpdateImageDetails(const std::u16string& details) {
details_label_->SetText(details);
}

@ -31,7 +31,7 @@ class ASH_EXPORT AmbientInfoView : public views::View {
AmbientInfoView& operator=(AmbientInfoView&) = delete;
~AmbientInfoView() override;
void UpdateImageDetails(const base::string16& details);
void UpdateImageDetails(const std::u16string& details);
void SetTextTransform(const gfx::Transform& transform);

@ -107,7 +107,7 @@ void GlanceableInfoView::Show() {
temperature_->SetText(GetTemperatureText());
}
base::string16 GlanceableInfoView::GetTemperatureText() const {
std::u16string GlanceableInfoView::GetTemperatureText() const {
AmbientBackendModel* ambient_backend_model =
delegate_->GetAmbientBackendModel();
if (ambient_backend_model->show_celsius()) {

@ -42,7 +42,7 @@ class GlanceableInfoView : public views::View,
private:
void InitLayout();
base::string16 GetTemperatureText() const;
std::u16string GetTemperatureText() const;
// View for the time info. Owned by the view hierarchy.
ash::tray::TimeView* time_view_ = nullptr;

@ -156,8 +156,8 @@ void MediaStringView::MediaSessionMetadataChanged(
media_session::MediaMetadata session_metadata =
metadata.value_or(media_session::MediaMetadata());
base::string16 media_string;
base::string16 middle_dot = base::UTF8ToUTF16(kMiddleDotSeparator);
std::u16string media_string;
std::u16string middle_dot = base::UTF8ToUTF16(kMiddleDotSeparator);
if (!session_metadata.title.empty() && !session_metadata.artist.empty()) {
media_string =
session_metadata.title + middle_dot + session_metadata.artist;
@ -168,7 +168,7 @@ void MediaStringView::MediaSessionMetadataChanged(
}
// Reset text and stop any ongoing animation.
media_text_->SetText(base::string16());
media_text_->SetText(std::u16string());
media_text_->layer()->GetAnimator()->StopAnimating();
media_text_->SetText(media_string);

@ -35,7 +35,7 @@ class MediaStringViewTest : public AmbientAshTestBase {
AmbientAshTestBase::TearDown();
}
const base::string16& GetText() {
const std::u16string& GetText() {
return GetMediaStringViewTextLabel()->GetText();
}
};
@ -50,7 +50,7 @@ TEST_F(MediaStringViewTest, ShowMediaTitleAndArtist) {
SimulateMediaMetadataChanged(metadata);
const base::string16 expected_text = base::UTF8ToUTF16("title \u2022 artist");
const std::u16string expected_text = base::UTF8ToUTF16("title \u2022 artist");
EXPECT_EQ(GetMediaStringViewTextLabel()->GetText(), expected_text);
}

@ -287,7 +287,7 @@ void AppListControllerImpl::SetSearchEngineIsGoogle(bool is_google) {
search_model_.SetSearchEngineIsGoogle(is_google);
}
void AppListControllerImpl::UpdateSearchBox(const base::string16& text,
void AppListControllerImpl::UpdateSearchBox(const std::u16string& text,
bool initiated_by_user) {
search_model_.search_box()->Update(text, initiated_by_user);
}
@ -1058,9 +1058,9 @@ void AppListControllerImpl::StartAssistant() {
AssistantEntryPoint::kLauncherSearchBoxIcon);
}
void AppListControllerImpl::StartSearch(const base::string16& raw_query) {
void AppListControllerImpl::StartSearch(const std::u16string& raw_query) {
if (client_) {
base::string16 query;
std::u16string query;
base::TrimWhitespace(raw_query, base::TRIM_ALL, &query);
client_->StartSearch(query);
auto* notifier = GetNotifier();
@ -1270,11 +1270,11 @@ void AppListControllerImpl::OnSearchResultVisibilityChanged(
}
void AppListControllerImpl::NotifySearchResultsForLogging(
const base::string16& raw_query,
const std::u16string& raw_query,
const SearchResultIdWithPositionIndices& results,
int position_index) {
if (client_) {
base::string16 query;
std::u16string query;
base::TrimWhitespace(raw_query, base::TRIM_ALL, &query);
client_->NotifySearchResultsForLogging(query, results, position_index);
}
@ -1596,7 +1596,7 @@ void AppListControllerImpl::ResetHomeLauncherIfShown() {
presenter_.GetView()->CloseOpenedPage();
// Refresh the suggestion chips with empty query.
StartSearch(base::string16());
StartSearch(std::u16string());
}
void AppListControllerImpl::UpdateLauncherContainer(
@ -1642,7 +1642,7 @@ bool AppListControllerImpl::ShouldLauncherShowBehindApps() const {
}
int AppListControllerImpl::GetLastQueryLength() {
base::string16 query;
std::u16string query;
base::TrimWhitespace(search_model_.search_box()->text(), base::TRIM_ALL,
&query);
return query.length();

@ -100,7 +100,7 @@ class ASH_EXPORT AppListControllerImpl
const std::string& folder_id) override;
void SetStatus(AppListModelStatus status) override;
void SetSearchEngineIsGoogle(bool is_google) override;
void UpdateSearchBox(const base::string16& text,
void UpdateSearchBox(const std::u16string& text,
bool initiated_by_user) override;
void PublishSearchResults(
std::vector<std::unique_ptr<SearchResultMetadata>> results) override;
@ -169,7 +169,7 @@ class ASH_EXPORT AppListControllerImpl
SearchModel* GetSearchModel() override;
AppListNotifier* GetNotifier() override;
void StartAssistant() override;
void StartSearch(const base::string16& raw_query) override;
void StartSearch(const std::u16string& raw_query) override;
void OpenSearchResult(const std::string& result_id,
int event_flags,
AppListLaunchedFrom launched_from,
@ -205,7 +205,7 @@ class ASH_EXPORT AppListControllerImpl
void OnSearchResultVisibilityChanged(const std::string& id,
bool visibility) override;
void NotifySearchResultsForLogging(
const base::string16& raw_query,
const std::u16string& raw_query,
const SearchResultIdWithPositionIndices& results,
int position_index) override;
void MaybeIncreaseSuggestedContentInfoShownCount() override;

@ -464,7 +464,7 @@ TEST_F(AppListControllerImplTest, MAYBE_CloseNotificationWithAppListShown) {
message_center::NOTIFICATION_TYPE_BASE_FORMAT, notification_id,
base::UTF8ToUTF16(notification_title),
base::UTF8ToUTF16("test message"), gfx::Image(),
base::string16() /* display_source */, GURL(),
std::u16string() /* display_source */, GURL(),
message_center::NotifierId(), message_center::RichNotificationData(),
new message_center::NotificationDelegate()));
base::RunLoop().RunUntilIdle();

@ -353,7 +353,7 @@ class PopulatedAppListTest : public AshTestBase,
}
void UpdateFolderName(const std::string& name) {
base::string16 folder_name = base::UTF8ToUTF16(name);
std::u16string folder_name = base::UTF8ToUTF16(name);
folder_view()->folder_header_view()->SetFolderNameForTest(folder_name);
folder_view()->folder_header_view()->ContentsChanged(
folder_view()->folder_header_view()->GetFolderNameViewForTest(),

@ -57,7 +57,7 @@ class ASH_PUBLIC_EXPORT AppListViewDelegate {
// Invoked to start a new search. This collects a list of search results
// matching the raw query, which is an unhandled string typed into the search
// box by the user.
virtual void StartSearch(const base::string16& raw_query) = 0;
virtual void StartSearch(const std::u16string& raw_query) = 0;
// Invoked to open the search result and log a click. If the result is
// represented by a SuggestedChipView or is a zero state result,
@ -157,7 +157,7 @@ class ASH_PUBLIC_EXPORT AppListViewDelegate {
// |position_index| is the position index of the clicked item (if no item got
// clicked, |position_index| will be -1).
virtual void NotifySearchResultsForLogging(
const base::string16& raw_query,
const std::u16string& raw_query,
const SearchResultIdWithPositionIndices& results,
int position_index) = 0;

@ -36,7 +36,7 @@ void SearchBoxModel::SetSearchEngineIsGoogle(bool is_google) {
observer.SearchEngineChanged();
}
void SearchBoxModel::Update(const base::string16& text,
void SearchBoxModel::Update(const std::u16string& text,
bool initiated_by_user) {
if (text_ == text)
return;

@ -37,15 +37,14 @@ class APP_LIST_MODEL_EXPORT SearchBoxModel {
// Sets/gets the text for the search box's Textfield and the voice search
// flag.
void Update(const base::string16& text,
bool initiated_by_user);
const base::string16& text() const { return text_; }
void Update(const std::u16string& text, bool initiated_by_user);
const std::u16string& text() const { return text_; }
void AddObserver(SearchBoxModelObserver* observer);
void RemoveObserver(SearchBoxModelObserver* observer);
private:
base::string16 text_;
std::u16string text_;
bool search_engine_is_google_ = false;
bool is_tablet_mode_ = false;
bool show_assistant_button_ = false;

@ -38,7 +38,7 @@ void SearchResult::SetChipIcon(const gfx::ImageSkia& chip_icon) {
observer.OnMetadataChanged();
}
void SearchResult::set_title(const base::string16& title) {
void SearchResult::set_title(const std::u16string& title) {
metadata_->title = title;
for (auto& observer : observers_)
observer.OnMetadataChanged();
@ -56,7 +56,7 @@ void SearchResult::SetRating(float rating) {
observer.OnMetadataChanged();
}
void SearchResult::SetFormattedPrice(const base::string16& formatted_price) {
void SearchResult::SetFormattedPrice(const std::u16string& formatted_price) {
metadata_->formatted_price = formatted_price;
for (auto& observer : observers_)
observer.OnMetadataChanged();

@ -57,34 +57,34 @@ class APP_LIST_MODEL_EXPORT SearchResult {
const ui::ImageModel& badge_icon() const { return metadata_->badge_icon; }
void SetBadgeIcon(const ui::ImageModel& badge_icon);
const base::string16& title() const { return metadata_->title; }
void set_title(const base::string16& title);
const std::u16string& title() const { return metadata_->title; }
void set_title(const std::u16string& title);
const Tags& title_tags() const { return metadata_->title_tags; }
void set_title_tags(const Tags& tags) { metadata_->title_tags = tags; }
const base::string16& details() const { return metadata_->details; }
void set_details(const base::string16& details) {
const std::u16string& details() const { return metadata_->details; }
void set_details(const std::u16string& details) {
metadata_->details = details;
}
const Tags& details_tags() const { return metadata_->details_tags; }
void set_details_tags(const Tags& tags) { metadata_->details_tags = tags; }
const base::string16& accessible_name() const {
const std::u16string& accessible_name() const {
return metadata_->accessible_name;
}
void set_accessible_name(const base::string16& name) {
void set_accessible_name(const std::u16string& name) {
metadata_->accessible_name = name;
}
float rating() const { return metadata_->rating; }
void SetRating(float rating);
const base::string16& formatted_price() const {
const std::u16string& formatted_price() const {
return metadata_->formatted_price;
}
void SetFormattedPrice(const base::string16& formatted_price);
void SetFormattedPrice(const std::u16string& formatted_price);
const base::Optional<GURL>& query_url() const { return metadata_->query_url; }
void set_query_url(const GURL& url) { metadata_->query_url = url; }

@ -168,7 +168,7 @@ void AppListTestViewDelegate::OnSearchResultVisibilityChanged(
bool visibility) {}
void AppListTestViewDelegate::NotifySearchResultsForLogging(
const base::string16& raw_query,
const std::u16string& raw_query,
const ash::SearchResultIdWithPositionIndices& results,
int position_index) {}

@ -62,7 +62,7 @@ class AppListTestViewDelegate : public AppListViewDelegate,
SearchModel* GetSearchModel() override;
bool KeyboardTraversalEngaged() override;
void StartAssistant() override {}
void StartSearch(const base::string16& raw_query) override {}
void StartSearch(const std::u16string& raw_query) override {}
void OpenSearchResult(const std::string& result_id,
int event_flags,
ash::AppListLaunchedFrom launched_from,
@ -95,7 +95,7 @@ class AppListTestViewDelegate : public AppListViewDelegate,
void OnSearchResultVisibilityChanged(const std::string& id,
bool visibility) override;
void NotifySearchResultsForLogging(
const base::string16& raw_query,
const std::u16string& raw_query,
const ash::SearchResultIdWithPositionIndices& results,
int position_index) override;
void MaybeIncreaseSuggestedContentInfoShownCount() override;

@ -25,7 +25,7 @@ class TestAppListClient : public AppListClient {
// AppListClient:
void OnAppListControllerDestroyed() override {}
void StartSearch(const base::string16& trimmed_query) override {}
void StartSearch(const std::u16string& trimmed_query) override {}
void OpenSearchResult(const std::string& result_id,
int event_flags,
AppListLaunchedFrom launched_from,
@ -60,7 +60,7 @@ class TestAppListClient : public AppListClient {
const std::string& setting_name,
const std::map<std::string, int>& values) override {}
void NotifySearchResultsForLogging(
const base::string16& trimmed_query,
const std::u16string& trimmed_query,
const SearchResultIdWithPositionIndices& results,
int position_index) override {}
AppListNotifier* GetNotifier() override;

@ -511,9 +511,9 @@ const AppListConfig& AppListItemView::GetAppListConfig() const {
return apps_grid_view_->GetAppListConfig();
}
void AppListItemView::SetItemName(const base::string16& display_name,
const base::string16& full_name) {
const base::string16 folder_name_placeholder =
void AppListItemView::SetItemName(const std::u16string& display_name,
const std::u16string& full_name) {
const std::u16string folder_name_placeholder =
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_APP_LIST_FOLDER_NAME_PLACEHOLDER);
if (is_folder_ && display_name.empty())
@ -521,7 +521,7 @@ void AppListItemView::SetItemName(const base::string16& display_name,
else
title_->SetText(display_name);
tooltip_text_ = display_name == full_name ? base::string16() : full_name;
tooltip_text_ = display_name == full_name ? std::u16string() : full_name;
// Use full name for accessibility.
SetAccessibleName(
@ -861,14 +861,14 @@ void AppListItemView::OnThemeChanged() {
SchedulePaint();
}
base::string16 AppListItemView::GetTooltipText(const gfx::Point& p) const {
std::u16string AppListItemView::GetTooltipText(const gfx::Point& p) const {
// Use the label to generate a tooltip, so that it will consider its text
// truncation in making the tooltip. We do not want the label itself to have a
// tooltip, so we only temporarily enable it to get the tooltip text from the
// label, then disable it again.
title_->SetHandlesTooltips(true);
title_->SetTooltipText(tooltip_text_);
base::string16 tooltip = title_->GetTooltipText(p);
std::u16string tooltip = title_->GetTooltipText(p);
title_->SetHandlesTooltips(false);
return tooltip;
}

@ -57,8 +57,8 @@ class APP_LIST_EXPORT AppListItemView : public views::Button,
// config state.
void RefreshIcon();
void SetItemName(const base::string16& display_name,
const base::string16& full_name);
void SetItemName(const std::u16string& display_name,
const std::u16string& full_name);
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
@ -126,7 +126,7 @@ class APP_LIST_EXPORT AppListItemView : public views::Button,
void OnThemeChanged() override;
// views::View overrides:
base::string16 GetTooltipText(const gfx::Point& p) const override;
std::u16string GetTooltipText(const gfx::Point& p) const override;
// When a dragged view enters this view, a preview circle is shown for
// non-folder item while the icon is enlarged for folder item. When a
@ -286,7 +286,7 @@ class APP_LIST_EXPORT AppListItemView : public views::Button,
// Whether |context_menu_| was shown via key event.
bool menu_show_initiated_from_key_ = false;
base::string16 tooltip_text_;
std::u16string tooltip_text_;
// A timer to defer showing drag UI when mouse is pressed.
base::OneShotTimer mouse_drag_timer_;

@ -182,8 +182,8 @@ void AppListMainView::OnAppListStateChanged(AppListState new_state,
}
void AppListMainView::QueryChanged(SearchBoxViewBase* sender) {
base::string16 raw_query = search_model_->search_box()->text();
base::string16 query;
std::u16string raw_query = search_model_->search_box()->text();
std::u16string query;
base::TrimWhitespace(raw_query, base::TRIM_ALL, &query);
contents_view_->ShowSearchResults(search_box_view_->is_search_box_active() ||
!query.empty());
@ -199,8 +199,8 @@ void AppListMainView::ActiveChanged(SearchBoxViewBase* sender) {
if (search_box_view_->is_search_box_active()) {
// Show zero state suggestions when search box is activated with an empty
// query.
base::string16 raw_query = search_model_->search_box()->text();
base::string16 query;
std::u16string raw_query = search_model_->search_box()->text();
std::u16string query;
base::TrimWhitespace(raw_query, base::TRIM_ALL, &query);
if (query.empty())
search_box_view_->ShowZeroStateSuggestions();

@ -1275,7 +1275,7 @@ void AppListView::MaybeCreateAccessibilityEvent(AppListViewState new_state) {
if (!delegate_->AppListTargetVisibility())
return;
base::string16 state_announcement;
std::u16string state_announcement;
if (new_state == AppListViewState::kPeeking) {
state_announcement = l10n_util::GetStringUTF16(

@ -263,7 +263,7 @@ class AppListViewTest : public views::ViewsTestBase,
views::Textfield* search_box =
view_->app_list_main_view()->search_box_view()->search_box();
// Set new text as if it is typed by a user.
search_box->SetText(base::string16());
search_box->SetText(std::u16string());
search_box->InsertText(
base::UTF8ToUTF16(text),
ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText);
@ -657,7 +657,7 @@ class AppListViewFocusTest : public views::ViewsTestBase,
TestLeftAndRightKeyTraversalOnTextfield(textfield);
// Type something in textfield.
base::string16 text =
std::u16string text =
text_rtl
// Arabic word of "test".
? base::UTF8ToUTF16(
@ -959,7 +959,7 @@ TEST_F(AppListViewFocusTest, CloseButtonClearsSearchOnEnter) {
// Enter - it should clear the search box.
SimulateKeyPress(ui::VKEY_RETURN, false /*shift_down*/);
EXPECT_TRUE(search_box_view()->search_box()->HasFocus());
EXPECT_EQ(base::string16(), search_box_view()->search_box()->GetText());
EXPECT_EQ(std::u16string(), search_box_view()->search_box()->GetText());
EXPECT_FALSE(search_box_view()->is_search_box_active());
EXPECT_FALSE(contents_view()->search_results_page_view()->GetVisible());
ResultSelectionController* selection_controller =
@ -986,7 +986,7 @@ TEST_P(AppListViewFocusTest, LeftRightFocusTraversalInHalfState) {
// Type something in search box to transition to HALF state and populate
// fake search results.
// Type something in textfield.
base::string16 text =
std::u16string text =
is_rtl_
// Arabic word of "test".
? base::UTF8ToUTF16(
@ -1689,7 +1689,7 @@ TEST_F(AppListViewTest, EmptySearchTextStillPeeking) {
view_->app_list_main_view()->search_box_view()->search_box();
Show();
search_box->SetText(base::string16());
search_box->SetText(std::u16string());
ASSERT_EQ(ash::AppListViewState::kPeeking, view_->app_list_state());
}
@ -1770,7 +1770,7 @@ TEST_F(AppListViewTest, TypingPeekingToHalf) {
view_->app_list_main_view()->search_box_view()->search_box();
Show();
search_box->SetText(base::string16());
search_box->SetText(std::u16string());
search_box->InsertText(
base::UTF8ToUTF16("nice"),
ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText);
@ -1787,7 +1787,7 @@ TEST_F(AppListViewTest, TypingFullscreenToFullscreenSearch) {
views::Textfield* search_box =
view_->app_list_main_view()->search_box_view()->search_box();
search_box->SetText(base::string16());
search_box->SetText(std::u16string());
search_box->InsertText(
base::UTF8ToUTF16("https://youtu.be/dQw4w9WgXcQ"),
ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText);
@ -1802,7 +1802,7 @@ TEST_F(AppListViewTest, TypingTabletModeFullscreenSearch) {
view_->app_list_main_view()->search_box_view()->search_box();
Show();
search_box->SetText(base::string16());
search_box->SetText(std::u16string());
search_box->InsertText(
base::UTF8ToUTF16("cool!"),
ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText);
@ -2217,8 +2217,8 @@ TEST_F(AppListViewTest, DISABLED_SearchResultsTest) {
view_->Layout();
EXPECT_TRUE(IsStateShown(ash::AppListState::kStateApps));
base::string16 search_text = base::UTF8ToUTF16("test");
main_view->search_box_view()->search_box()->SetText(base::string16());
std::u16string search_text = base::UTF8ToUTF16("test");
main_view->search_box_view()->search_box()->SetText(std::u16string());
main_view->search_box_view()->search_box()->InsertText(
search_text,
ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText);
@ -2238,8 +2238,8 @@ TEST_F(AppListViewTest, DISABLED_SearchResultsTest) {
EXPECT_TRUE(CheckSearchBoxWidget(
contents_view->GetSearchBoxBounds(ash::AppListState::kStateApps)));
base::string16 new_search_text = base::UTF8ToUTF16("apple");
main_view->search_box_view()->search_box()->SetText(base::string16());
std::u16string new_search_text = base::UTF8ToUTF16("apple");
main_view->search_box_view()->search_box()->SetText(std::u16string());
main_view->search_box_view()->search_box()->InsertText(
new_search_text,
ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText);
@ -2293,8 +2293,8 @@ TEST_F(AppListViewTest, DISABLED_BackTest) {
EXPECT_EQ(1, delegate_->dismiss_count());
// Show the search results.
base::string16 new_search_text = base::UTF8ToUTF16("apple");
search_box_view->search_box()->SetText(base::string16());
std::u16string new_search_text = base::UTF8ToUTF16("apple");
search_box_view->search_box()->SetText(std::u16string());
search_box_view->search_box()->InsertText(
new_search_text,
ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText);

@ -1882,10 +1882,10 @@ void AppsGridView::HandleKeyboardFoldering(ui::KeyboardCode key_code) {
if (!CanMoveSelectedToTargetForKeyboardFoldering(target_index))
return;
const base::string16 moving_view_title = selected_view_->title()->GetText();
const std::u16string moving_view_title = selected_view_->title()->GetText();
AppListItemView* target_view =
GetViewDisplayedAtSlotOnCurrentPage(target_index.slot);
const base::string16 target_view_title = target_view->title()->GetText();
const std::u16string target_view_title = target_view->title()->GetText();
const bool target_view_is_folder = target_view->is_folder();
AppListItemView* folder_item = MoveItemToFolder(selected_view_, target_index);
@ -3755,7 +3755,7 @@ void AppsGridView::StartFolderDroppingAnimation(
// Start animation.
auto animation_view = std::make_unique<TopIconAnimationView>(
this, drag_item->GetIcon(GetAppListConfig().type()), base::string16(),
this, drag_item->GetIcon(GetAppListConfig().type()), std::u16string(),
target_bounds, false, true);
auto* animation_view_ptr =
items_container_->AddChildView(std::move(animation_view));
@ -3784,7 +3784,7 @@ void AppsGridView::MaybeCreateFolderDroppingAccessibilityEvent() {
}
void AppsGridView::AnnounceItemNotificationBadge(
const base::string16& selected_view_title) {
const std::u16string& selected_view_title) {
// Set a11y name to announce the notification badge for the focused item.
auto* announcement_view =
contents_view_->app_list_view()->announcement_view();
@ -3794,8 +3794,8 @@ void AppsGridView::AnnounceItemNotificationBadge(
announcement_view->NotifyAccessibilityEvent(ax::mojom::Event::kAlert, true);
}
void AppsGridView::AnnounceFolderDrop(const base::string16& moving_view_title,
const base::string16& target_view_title,
void AppsGridView::AnnounceFolderDrop(const std::u16string& moving_view_title,
const std::u16string& target_view_title,
bool target_is_folder) {
// Set a11y name to announce possible move to folder or creation of folder.
auto* announcement_view =
@ -3810,8 +3810,8 @@ void AppsGridView::AnnounceFolderDrop(const base::string16& moving_view_title,
}
void AppsGridView::AnnounceKeyboardFoldering(
const base::string16& moving_view_title,
const base::string16& target_view_title,
const std::u16string& moving_view_title,
const std::u16string& target_view_title,
bool target_is_folder) {
// Set a11y name to announce keyboard move to folder or creation of folder.
auto* announcement_view =

@ -712,21 +712,21 @@ class APP_LIST_EXPORT AppsGridView : public views::View,
// Modifies the announcement view to verbalize that the focused view has new
// updates, based on the item having a notification badge.
void AnnounceItemNotificationBadge(const base::string16& selected_view_title);
void AnnounceItemNotificationBadge(const std::u16string& selected_view_title);
// Modifies the announcement view to verbalize that the current drag will move
// |moving_view_title| and create a folder or move it into an existing folder
// with |target_view_title|.
void AnnounceFolderDrop(const base::string16& moving_view_title,
const base::string16& target_view_title,
void AnnounceFolderDrop(const std::u16string& moving_view_title,
const std::u16string& target_view_title,
bool target_is_folder);
// Modifies the announcement view to vervalize that the most recent keyboard
// foldering action has either moved |moving_view_title| into
// |target_view_title| folder or that |moving_view_title| and
// |target_view_title| have formed a new folder.
void AnnounceKeyboardFoldering(const base::string16& moving_view_title,
const base::string16& target_view_title,
void AnnounceKeyboardFoldering(const std::u16string& moving_view_title,
const std::u16string& target_view_title,
bool target_is_folder);
// During an app drag, creates an a11y event to verbalize drop target

@ -127,7 +127,7 @@ gfx::Size AssistantDialogPlate::CalculatePreferredSize() const {
void AssistantDialogPlate::OnButtonPressed(AssistantButtonId button_id) {
delegate_->OnDialogPlateButtonPressed(button_id);
textfield_->SetText(base::string16());
textfield_->SetText(std::u16string());
}
bool AssistantDialogPlate::HandleKeyEvent(views::Textfield* textfield,
@ -153,7 +153,7 @@ bool AssistantDialogPlate::HandleKeyEvent(views::Textfield* textfield,
base::UTF16ToUTF8(trimmed_text));
}
textfield_->SetText(base::string16());
textfield_->SetText(std::u16string());
return true;
}
@ -281,7 +281,7 @@ void AssistantDialogPlate::OnUiVisibilityChanged(
} else {
// When the Assistant UI is no longer visible we need to clear the dialog
// plate so that text does not persist across Assistant launches.
textfield_->SetText(base::string16());
textfield_->SetText(std::u16string());
HideKeyboardIfEnabled();
}

@ -854,7 +854,7 @@ TEST_F(AssistantPageViewTest, RememberAndShowHistory) {
}
TEST_F(AssistantPageViewTest, ShouldNotClearQueryWhenSwitchingToTabletMode) {
const base::string16 query_text = base::UTF8ToUTF16("unsubmitted query");
const std::u16string query_text = base::UTF8ToUTF16("unsubmitted query");
ShowAssistantUiInTextMode();
input_text_field()->SetText(query_text);

@ -217,7 +217,7 @@ class FolderHeaderView::FolderNameView : public views::Textfield,
// Name of the folder when FolderNameView is focused, used to track folder
// rename metric.
base::string16 starting_name_;
std::u16string starting_name_;
// If the view is focused via a mouse press event, then selection will be
// cleared by its mouse release. To address this, defer selecting all
@ -295,8 +295,8 @@ void FolderHeaderView::Update() {
folder_name_view_->SetVisible(folder_name_visible_);
if (folder_name_visible_) {
base::string16 folder_name = base::UTF8ToUTF16(folder_item_->name());
base::string16 elided_folder_name = GetElidedFolderName(folder_name);
std::u16string folder_name = base::UTF8ToUTF16(folder_item_->name());
std::u16string elided_folder_name = GetElidedFolderName(folder_name);
folder_name_view_->SetText(elided_folder_name);
UpdateFolderNameAccessibleName();
}
@ -309,17 +309,17 @@ void FolderHeaderView::UpdateFolderNameAccessibleName() {
// |folder_name_view_| is blank; otherwise, clear the accessible name, the
// accessible state's value is set to be folder_name_view_->GetText() by
// TextField.
base::string16 accessible_name = folder_name_view_->GetText().empty()
std::u16string accessible_name = folder_name_view_->GetText().empty()
? folder_name_placeholder_text_
: base::string16();
: std::u16string();
folder_name_view_->SetAccessibleName(accessible_name);
}
const base::string16& FolderHeaderView::GetFolderNameForTest() {
const std::u16string& FolderHeaderView::GetFolderNameForTest() {
return folder_name_view_->GetText();
}
void FolderHeaderView::SetFolderNameForTest(const base::string16& name) {
void FolderHeaderView::SetFolderNameForTest(const std::u16string& name) {
folder_name_view_->SetText(name);
}
@ -348,17 +348,17 @@ int FolderHeaderView::GetMaxFolderNameWidth() const {
return AppListConfig::instance().folder_header_max_width();
}
base::string16 FolderHeaderView::GetElidedFolderName(
const base::string16& folder_name) const {
std::u16string FolderHeaderView::GetElidedFolderName(
const std::u16string& folder_name) const {
// Enforce the maximum folder name length.
base::string16 name =
std::u16string name =
folder_name.substr(0, AppListConfig::instance().max_folder_name_chars());
// Get maximum text width for fitting into |folder_name_view_|.
int text_width = std::min(GetMaxFolderNameWidth(), width()) -
folder_name_view_->GetCaretBounds().width() -
folder_name_view_->GetInsets().width();
base::string16 elided_name = gfx::ElideText(
std::u16string elided_name = gfx::ElideText(
name, folder_name_view_->GetFontList(), text_width, gfx::ELIDE_TAIL);
return elided_name;
}
@ -370,7 +370,7 @@ void FolderHeaderView::Layout() {
gfx::Rect text_bounds(rect);
base::string16 text = folder_name_view_->GetText().empty()
std::u16string text = folder_name_view_->GetText().empty()
? folder_name_placeholder_text_
: folder_name_view_->GetText();
int text_width =
@ -390,7 +390,7 @@ void FolderHeaderView::Layout() {
}
void FolderHeaderView::ContentsChanged(views::Textfield* sender,
const base::string16& new_contents) {
const std::u16string& new_contents) {
// Temporarily remove from observer to ignore data change caused by us.
if (!folder_item_)
return;
@ -445,7 +445,7 @@ void FolderHeaderView::SetPreviousCursorPositionForTest(
}
void FolderHeaderView::SetPreviousFolderNameForTest(
const base::string16& previous_name) {
const std::u16string& previous_name) {
previous_folder_name_ = previous_name;
}

@ -58,8 +58,8 @@ class APP_LIST_EXPORT FolderHeaderView : public views::View,
void UpdateFolderNameAccessibleName();
// Gets and sets the folder name for test.
const base::string16& GetFolderNameForTest();
void SetFolderNameForTest(const base::string16& name);
const std::u16string& GetFolderNameForTest();
void SetFolderNameForTest(const std::u16string& name);
// Returns true if folder name is enabled, only for testing use.
bool IsFolderNameEnabledForTest() const;
@ -67,7 +67,7 @@ class APP_LIST_EXPORT FolderHeaderView : public views::View,
int GetMaxFolderNameWidth() const;
// Returns elided folder name from |folder_name|.
base::string16 GetElidedFolderName(const base::string16& folder_name) const;
std::u16string GetElidedFolderName(const std::u16string& folder_name) const;
// Returns whether |folder_name_view_| should clear focus based on
// |key_event_|.
@ -78,7 +78,7 @@ class APP_LIST_EXPORT FolderHeaderView : public views::View,
// views::TextfieldController overrides:
void ContentsChanged(views::Textfield* sender,
const base::string16& new_contents) override;
const std::u16string& new_contents) override;
bool HandleKeyEvent(views::Textfield* sender,
const ui::KeyEvent& key_event) override;
void OnBeforeUserAction(views::Textfield* sender) override;
@ -90,11 +90,11 @@ class APP_LIST_EXPORT FolderHeaderView : public views::View,
void SetPreviousCursorPositionForTest(const size_t cursor_position);
// Sets the |previous_folder_name_|, only for testing use
void SetPreviousFolderNameForTest(const base::string16& previous_name);
void SetPreviousFolderNameForTest(const std::u16string& previous_name);
// Used to restore the folder name if the new folder name is longer than the
// max chars folder length allowed
base::Optional<base::string16> previous_folder_name_;
base::Optional<std::u16string> previous_folder_name_;
// Used to restore the cursor position to its last known location when
// resetting the folder name in textfield
@ -104,7 +104,7 @@ class APP_LIST_EXPORT FolderHeaderView : public views::View,
FolderNameView* folder_name_view_; // Owned by views hierarchy.
const base::string16 folder_name_placeholder_text_;
const std::u16string folder_name_placeholder_text_;
FolderHeaderViewDelegate* delegate_;

@ -89,7 +89,7 @@ class FolderHeaderViewTest : public views::ViewsTestBase {
protected:
void UpdateFolderName(const std::string& name) {
base::string16 folder_name = base::UTF8ToUTF16(name);
std::u16string folder_name = base::UTF8ToUTF16(name);
folder_header_view_->SetFolderNameForTest(folder_name);
folder_header_view_->ContentsChanged(textfield_.get(), folder_name);
}
@ -107,7 +107,7 @@ class FolderHeaderViewTest : public views::ViewsTestBase {
previous_cursor_position);
}
void UpdatePreviousFolderName(const base::string16& previous_name) {
void UpdatePreviousFolderName(const std::u16string& previous_name) {
folder_header_view_->SetPreviousFolderNameForTest(previous_name);
}
@ -164,7 +164,7 @@ TEST_F(FolderHeaderViewTest, MaxFolderNameLength) {
}
std::string too_long_name = max_len_name + "a";
UpdatePreviousCursorPosition(0);
UpdatePreviousFolderName(base::string16());
UpdatePreviousFolderName(std::u16string());
// Expect that the folder name does not change, and does not truncate
UpdateFolderName(too_long_name);

@ -245,9 +245,9 @@ void PrivacyInfoView::InitInfoIcon() {
}
void PrivacyInfoView::InitText() {
const base::string16 link = l10n_util::GetStringUTF16(link_string_id_);
const std::u16string link = l10n_util::GetStringUTF16(link_string_id_);
size_t offset;
const base::string16 text =
const std::u16string text =
l10n_util::GetStringFUTF16(info_string_id_, link, &offset);
text_view_ = AddChildView(std::make_unique<PrivacyTextView>(this));
text_view_->SetText(text);
@ -286,7 +286,7 @@ void PrivacyInfoView::InitCloseButton() {
gfx::kGoogleGrey700));
close_button->SetImageHorizontalAlignment(views::ImageButton::ALIGN_CENTER);
close_button->SetImageVerticalAlignment(views::ImageButton::ALIGN_MIDDLE);
base::string16 close_button_label(l10n_util::GetStringUTF16(IDS_APP_CLOSE));
std::u16string close_button_label(l10n_util::GetStringUTF16(IDS_APP_CLOSE));
close_button->SetAccessibleName(close_button_label);
close_button->SetTooltipText(close_button_label);
close_button->SetFocusBehavior(FocusBehavior::ALWAYS);

@ -24,7 +24,7 @@ constexpr int kDialogWidth = 320;
} // namespace
RemoveQueryConfirmationDialog::RemoveQueryConfirmationDialog(
const base::string16& query,
const std::u16string& query,
RemovalConfirmationCallback confirm_callback)
: confirm_callback_(std::move(confirm_callback)) {
SetModalType(ui::MODAL_TYPE_WINDOW);

@ -21,7 +21,7 @@ class RemoveQueryConfirmationDialog : public views::DialogDelegateView {
// associated result.
using RemovalConfirmationCallback = base::OnceCallback<void(bool)>;
RemoveQueryConfirmationDialog(const base::string16& query,
RemoveQueryConfirmationDialog(const std::u16string& query,
RemovalConfirmationCallback callback);
~RemoveQueryConfirmationDialog() override;

@ -120,7 +120,7 @@ class TestContainer : public TestContainerDelegateHarness,
result_view->GetActionsView()->SetActions(
std::vector<SearchResult::Action>(
params.actions_per_result.value(),
SearchResult::Action(gfx::ImageSkia(), base::string16(),
SearchResult::Action(gfx::ImageSkia(), std::u16string(),
false)));
search_result_views_.emplace_back(std::move(result_view));
} else {
@ -1284,7 +1284,7 @@ TEST_F(ResultSelectionTest, ActionRemovedWhileSelected) {
// Remove two trailing actions - the result action is de-selected.
selected_view->AsResultViewWithActions()->GetActionsView()->SetActions(
std::vector<SearchResult::Action>(
1, SearchResult::Action(gfx::ImageSkia(), base::string16(), false)));
1, SearchResult::Action(gfx::ImageSkia(), std::u16string(), false)));
ASSERT_EQ(create_test_location(0, 1), GetCurrentLocation());
EXPECT_TRUE(CurrentResultActionNotSelected());

@ -75,8 +75,8 @@ float GetAssistantButtonOpacityForState(AppListState state) {
return 1.f;
}
bool IsTrimmedQueryEmpty(const base::string16& query) {
base::string16 trimmed_query;
bool IsTrimmedQueryEmpty(const std::u16string& query) {
std::u16string trimmed_query;
base::TrimWhitespace(query, base::TrimPositions::TRIM_ALL, &trimmed_query);
return trimmed_query.empty();
}
@ -244,7 +244,7 @@ void SearchBoxView::SetupCloseButton() {
AppListColorProvider::Get()->GetSearchBoxIconColor(
gfx::kGoogleGrey700)));
close->SetVisible(false);
base::string16 close_button_label(
std::u16string close_button_label(
l10n_util::GetStringUTF16(IDS_APP_LIST_CLEAR_SEARCHBOX));
close->SetAccessibleName(close_button_label);
close->SetTooltipText(close_button_label);
@ -258,7 +258,7 @@ void SearchBoxView::SetupBackButton() {
back->SetImageHorizontalAlignment(views::ImageButton::ALIGN_CENTER);
back->SetImageVerticalAlignment(views::ImageButton::ALIGN_MIDDLE);
back->SetVisible(false);
base::string16 back_button_label(
std::u16string back_button_label(
l10n_util::GetStringUTF16(IDS_APP_LIST_BACK));
back->SetAccessibleName(back_button_label);
back->SetTooltipText(back_button_label);
@ -293,7 +293,7 @@ void SearchBoxView::RecordSearchBoxActivationHistogram(
void SearchBoxView::OnSearchBoxActiveChanged(bool active) {
if (active) {
search_box()->SetAccessibleName(base::string16());
search_box()->SetAccessibleName(std::u16string());
} else {
search_box()->SetAccessibleName(l10n_util::GetStringUTF16(
is_tablet_mode_
@ -399,7 +399,7 @@ SkColor SearchBoxView::GetBackgroundColorForState(AppListState state) const {
void SearchBoxView::ShowZeroStateSuggestions() {
base::RecordAction(
base::UserMetricsAction("AppList_ShowZeroStateSuggestions"));
base::string16 empty_query;
std::u16string empty_query;
ContentsChanged(search_box(), empty_query);
}
@ -439,7 +439,7 @@ void SearchBoxView::ProcessAutocomplete() {
}
// Current non-autocompleted text.
const base::string16& user_typed_text =
const std::u16string& user_typed_text =
search_box()->GetText().substr(0, highlight_range_.start());
if (last_key_pressed_ == ui::VKEY_BACK ||
last_key_pressed_ == ui::VKEY_DELETE || IsArrowKey(last_key_pressed_) ||
@ -450,8 +450,8 @@ void SearchBoxView::ProcessAutocomplete() {
return;
}
const base::string16& details = first_visible_result->details();
const base::string16& search_text = first_visible_result->title();
const std::u16string& details = first_visible_result->details();
const std::u16string& search_text = first_visible_result->title();
if (base::StartsWith(details, user_typed_text,
base::CompareCase::INSENSITIVE_ASCII)) {
// Current text in the search_box matches the first result's url.
@ -523,7 +523,7 @@ void SearchBoxView::OnBeforeUserAction(views::Textfield* sender) {
}
void SearchBoxView::ContentsChanged(views::Textfield* sender,
const base::string16& new_contents) {
const std::u16string& new_contents) {
if (IsTrimmedQueryEmpty(current_query_) && !IsSearchBoxTrimmedQueryEmpty()) {
// User enters a new search query. Record the action.
base::RecordAction(base::UserMetricsAction("AppList_SearchQueryStarted"));
@ -540,11 +540,11 @@ void SearchBoxView::ContentsChanged(views::Textfield* sender,
}
void SearchBoxView::SetAutocompleteText(
const base::string16& autocomplete_text) {
const std::u16string& autocomplete_text) {
if (!ShouldProcessAutocomplete())
return;
const base::string16& current_text = search_box()->GetText();
const std::u16string& current_text = search_box()->GetText();
// Currrent text is a prefix of autocomplete text.
DCHECK(base::StartsWith(autocomplete_text, current_text,
base::CompareCase::INSENSITIVE_ASCII));
@ -552,7 +552,7 @@ void SearchBoxView::SetAutocompleteText(
if (autocomplete_text == current_text)
return;
const base::string16& highlighted_text =
const std::u16string& highlighted_text =
autocomplete_text.substr(highlight_range_.start());
// Don't set autocomplete text if the highlighted text is the same as before.
@ -581,7 +581,7 @@ void SearchBoxView::SetAutocompleteText(
NotifyAccessibilityEvent(ax::mojom::Event::kValueChanged, true);
}
void SearchBoxView::UpdateQuery(const base::string16& new_query) {
void SearchBoxView::UpdateQuery(const std::u16string& new_query) {
search_box()->SetText(new_query);
ContentsChanged(search_box(), new_query);
}
@ -670,7 +670,7 @@ bool SearchBoxView::HandleKeyEvent(views::Textfield* sender,
selected_result->OnKeyEvent(&event);
// Reset the selected result to the default result.
selection_controller->ResetSelection(nullptr, true /* default_selection */);
search_box()->SetText(base::string16());
search_box()->SetText(std::u16string());
return true;
}
@ -819,7 +819,7 @@ void SearchBoxView::SetupAssistantButton() {
gfx::CreateVectorIcon(chromeos::kAssistantIcon, kSearchBoxIconSize,
AppListColorProvider::Get()->GetSearchBoxIconColor(
gfx::kGoogleGrey700)));
base::string16 assistant_button_label(
std::u16string assistant_button_label(
l10n_util::GetStringUTF16(IDS_APP_LIST_START_ASSISTANT));
assistant->SetAccessibleName(assistant_button_label);
assistant->SetTooltipText(assistant_button_label);

@ -99,7 +99,7 @@ class APP_LIST_EXPORT SearchBoxView : public SearchBoxViewBase,
void ProcessAutocomplete();
// Updates the search box with |new_query| and starts a new search.
void UpdateQuery(const base::string16& new_query);
void UpdateQuery(const std::u16string& new_query);
// Clears the search query and de-activate the search box.
void ClearSearchAndDeactivateSearchBox();
@ -133,12 +133,12 @@ class APP_LIST_EXPORT SearchBoxView : public SearchBoxViewBase,
// After verifying autocomplete text is valid, sets the current searchbox
// text to the autocomplete text and sets the text highlight.
void SetAutocompleteText(const base::string16& autocomplete_text);
void SetAutocompleteText(const std::u16string& autocomplete_text);
// Overridden from views::TextfieldController:
void OnBeforeUserAction(views::Textfield* sender) override;
void ContentsChanged(views::Textfield* sender,
const base::string16& new_contents) override;
const std::u16string& new_contents) override;
bool HandleKeyEvent(views::Textfield* sender,
const ui::KeyEvent& key_event) override;
bool HandleMouseEvent(views::Textfield* sender,
@ -161,7 +161,7 @@ class APP_LIST_EXPORT SearchBoxView : public SearchBoxViewBase,
// Clear highlight range.
void ResetHighlightRange();
base::string16 current_query_;
std::u16string current_query_;
// The range of highlighted text for autocomplete.
gfx::Range highlight_range_;

@ -123,13 +123,13 @@ class SearchBoxViewTest : public views::test::WidgetTest,
if (::isalnum(static_cast<int>(key_code))) {
char16_t character = ::tolower(static_cast<int>(key_code));
view()->search_box()->InsertText(
base::string16(1, character),
std::u16string(1, character),
ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText);
}
}
std::string GetLastQueryAndReset() {
base::string16 query = last_query_;
std::u16string query = last_query_;
last_query_.clear();
return base::UTF16ToUTF8(query);
}
@ -143,8 +143,8 @@ class SearchBoxViewTest : public views::test::WidgetTest,
// Creates a SearchResult with the given parameters.
void CreateSearchResult(ash::SearchResultDisplayType display_type,
double display_score,
const base::string16& title,
const base::string16& details) {
const std::u16string& title,
const std::u16string& details) {
CreateSearchResultAt(results()->item_count(), display_type, display_score,
title, details);
}
@ -154,8 +154,8 @@ class SearchBoxViewTest : public views::test::WidgetTest,
void CreateSearchResultAt(size_t index,
ash::SearchResultDisplayType display_type,
double display_score,
const base::string16& title,
const base::string16& details) {
const std::u16string& title,
const std::u16string& details) {
auto search_result = std::make_unique<TestSearchResult>();
search_result->set_result_id(base::NumberToString(++last_result_id_));
search_result->set_display_type(display_type);
@ -186,7 +186,7 @@ class SearchBoxViewTest : public views::test::WidgetTest,
AppListView* app_list_view_ = nullptr;
std::unique_ptr<SearchBoxView> view_;
KeyPressCounterView* counter_view_;
base::string16 last_query_;
std::u16string last_query_;
int query_changed_count_ = 0;
int last_result_id_ = 0;
@ -312,9 +312,9 @@ TEST_F(SearchBoxViewTest, ChangeSelectionWhileResultsAreChanging) {
SetSearchBoxActive(true, ui::ET_UNKNOWN);
view()->search_box()->SetText(base::ASCIIToUTF16("test"));
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.7,
base::ASCIIToUTF16("tester"), base::string16());
base::ASCIIToUTF16("tester"), std::u16string());
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.5,
base::ASCIIToUTF16("testing"), base::string16());
base::ASCIIToUTF16("testing"), std::u16string());
base::RunLoop().RunUntilIdle();
SearchResultPageView* const result_page_view =
@ -330,7 +330,7 @@ TEST_F(SearchBoxViewTest, ChangeSelectionWhileResultsAreChanging) {
// Add a new result - the selection controller is updated asynchronously, so
// the result is expected to remain the same until the loop is run.
CreateSearchResultAt(0, ash::SearchResultDisplayType::kList, 1.,
base::ASCIIToUTF16("test"), base::string16());
base::ASCIIToUTF16("test"), std::u16string());
EXPECT_EQ(selection,
result_page_view->result_selection_controller()->selected_result());
EXPECT_EQ(base::ASCIIToUTF16("tester"), selection->result()->title());
@ -365,9 +365,9 @@ TEST_F(SearchBoxViewTest, ChangeSelectionWhileResultsAreBeingRemoved) {
SetSearchBoxActive(true, ui::ET_UNKNOWN);
view()->search_box()->SetText(base::ASCIIToUTF16("test"));
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.7,
base::ASCIIToUTF16("tester"), base::string16());
base::ASCIIToUTF16("tester"), std::u16string());
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.5,
base::ASCIIToUTF16("testing"), base::string16());
base::ASCIIToUTF16("testing"), std::u16string());
base::RunLoop().RunUntilIdle();
SearchResultPageView* const result_page_view =
@ -385,7 +385,7 @@ TEST_F(SearchBoxViewTest, ChangeSelectionWhileResultsAreBeingRemoved) {
// the loop is run.
results()->RemoveAll();
CreateSearchResult(ash::SearchResultDisplayType::kList, 1.,
base::ASCIIToUTF16("test"), base::string16());
base::ASCIIToUTF16("test"), std::u16string());
EXPECT_EQ(selection,
result_page_view->result_selection_controller()->selected_result());
EXPECT_FALSE(selection->result());
@ -414,9 +414,9 @@ TEST_F(SearchBoxViewTest, UserSelectionNotOverridenByNewResults) {
SetSearchBoxActive(true, ui::ET_UNKNOWN);
view()->search_box()->SetText(base::ASCIIToUTF16("test"));
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.7,
base::ASCIIToUTF16("tester"), base::string16());
base::ASCIIToUTF16("tester"), std::u16string());
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.5,
base::ASCIIToUTF16("testing"), base::string16());
base::ASCIIToUTF16("testing"), std::u16string());
base::RunLoop().RunUntilIdle();
SearchResultPageView* const result_page_view =
@ -438,7 +438,7 @@ TEST_F(SearchBoxViewTest, UserSelectionNotOverridenByNewResults) {
// Add a new result - verify the selected result remains the same.
CreateSearchResultAt(0, ash::SearchResultDisplayType::kList, 0.9,
base::ASCIIToUTF16("test1"), base::string16());
base::ASCIIToUTF16("test1"), std::u16string());
// Finish results update.
base::RunLoop().RunUntilIdle();
@ -448,7 +448,7 @@ TEST_F(SearchBoxViewTest, UserSelectionNotOverridenByNewResults) {
// Add a new result at the end, and verify the selection stays the same.
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.2,
base::ASCIIToUTF16("testing almost"), base::string16());
base::ASCIIToUTF16("testing almost"), std::u16string());
base::RunLoop().RunUntilIdle();
selection =
@ -480,7 +480,7 @@ TEST_F(SearchBoxViewTest, UserSelectionNotOverridenByNewResults) {
// New result can override the default selection.
CreateSearchResultAt(0, ash::SearchResultDisplayType::kList, 1.0,
base::ASCIIToUTF16("test"), base::string16());
base::ASCIIToUTF16("test"), std::u16string());
base::RunLoop().RunUntilIdle();
selection =
@ -493,9 +493,9 @@ TEST_F(SearchBoxViewTest,
SetSearchBoxActive(true, ui::ET_UNKNOWN);
view()->search_box()->SetText(base::ASCIIToUTF16("test"));
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.7,
base::ASCIIToUTF16("tester"), base::string16());
base::ASCIIToUTF16("tester"), std::u16string());
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.5,
base::ASCIIToUTF16("testing"), base::string16());
base::ASCIIToUTF16("testing"), std::u16string());
base::RunLoop().RunUntilIdle();
SearchResultPageView* const result_page_view =
@ -518,7 +518,7 @@ TEST_F(SearchBoxViewTest,
// Add a new result in a tile container - verify the selected result remains
// the same.
CreateSearchResultAt(0, ash::SearchResultDisplayType::kTile, 0.9,
base::ASCIIToUTF16("test tile"), base::string16());
base::ASCIIToUTF16("test tile"), std::u16string());
// Finish results update.
base::RunLoop().RunUntilIdle();
@ -528,7 +528,7 @@ TEST_F(SearchBoxViewTest,
// Add a new result at the end, and verify the selection stays the same.
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.2,
base::ASCIIToUTF16("testing almost"), base::string16());
base::ASCIIToUTF16("testing almost"), std::u16string());
base::RunLoop().RunUntilIdle();
selection =
@ -554,7 +554,7 @@ TEST_F(SearchBoxViewTest,
// New result can override the default selection.
CreateSearchResultAt(0, ash::SearchResultDisplayType::kTile, 1.0,
base::ASCIIToUTF16("test"), base::string16());
base::ASCIIToUTF16("test"), std::u16string());
base::RunLoop().RunUntilIdle();
selection =
@ -567,9 +567,9 @@ TEST_F(SearchBoxViewTest,
TEST_F(SearchBoxViewTest, ResetSelectionAfterResettingSearchBox) {
SetSearchBoxActive(true, ui::ET_UNKNOWN);
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.7,
base::ASCIIToUTF16("test1"), base::string16());
base::ASCIIToUTF16("test1"), std::u16string());
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.5,
base::ASCIIToUTF16("test2"), base::string16());
base::ASCIIToUTF16("test2"), std::u16string());
base::RunLoop().RunUntilIdle();
SearchResultPageView* const result_page_view =
@ -647,7 +647,7 @@ TEST_F(SearchBoxViewTest, NavigateSuggestedContentInfo) {
// Set up the search box.
SetSearchBoxActive(true, ui::ET_UNKNOWN);
CreateSearchResult(ash::SearchResultDisplayType::kList, 1.0,
base::ASCIIToUTF16("test"), base::string16());
base::ASCIIToUTF16("test"), std::u16string());
base::RunLoop().RunUntilIdle();
SearchResultPageView* const result_page_view =
@ -701,7 +701,7 @@ TEST_F(SearchBoxViewTest, KeyboardEventClosesSuggestedContentInfo) {
// Set up the search box.
SetSearchBoxActive(true, ui::ET_UNKNOWN);
CreateSearchResult(ash::SearchResultDisplayType::kList, 1.0,
base::ASCIIToUTF16("test"), base::string16());
base::ASCIIToUTF16("test"), std::u16string());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(contents_view->search_results_page_view()
@ -731,7 +731,7 @@ TEST_F(SearchBoxViewTest, SuggestedContentActionNotOverriddenByNewResults) {
// Set up the search box.
SetSearchBoxActive(true, ui::ET_UNKNOWN);
CreateSearchResult(ash::SearchResultDisplayType::kList, 1.0,
base::ASCIIToUTF16("test"), base::string16());
base::ASCIIToUTF16("test"), std::u16string());
base::RunLoop().RunUntilIdle();
ResultSelectionController* const selection_controller =
@ -749,7 +749,7 @@ TEST_F(SearchBoxViewTest, SuggestedContentActionNotOverriddenByNewResults) {
// Create a new search result. The privacy view should have no actions
// remaining.
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.5,
base::ASCIIToUTF16("testing"), base::string16());
base::ASCIIToUTF16("testing"), std::u16string());
base::RunLoop().RunUntilIdle();
KeyPress(ui::VKEY_TAB);
@ -773,7 +773,7 @@ TEST_F(SearchBoxViewTest, SuggestedContentSelectionDoesNotChangeSearchBoxText) {
// Set up the search box.
SetSearchBoxActive(true, ui::ET_UNKNOWN);
CreateSearchResult(ash::SearchResultDisplayType::kList, 1.0,
base::ASCIIToUTF16("test"), base::string16());
base::ASCIIToUTF16("test"), std::u16string());
base::RunLoop().RunUntilIdle();
ResultSelectionController* const selection_controller =
@ -872,7 +872,7 @@ class SearchBoxViewAutocompleteTest
void SetupAutocompleteBehaviorTest() {
// Add a search result with a non-empty title field.
CreateSearchResult(ash::SearchResultDisplayType::kList, 1.0,
base::ASCIIToUTF16("hello world!"), base::string16());
base::ASCIIToUTF16("hello world!"), std::u16string());
base::RunLoop().RunUntilIdle();
// Send H, E to the SearchBoxView textfield, then trigger an autocomplete.
@ -884,7 +884,7 @@ class SearchBoxViewAutocompleteTest
// Clears all existing text from search_box() and all existing SearchResults
// from results().
void ResetAutocompleteBehaviorTest() {
view()->search_box()->SetText(base::string16());
view()->search_box()->SetText(std::u16string());
results()->RemoveAll();
}
@ -972,9 +972,9 @@ TEST_F(SearchBoxViewAutocompleteTest,
// Add two SearchResults, one tile and one list result. Initialize their title
// field to a non-empty string.
CreateSearchResult(ash::SearchResultDisplayType::kList, 1.0,
base::ASCIIToUTF16("hello list"), base::string16());
base::ASCIIToUTF16("hello list"), std::u16string());
CreateSearchResult(ash::SearchResultDisplayType::kTile, 0.5,
base::ASCIIToUTF16("hello tile"), base::string16());
base::ASCIIToUTF16("hello tile"), std::u16string());
base::RunLoop().RunUntilIdle();
// Send H, E to the SearchBoxView textfield, then trigger an autocomplete.
@ -994,9 +994,9 @@ TEST_F(SearchBoxViewAutocompleteTest,
// Add two SearchResults, one tile and one list result. Initialize their title
// field to a non-empty string.
CreateSearchResult(ash::SearchResultDisplayType::kTile, 1.0,
base::ASCIIToUTF16("hello tile"), base::string16());
base::ASCIIToUTF16("hello tile"), std::u16string());
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.5,
base::ASCIIToUTF16("hello list"), base::string16());
base::ASCIIToUTF16("hello list"), std::u16string());
base::RunLoop().RunUntilIdle();
// Send H, E to the SearchBoxView textfield, then trigger an autocomplete.
@ -1015,9 +1015,9 @@ TEST_F(SearchBoxViewAutocompleteTest,
// Add two SearchResults, one tile and one list result. The tile should
// display first, despite having a lower score. Initialize their details field
// to a non-empty string.
CreateSearchResult(ash::SearchResultDisplayType::kList, 1.0, base::string16(),
CreateSearchResult(ash::SearchResultDisplayType::kList, 1.0, std::u16string(),
base::ASCIIToUTF16("hello list"));
CreateSearchResult(ash::SearchResultDisplayType::kTile, 0.5, base::string16(),
CreateSearchResult(ash::SearchResultDisplayType::kTile, 0.5, std::u16string(),
base::ASCIIToUTF16("hello tile"));
base::RunLoop().RunUntilIdle();
@ -1036,9 +1036,9 @@ TEST_F(SearchBoxViewAutocompleteTest,
SearchBoxAutocompletesTopTileResultDetails) {
// Add two SearchResults, one tile and one list result. Initialize their
// details field to a non-empty string.
CreateSearchResult(ash::SearchResultDisplayType::kTile, 1.0, base::string16(),
CreateSearchResult(ash::SearchResultDisplayType::kTile, 1.0, std::u16string(),
base::ASCIIToUTF16("hello tile"));
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.5, base::string16(),
CreateSearchResult(ash::SearchResultDisplayType::kList, 0.5, std::u16string(),
base::ASCIIToUTF16("hello list"));
base::RunLoop().RunUntilIdle();
@ -1073,7 +1073,7 @@ TEST_F(SearchBoxViewAutocompleteTest,
TEST_F(SearchBoxViewAutocompleteTest, SearchBoxAutocompletesAcceptsNextChar) {
// Add a search result with a non-empty title field.
CreateSearchResult(ash::SearchResultDisplayType::kList, 1.0,
base::ASCIIToUTF16("hello world!"), base::string16());
base::ASCIIToUTF16("hello world!"), std::u16string());
base::RunLoop().RunUntilIdle();
// Send H, E to the SearchBoxView textfield, then trigger an autocomplete.
@ -1083,7 +1083,7 @@ TEST_F(SearchBoxViewAutocompleteTest, SearchBoxAutocompletesAcceptsNextChar) {
// After typing L, the highlighted text will be replaced by L.
KeyPress(ui::VKEY_L);
base::string16 selected_text = view()->search_box()->GetSelectedText();
std::u16string selected_text = view()->search_box()->GetSelectedText();
EXPECT_EQ(view()->search_box()->GetText(), base::ASCIIToUTF16("hel"));
EXPECT_EQ(base::ASCIIToUTF16(""), selected_text);
@ -1111,7 +1111,7 @@ TEST_F(SearchBoxViewAutocompleteTest, SearchBoxAcceptsAutocompleteForClickTap) {
TEST_F(SearchBoxViewAutocompleteTest, SearchBoxAutocompletesNotHandledForIME) {
// Add a search result with a non-empty title field.
CreateSearchResult(ash::SearchResultDisplayType::kList, 1.0,
base::ASCIIToUTF16("hello world!"), base::string16());
base::ASCIIToUTF16("hello world!"), std::u16string());
base::RunLoop().RunUntilIdle();
// Simulate uncomposited text. The autocomplete should be handled.
@ -1120,11 +1120,11 @@ TEST_F(SearchBoxViewAutocompleteTest, SearchBoxAutocompletesNotHandledForIME) {
view()->set_highlight_range_for_test(gfx::Range(2, 2));
view()->ProcessAutocomplete();
base::string16 selected_text = view()->search_box()->GetSelectedText();
std::u16string selected_text = view()->search_box()->GetSelectedText();
EXPECT_EQ(view()->search_box()->GetText(),
base::ASCIIToUTF16("hello world!"));
EXPECT_EQ(base::ASCIIToUTF16("llo world!"), selected_text);
view()->search_box()->SetText(base::string16());
view()->search_box()->SetText(std::u16string());
// Simulate IME composition text. The autocomplete should not be handled.
ui::CompositionText composition_text;

@ -82,14 +82,14 @@ void SearchResultBaseView::OnResultDestroying() {
SetResult(nullptr);
}
base::string16 SearchResultBaseView::ComputeAccessibleName() const {
std::u16string SearchResultBaseView::ComputeAccessibleName() const {
if (!result())
return base::string16();
return std::u16string();
if (!result()->accessible_name().empty())
return result()->accessible_name();
base::string16 accessible_name = result()->title();
std::u16string accessible_name = result()->title();
if (!result()->title().empty() && !result()->details().empty())
accessible_name += base::ASCIIToUTF16(", ");
accessible_name += result()->details();

@ -63,7 +63,7 @@ class APP_LIST_EXPORT SearchResultBaseView : public views::Button,
void OnResultDestroying() override;
// Computes the button's spoken feedback name.
virtual base::string16 ComputeAccessibleName() const;
virtual std::u16string ComputeAccessibleName() const;
// Clears the result without calling |OnResultChanged| or |OnResultChanging|
void ClearResult();

@ -262,8 +262,8 @@ void SearchResultPageView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->role = ax::mojom::Role::kListBox;
base::string16 value;
base::string16 query = search_model_->search_box()->text();
std::u16string value;
std::u16string query = search_model_->search_box()->text();
if (!query.empty()) {
if (last_search_result_count_ == 1) {
value = l10n_util::GetStringFUTF16(

@ -190,29 +190,29 @@ void SearchResultSuggestionChipView::SetIcon(const gfx::ImageSkia& icon) {
icon_view_->SetVisible(true);
}
void SearchResultSuggestionChipView::SetText(const base::string16& text) {
void SearchResultSuggestionChipView::SetText(const std::u16string& text) {
text_view_->SetText(text);
gfx::Size size = text_view_->CalculatePreferredSize();
size.set_width(std::min(kMaxTextWidth, size.width()));
text_view_->SetPreferredSize(size);
}
const base::string16& SearchResultSuggestionChipView::GetText() const {
const std::u16string& SearchResultSuggestionChipView::GetText() const {
return text_view_->GetText();
}
void SearchResultSuggestionChipView::UpdateSuggestionChipView() {
if (!result()) {
SetIcon(gfx::ImageSkia());
SetText(base::string16());
SetAccessibleName(base::string16());
SetText(std::u16string());
SetAccessibleName(std::u16string());
return;
}
SetIcon(result()->chip_icon());
SetText(result()->title());
base::string16 accessible_name = result()->title();
std::u16string accessible_name = result()->title();
if (result()->id() == kInternalAppIdContinueReading) {
accessible_name = l10n_util::GetStringFUTF16(
IDS_APP_LIST_CONTINUE_READING_ACCESSIBILE_NAME, accessible_name);
@ -242,7 +242,7 @@ void SearchResultSuggestionChipView::InitLayout() {
text_view_->SetAutoColorReadabilityEnabled(false);
text_view_->SetSubpixelRenderingEnabled(false);
text_view_->SetFontList(AppListConfig::instance().app_title_font());
SetText(base::string16());
SetText(std::u16string());
text_view_->SetEnabledColor(
AppListColorProvider::Get()->GetSuggestionChipTextColor());
}

@ -60,8 +60,8 @@ class APP_LIST_EXPORT SearchResultSuggestionChipView
void SetIcon(const gfx::ImageSkia& icon);
void SetText(const base::string16& text);
const base::string16& GetText() const;
void SetText(const std::u16string& text);
const std::u16string& GetText() const;
private:
// Updates the suggestion chip view's title and icon.

@ -194,7 +194,7 @@ int SearchResultTileItemListView::DoUpdate() {
// Track play store results and start the timer for recording their impression
// UMA metrics.
base::string16 user_typed_query = GetUserTypedQuery();
std::u16string user_typed_query = GetUserTypedQuery();
if (found_playstore_results && user_typed_query != recent_playstore_query_) {
recent_playstore_query_ = user_typed_query;
playstore_impression_timer_.Stop();
@ -250,8 +250,8 @@ int SearchResultTileItemListView::DoUpdate() {
}
std::vector<SearchResult*> SearchResultTileItemListView::GetDisplayResults() {
base::string16 raw_query = search_box_->GetText();
base::string16 query;
std::u16string raw_query = search_box_->GetText();
std::u16string query;
base::TrimWhitespace(raw_query, base::TRIM_ALL, &query);
// We ask for |max_search_result_tiles_| policy tile results first,
@ -315,13 +315,13 @@ std::vector<SearchResult*> SearchResultTileItemListView::GetDisplayResults() {
return display_results;
}
base::string16 SearchResultTileItemListView::GetUserTypedQuery() {
base::string16 search_box_text = search_box_->GetText();
std::u16string SearchResultTileItemListView::GetUserTypedQuery() {
std::u16string search_box_text = search_box_->GetText();
gfx::Range range = search_box_->GetSelectedRange();
base::string16 raw_query = range.is_empty()
std::u16string raw_query = range.is_empty()
? search_box_text
: search_box_text.substr(0, range.start());
base::string16 query;
std::u16string query;
base::TrimWhitespace(raw_query, base::TRIM_ALL, &query);
return query;
}

@ -57,7 +57,7 @@ class APP_LIST_EXPORT SearchResultTileItemListView
std::vector<SearchResult*> GetDisplayResults();
base::string16 GetUserTypedQuery();
std::u16string GetUserTypedQuery();
void OnPlayStoreImpressionTimer();
@ -73,7 +73,7 @@ class APP_LIST_EXPORT SearchResultTileItemListView
views::Textfield* search_box_ = nullptr;
views::BoxLayout* layout_ = nullptr;
base::string16 recent_playstore_query_;
std::u16string recent_playstore_query_;
base::OneShotTimer playstore_impression_timer_;

@ -198,8 +198,8 @@ void SearchResultTileItemView::OnResultChanged() {
UpdateAccessibleName();
}
base::string16 SearchResultTileItemView::ComputeAccessibleName() const {
base::string16 accessible_name;
std::u16string SearchResultTileItemView::ComputeAccessibleName() const {
std::u16string accessible_name;
if (!result()->accessible_name().empty())
return result()->accessible_name();
@ -440,7 +440,7 @@ void SearchResultTileItemView::SetBadgeIcon(const ui::ImageModel& badge_icon,
badge_->SetVisible(true);
}
void SearchResultTileItemView::SetTitle(const base::string16& title) {
void SearchResultTileItemView::SetTitle(const std::u16string& title) {
title_->SetText(title);
}
@ -459,7 +459,7 @@ void SearchResultTileItemView::SetRating(float rating) {
rating_star_->SetVisible(true);
}
void SearchResultTileItemView::SetPrice(const base::string16& price) {
void SearchResultTileItemView::SetPrice(const std::u16string& price) {
if (!price_)
return;
@ -592,14 +592,14 @@ gfx::Size SearchResultTileItemView::CalculatePreferredSize() const {
AppListConfig::instance().search_tile_height());
}
base::string16 SearchResultTileItemView::GetTooltipText(
std::u16string SearchResultTileItemView::GetTooltipText(
const gfx::Point& p) const {
// Use the label to generate a tooltip, so that it will consider its text
// truncation in making the tooltip. We do not want the label itself to have a
// tooltip, so we only temporarily enable it to get the tooltip text from the
// label, then disable it again.
title_->SetHandlesTooltips(true);
base::string16 tooltip = title_->GetTooltipText(p);
std::u16string tooltip = title_->GetTooltipText(p);
title_->SetHandlesTooltips(false);
return tooltip;
}

@ -40,7 +40,7 @@ class APP_LIST_EXPORT SearchResultTileItemView
void OnResultChanged() override;
// Overridden from SearchResultBaseView:
base::string16 ComputeAccessibleName() const override;
std::u16string ComputeAccessibleName() const override;
// Informs the SearchResultTileItemView of its parent's background color. The
// controls within the SearchResultTileItemView will adapt to suit the given
@ -88,9 +88,9 @@ class APP_LIST_EXPORT SearchResultTileItemView
void SetIcon(const gfx::ImageSkia& icon);
void SetBadgeIcon(const ui::ImageModel& badge_icon,
bool use_badge_icon_background);
void SetTitle(const base::string16& title);
void SetTitle(const std::u16string& title);
void SetRating(float rating);
void SetPrice(const base::string16& price);
void SetPrice(const std::u16string& price);
AppListMenuModelAdapter::AppListViewAppType GetAppType() const;
@ -106,7 +106,7 @@ class APP_LIST_EXPORT SearchResultTileItemView
void Layout() override;
const char* GetClassName() const override;
gfx::Size CalculatePreferredSize() const override;
base::string16 GetTooltipText(const gfx::Point& p) const override;
std::u16string GetTooltipText(const gfx::Point& p) const override;
AppListViewDelegate* const view_delegate_; // Owned by AppListView.

@ -18,7 +18,7 @@ namespace ash {
TopIconAnimationView::TopIconAnimationView(AppsGridView* grid,
const gfx::ImageSkia& icon,
const base::string16& title,
const std::u16string& title,
const gfx::Rect& scaled_rect,
bool open_folder,
bool item_in_folder_icon)

@ -45,7 +45,7 @@ class TopIconAnimationView : public views::View,
// The view will be self-cleaned by the end of animation.
TopIconAnimationView(AppsGridView* grid,
const gfx::ImageSkia& icon,
const base::string16& title,
const std::u16string& title,
const gfx::Rect& scaled_rect,
bool open_folder,
bool item_in_folder_icon);

@ -47,8 +47,8 @@ constexpr SkColor kNotificationTitleTextColor =
NotificationItemView::NotificationItemView(
NotificationMenuView::Delegate* delegate,
views::SlideOutControllerDelegate* slide_out_controller_delegate,
const base::string16& title,
const base::string16& message,
const std::u16string& title,
const std::u16string& message,
const gfx::Image& icon,
const std::string& notification_id)
: delegate_(delegate),
@ -95,8 +95,8 @@ NotificationItemView::NotificationItemView(
NotificationItemView::~NotificationItemView() = default;
void NotificationItemView::UpdateContents(const base::string16& title,
const base::string16& message,
void NotificationItemView::UpdateContents(const std::u16string& title,
const std::u16string& message,
const gfx::Image& icon) {
if (title_ != title) {
title_ = title;

@ -36,16 +36,16 @@ class APP_MENU_EXPORT NotificationItemView : public views::View {
NotificationItemView(
NotificationMenuView::Delegate* delegate,
views::SlideOutControllerDelegate* slide_out_controller_delegate,
const base::string16& title,
const base::string16& message,
const std::u16string& title,
const std::u16string& message,
const gfx::Image& icon,
const std::string& notification_id);
~NotificationItemView() override;
// Updates the contents of the view.
void UpdateContents(const base::string16& title,
const base::string16& message,
void UpdateContents(const std::u16string& title,
const std::u16string& message,
const gfx::Image& icon);
// views::View overrides:
@ -57,8 +57,8 @@ class APP_MENU_EXPORT NotificationItemView : public views::View {
void OnGestureEvent(ui::GestureEvent* event) override;
const std::string& notification_id() const { return notification_id_; }
const base::string16& title() const { return title_; }
const base::string16& message() const { return message_; }
const std::u16string& title() const { return title_; }
const std::u16string& message() const { return message_; }
const message_center::ProportionalImageView& proportional_image_view() const {
return *proportional_icon_view_;
}
@ -83,8 +83,8 @@ class APP_MENU_EXPORT NotificationItemView : public views::View {
std::unique_ptr<views::SlideOutController> slide_out_controller_;
// Notification properties.
base::string16 title_;
base::string16 message_;
std::u16string title_;
std::u16string message_;
// The identifier used by MessageCenter to identify this notification.
const std::string notification_id_;

@ -125,7 +125,7 @@ void NotificationMenuController::InitializeNotificationMenuView() {
}
app_menu_model_adapter_->model()->AddItem(NOTIFICATION_CONTAINER,
base::string16());
std::u16string());
// Add the container MenuItemView to |root_menu_|.
views::MenuItemView* container =
root_menu_->AppendMenuItem(NOTIFICATION_CONTAINER);

@ -30,7 +30,7 @@ NotificationMenuHeaderView::NotificationMenuHeaderView() {
kNotificationVerticalPadding, kNotificationHorizontalPadding)));
notification_title_ = new views::Label(
base::string16(l10n_util::GetStringUTF16(
std::u16string(l10n_util::GetStringUTF16(
IDS_MESSAGE_CENTER_NOTIFICATION_ACCESSIBLE_NAME_PLURAL)),
{views::Label::GetDefaultFontList().DeriveWithSizeDelta(1)});
notification_title_->SetEnabledColor(kNotificationHeaderTextColor);
@ -38,7 +38,7 @@ NotificationMenuHeaderView::NotificationMenuHeaderView() {
AddChildView(notification_title_);
counter_ = new views::Label(
base::string16(),
std::u16string(),
{views::Label::GetDefaultFontList().DeriveWithSizeDelta(1)});
counter_->SetEnabledColor(kNotificationHeaderTextColor);
counter_->SetLineHeight(kNotificationHeaderLineHeight);

@ -19,7 +19,7 @@ NotificationMenuViewTestAPI::NotificationMenuViewTestAPI(
NotificationMenuViewTestAPI::~NotificationMenuViewTestAPI() = default;
base::string16 NotificationMenuViewTestAPI::GetCounterViewContents() const {
std::u16string NotificationMenuViewTestAPI::GetCounterViewContents() const {
return notification_menu_view_->header_view_->counter_->GetText();
}

@ -23,7 +23,7 @@ class NotificationMenuViewTestAPI {
~NotificationMenuViewTestAPI();
// Returns the numeric string contained in the counter view.
base::string16 GetCounterViewContents() const;
std::u16string GetCounterViewContents() const;
// Returns the number of NotificationItemViews.
int GetItemViewCount() const;

@ -119,8 +119,8 @@ class NotificationMenuViewTest : public views::ViewsTestBase {
message_center::Notification AddNotification(
const std::string& notification_id,
const base::string16& title,
const base::string16& message) {
const std::u16string& title,
const std::u16string& message) {
const message_center::NotifierId notifier_id(
message_center::NotifierType::APPLICATION, kTestAppId);
message_center::Notification notification(
@ -135,8 +135,8 @@ class NotificationMenuViewTest : public views::ViewsTestBase {
message_center::Notification UpdateNotification(
const std::string& notification_id,
const base::string16& title,
const base::string16& message) {
const std::u16string& title,
const std::u16string& message) {
const message_center::NotifierId notifier_id(
message_center::NotifierType::APPLICATION, kTestAppId);
message_center::Notification notification(

@ -35,9 +35,9 @@ constexpr char kNotifierId[] = "assistant";
std::unique_ptr<message_center::Notification> CreateSystemNotification(
const message_center::NotifierId& notifier_id,
const chromeos::assistant::AssistantNotification& notification) {
const base::string16 title = base::UTF8ToUTF16(notification.title);
const base::string16 message = base::UTF8ToUTF16(notification.message);
const base::string16 display_source =
const std::u16string title = base::UTF8ToUTF16(notification.title);
const std::u16string message = base::UTF8ToUTF16(notification.message);
const std::u16string display_source =
l10n_util::GetStringUTF16(IDS_ASH_ASSISTANT_NOTIFICATION_DISPLAY_SOURCE);
message_center::RichNotificationData data;
@ -174,7 +174,7 @@ void AssistantNotificationControllerImpl::OnAllNotificationsRemoved(
void AssistantNotificationControllerImpl::OnNotificationClicked(
const std::string& id,
const base::Optional<int>& button_index,
const base::Optional<base::string16>& reply) {
const base::Optional<std::u16string>& reply) {
const AssistantNotification* notification = model_.GetNotificationById(id);
if (!notification)
return;

@ -60,7 +60,7 @@ class ASH_EXPORT AssistantNotificationControllerImpl
void OnNotificationClicked(
const std::string& id,
const base::Optional<int>& button_index,
const base::Optional<base::string16>& reply) override;
const base::Optional<std::u16string>& reply) override;
void OnNotificationUpdated(const std::string& notification) override {}
void OnNotificationRemoved(const std::string& notification_id,
bool by_user) override;

@ -117,7 +117,7 @@ const gfx::ImageSkia& AssistantOnboardingSuggestionView::GetIcon() const {
return icon_->GetImage();
}
const base::string16& AssistantOnboardingSuggestionView::GetText() const {
const std::u16string& AssistantOnboardingSuggestionView::GetText() const {
return label_->GetText();
}

@ -52,7 +52,7 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantOnboardingSuggestionView
const gfx::ImageSkia& GetIcon() const;
// Returns the text for the suggestion.
const base::string16& GetText() const;
const std::u16string& GetText() const;
private:
void InitLayout(const chromeos::assistant::AssistantSuggestion& suggestion);

@ -39,7 +39,7 @@ views::StyledLabel::RangeStyleInfo CreateStyleInfo(
return style;
}
base::string16 GetAction(int consent_status) {
std::u16string GetAction(int consent_status) {
return consent_status ==
chromeos::assistant::prefs::ConsentStatus::kUnauthorized
? l10n_util::GetStringUTF16(
@ -154,11 +154,11 @@ void AssistantOptInView::InitLayout() {
void AssistantOptInView::UpdateLabel(int consent_status) {
// First substitution string: "Unlock more Assistant features."
const base::string16 unlock_features =
const std::u16string unlock_features =
l10n_util::GetStringUTF16(IDS_ASH_ASSISTANT_OPT_IN_UNLOCK_MORE_FEATURES);
// Second substitution string specifies the action to be taken.
const base::string16 action = GetAction(consent_status);
const std::u16string action = GetAction(consent_status);
// Set the text, having replaced placeholders in the opt in prompt with
// substitution strings and caching their offset positions for styling.

@ -115,12 +115,12 @@ void AssistantQueryView::SetText(const std::string& high_confidence_text,
// When coming from the server, both |high_confidence_text| and
// |low_confidence_text| may be HTML escaped, so we need to unescape both
// before displaying to avoid printing HTML entities to the user.
const base::string16& high_confidence_text_16 =
const std::u16string& high_confidence_text_16 =
net::UnescapeForHTML(base::UTF8ToUTF16(high_confidence_text));
high_confidence_label_->SetText(high_confidence_text_16);
const base::string16& low_confidence_text_16 =
const std::u16string& low_confidence_text_16 =
net::UnescapeForHTML(base::UTF8ToUTF16(low_confidence_text));
low_confidence_label_->SetText(low_confidence_text_16);

@ -72,7 +72,7 @@ void SuggestionChipView::ChildVisibilityChanged(views::View* child) {
}
void SuggestionChipView::InitLayout(const AssistantSuggestion& suggestion) {
const base::string16 text = base::UTF8ToUTF16(suggestion.text);
const std::u16string text = base::UTF8ToUTF16(suggestion.text);
// Accessibility.
SetAccessibleName(text);
@ -174,11 +174,11 @@ const gfx::ImageSkia& SuggestionChipView::GetIcon() const {
return icon_view_->GetImage();
}
void SuggestionChipView::SetText(const base::string16& text) {
void SuggestionChipView::SetText(const std::u16string& text) {
text_view_->SetText(text);
}
const base::string16& SuggestionChipView::GetText() const {
const std::u16string& SuggestionChipView::GetText() const {
return text_view_->GetText();
}

@ -46,8 +46,8 @@ class COMPONENT_EXPORT(ASSISTANT_UI) SuggestionChipView : public views::Button {
void SetIcon(const gfx::ImageSkia& icon);
const gfx::ImageSkia& GetIcon() const;
void SetText(const base::string16& text);
const base::string16& GetText() const;
void SetText(const std::u16string& text);
const std::u16string& GetText() const;
const base::UnguessableToken& suggestion_id() const { return suggestion_id_; }

@ -153,7 +153,7 @@ CaptureLabelView::CaptureLabelView(CaptureModeSession* capture_mode_session)
label_button_ = AddChildView(std::make_unique<views::LabelButton>(
base::BindRepeating(&CaptureLabelView::OnButtonPressed,
base::Unretained(this)),
base::string16()));
std::u16string()));
label_button_->SetPaintToLayer();
label_button_->layer()->SetFillsBoundsOpaquely(false);
label_button_->SetEnabledTextColors(text_color);
@ -167,7 +167,7 @@ CaptureLabelView::CaptureLabelView(CaptureModeSession* capture_mode_session)
label_button_->SetInkDropBaseColor(ripple_attributes.base_color);
label_button_->SetFocusBehavior(views::View::FocusBehavior::ACCESSIBLE_ONLY);
label_ = AddChildView(std::make_unique<views::Label>(base::string16()));
label_ = AddChildView(std::make_unique<views::Label>(std::u16string()));
label_->SetPaintToLayer();
label_->layer()->SetFillsBoundsOpaquely(false);
label_->SetEnabledColor(text_color);
@ -188,7 +188,7 @@ void CaptureLabelView::UpdateIconAndText() {
AshColorProvider::ContentLayerType::kIconColorPrimary);
gfx::ImageSkia icon;
base::string16 text;
std::u16string text;
switch (source) {
case CaptureModeSource::kFullscreen:
text = l10n_util::GetStringUTF16(

@ -53,7 +53,7 @@ void CaptureModeToggleButton::OnPaintBackground(gfx::Canvas* canvas) {
void CaptureModeToggleButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
ImageButton::GetAccessibleNodeData(node_data);
const base::string16 tooltip = GetTooltipText(gfx::Point());
const std::u16string tooltip = GetTooltipText(gfx::Point());
DCHECK(!tooltip.empty());
node_data->SetName(tooltip);
node_data->role = ax::mojom::Role::kToggleButton;

@ -47,7 +47,7 @@ bool StopRecordingButtonTray::PerformAction(const ui::Event& event) {
return true;
}
base::string16 StopRecordingButtonTray::GetAccessibleNameForTray() {
std::u16string StopRecordingButtonTray::GetAccessibleNameForTray() {
return l10n_util::GetStringUTF16(
IDS_ASH_STATUS_AREA_STOP_RECORDING_BUTTON_ACCESSIBLE_NAME);
}

@ -22,7 +22,7 @@ class StopRecordingButtonTray : public TrayBackgroundView {
// TrayBackgroundView:
bool PerformAction(const ui::Event& event) override;
void ClickedOutsideBubble() override {}
base::string16 GetAccessibleNameForTray() override;
std::u16string GetAccessibleNameForTray() override;
void HandleLocaleChange() override {}
void HideBubbleWithView(const TrayBubbleView* bubble_view) override {}
};

@ -24,7 +24,7 @@ namespace {
// Number of digits displayed in parent access code input.
constexpr int kParentAccessCodePinLength = 6;
base::string16 GetTitle(SupervisedAction action) {
std::u16string GetTitle(SupervisedAction action) {
int title_id;
switch (action) {
case SupervisedAction::kUnlockTimeLimits:
@ -44,7 +44,7 @@ base::string16 GetTitle(SupervisedAction action) {
return l10n_util::GetStringUTF16(title_id);
}
base::string16 GetDescription(SupervisedAction action) {
std::u16string GetDescription(SupervisedAction action) {
int description_id;
switch (action) {
case SupervisedAction::kUnlockTimeLimits:
@ -64,7 +64,7 @@ base::string16 GetDescription(SupervisedAction action) {
return l10n_util::GetStringUTF16(description_id);
}
base::string16 GetAccessibleTitle() {
std::u16string GetAccessibleTitle() {
return l10n_util::GetStringUTF16(IDS_ASH_LOGIN_PARENT_ACCESS_DIALOG_NAME);
}

@ -89,7 +89,7 @@ void ClipboardHistoryMenuModelAdapter::Run(
const ui::DataTransferEndpoint data_dst(ui::EndpointType::kDefault,
/*notify_if_restricted=*/false);
for (const auto& item : items) {
model_->AddItem(command_id, base::string16());
model_->AddItem(command_id, std::u16string());
item_snapshots_.emplace(command_id, item);
++command_id;
}

@ -86,21 +86,21 @@ class UnrenderedHTMLPlaceholderImage : public gfx::CanvasImageSource {
// Helpers ---------------------------------------------------------------------
// Returns the localized string for the specified |resource_id|.
base::string16 GetLocalizedString(int resource_id) {
std::u16string GetLocalizedString(int resource_id) {
return ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
resource_id);
}
// Returns the label to display for the custom data contained within |data|.
base::string16 GetLabelForCustomData(const ui::ClipboardData& data) {
std::u16string GetLabelForCustomData(const ui::ClipboardData& data) {
// Currently the only supported type of custom data is file system data. This
// code should not be reached if `data` does not contain file system data.
base::string16 sources;
std::u16string sources;
std::vector<base::StringPiece16> source_list;
ClipboardHistoryUtil::GetSplitFileSystemData(data, &source_list, &sources);
if (sources.empty()) {
NOTREACHED();
return base::string16();
return std::u16string();
}
// Strip path information, so all that's left are file names.
@ -149,7 +149,7 @@ ui::ImageModel ClipboardHistoryResourceManager::GetImageModel(
return cached_image_model->image_model;
}
base::string16 ClipboardHistoryResourceManager::GetLabel(
std::u16string ClipboardHistoryResourceManager::GetLabel(
const ClipboardHistoryItem& item) const {
const ui::ClipboardData& data = item.data();
switch (ClipboardHistoryUtil::CalculateMainFormat(data).value()) {

Some files were not shown because too many files have changed in this diff Show More