Skip to content

Commit

Permalink
[LSC] Replace base::string16 with std::u16string in //[a-e]*
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
jdoerrie authored and Chromium LUCI CQ committed Mar 11, 2021
1 parent ed5e3ed commit 85285b0
Show file tree
Hide file tree
Showing 787 changed files with 2,244 additions and 2,261 deletions.
12 changes: 6 additions & 6 deletions android_webview/browser/aw_autofill_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions android_webview/browser/aw_autofill_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion android_webview/browser/aw_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions android_webview/browser/aw_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions android_webview/browser/aw_contents_client_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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(
Expand All @@ -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,
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}

Expand Down
6 changes: 3 additions & 3 deletions android_webview/browser/aw_contents_client_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions android_webview/browser/aw_javascript_dialog_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions android_webview/browser/aw_javascript_dialog_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions android_webview/browser/aw_pac_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
8 changes: 4 additions & 4 deletions android_webview/browser/aw_quota_manager_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -285,15 +285,15 @@ 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,
this, origin_string, callback_id, is_quota));
}

void AwQuotaManagerBridge::GetUsageAndQuotaForOriginOnUiThread(
const base::string16& origin,
const std::u16string& origin,
jint callback_id,
bool is_quota) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Expand Down
4 changes: 2 additions & 2 deletions android_webview/browser/aw_quota_manager_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion android_webview/browser/aw_web_contents_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions android_webview/browser/find_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;

Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions android_webview/browser/find_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -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_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion android_webview/browser/state_serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 85285b0

Please sign in to comment.