diff --git a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc index 368ff9c9dbac70..8afcf500365a2e 100644 --- a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc +++ b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc @@ -60,18 +60,18 @@ DiceWebSigninInterceptHandler::DiceWebSigninInterceptHandler( DiceWebSigninInterceptHandler::~DiceWebSigninInterceptHandler() = default; void DiceWebSigninInterceptHandler::RegisterMessages() { - web_ui()->RegisterDeprecatedMessageCallback( + web_ui()->RegisterMessageCallback( "accept", base::BindRepeating(&DiceWebSigninInterceptHandler::HandleAccept, base::Unretained(this))); - web_ui()->RegisterDeprecatedMessageCallback( + web_ui()->RegisterMessageCallback( "cancel", base::BindRepeating(&DiceWebSigninInterceptHandler::HandleCancel, base::Unretained(this))); - web_ui()->RegisterDeprecatedMessageCallback( + web_ui()->RegisterMessageCallback( "guest", base::BindRepeating(&DiceWebSigninInterceptHandler::HandleGuest, base::Unretained(this))); - web_ui()->RegisterDeprecatedMessageCallback( + web_ui()->RegisterMessageCallback( "pageLoaded", base::BindRepeating(&DiceWebSigninInterceptHandler::HandlePageLoaded, base::Unretained(this))); @@ -115,23 +115,25 @@ const AccountInfo& DiceWebSigninInterceptHandler::intercepted_account() { return bubble_parameters_.intercepted_account; } -void DiceWebSigninInterceptHandler::HandleAccept(const base::ListValue* args) { +void DiceWebSigninInterceptHandler::HandleAccept( + const base::Value::List& args) { if (callback_) std::move(callback_).Run(SigninInterceptionUserChoice::kAccept); } -void DiceWebSigninInterceptHandler::HandleCancel(const base::ListValue* args) { +void DiceWebSigninInterceptHandler::HandleCancel( + const base::Value::List& args) { if (callback_) std::move(callback_).Run(SigninInterceptionUserChoice::kDecline); } -void DiceWebSigninInterceptHandler::HandleGuest(const base::ListValue* args) { +void DiceWebSigninInterceptHandler::HandleGuest(const base::Value::List& args) { if (callback_) std::move(callback_).Run(SigninInterceptionUserChoice::kGuest); } void DiceWebSigninInterceptHandler::HandlePageLoaded( - const base::ListValue* args) { + const base::Value::List& args) { AllowJavascript(); // Update the account info and the images. @@ -153,7 +155,8 @@ void DiceWebSigninInterceptHandler::HandlePageLoaded( if (primary_account().given_name.empty()) bubble_parameters_.primary_account.given_name = primary_account().email; - const base::Value& callback_id = args->GetListDeprecated()[0]; + DCHECK(!args.empty()); + const base::Value& callback_id = args[0]; ResolveJavascriptCallback(callback_id, GetInterceptionParametersValue()); } diff --git a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.h b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.h index be7296a71aac61..4f8cf49736ac04 100644 --- a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.h +++ b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.h @@ -16,10 +16,6 @@ #include "components/signin/public/identity_manager/account_info.h" #include "components/signin/public/identity_manager/identity_manager.h" -namespace base { -class ListValue; -} - // WebUI message handler for the Dice web signin intercept bubble. class DiceWebSigninInterceptHandler : public content::WebUIMessageHandler, public signin::IdentityManager::Observer { @@ -46,10 +42,10 @@ class DiceWebSigninInterceptHandler : public content::WebUIMessageHandler, const AccountInfo& primary_account(); const AccountInfo& intercepted_account(); - void HandleAccept(const base::ListValue* args); - void HandleCancel(const base::ListValue* args); - void HandleGuest(const base::ListValue* args); - void HandlePageLoaded(const base::ListValue* args); + void HandleAccept(const base::Value::List& args); + void HandleCancel(const base::Value::List& args); + void HandleGuest(const base::Value::List& args); + void HandlePageLoaded(const base::Value::List& args); // Gets the values sent to javascript. base::Value GetAccountInfoValue(const AccountInfo& info); diff --git a/chrome/browser/ui/webui/signin/profile_customization_handler.cc b/chrome/browser/ui/webui/signin/profile_customization_handler.cc index 6b4ff6e2a8d007..e3eb6eccb3c42c 100644 --- a/chrome/browser/ui/webui/signin/profile_customization_handler.cc +++ b/chrome/browser/ui/webui/signin/profile_customization_handler.cc @@ -40,11 +40,11 @@ ProfileCustomizationHandler::~ProfileCustomizationHandler() = default; void ProfileCustomizationHandler::RegisterMessages() { profile_path_ = Profile::FromWebUI(web_ui())->GetPath(); - web_ui()->RegisterDeprecatedMessageCallback( + web_ui()->RegisterMessageCallback( "initialized", base::BindRepeating(&ProfileCustomizationHandler::HandleInitialized, base::Unretained(this))); - web_ui()->RegisterDeprecatedMessageCallback( + web_ui()->RegisterMessageCallback( "done", base::BindRepeating(&ProfileCustomizationHandler::HandleDone, base::Unretained(this))); } @@ -85,17 +85,16 @@ void ProfileCustomizationHandler::OnProfileNameChanged( } void ProfileCustomizationHandler::HandleInitialized( - const base::ListValue* args) { - CHECK_EQ(1u, args->GetListDeprecated().size()); + const base::Value::List& args) { + CHECK_EQ(1u, args.size()); AllowJavascript(); - const base::Value& callback_id = args->GetListDeprecated()[0]; + const base::Value& callback_id = args[0]; ResolveJavascriptCallback(callback_id, GetProfileInfoValue()); } -void ProfileCustomizationHandler::HandleDone(const base::ListValue* args) { - CHECK_EQ(1u, args->GetListDeprecated().size()); - std::u16string profile_name = - base::UTF8ToUTF16(args->GetListDeprecated()[0].GetString()); +void ProfileCustomizationHandler::HandleDone(const base::Value::List& args) { + CHECK_EQ(1u, args.size()); + std::u16string profile_name = base::UTF8ToUTF16(args[0].GetString()); base::TrimWhitespace(profile_name, base::TRIM_ALL, &profile_name); DCHECK(!profile_name.empty()); diff --git a/chrome/browser/ui/webui/signin/profile_customization_handler.h b/chrome/browser/ui/webui/signin/profile_customization_handler.h index 733581dfe1d678..2386414036efa5 100644 --- a/chrome/browser/ui/webui/signin/profile_customization_handler.h +++ b/chrome/browser/ui/webui/signin/profile_customization_handler.h @@ -12,10 +12,6 @@ #include "base/scoped_observation.h" #include "chrome/browser/profiles/profile_attributes_storage.h" -namespace base { -class ListValue; -} - class ProfileAttributesEntry; // WebUI message handler for the profile customization bubble. @@ -46,8 +42,8 @@ class ProfileCustomizationHandler : public content::WebUIMessageHandler, private: // Handlers for messages from javascript. - void HandleInitialized(const base::ListValue* args); - void HandleDone(const base::ListValue* args); + void HandleInitialized(const base::Value::List& args); + void HandleDone(const base::Value::List& args); // Sends an updated profile info (avatar and colors) to the WebUI. // `profile_path` is the path of the profile being updated, this function does diff --git a/chrome/browser/ui/webui/signin/signin_reauth_handler.cc b/chrome/browser/ui/webui/signin/signin_reauth_handler.cc index d1a7606858fe55..eba8fe71a49cea 100644 --- a/chrome/browser/ui/webui/signin/signin_reauth_handler.cc +++ b/chrome/browser/ui/webui/signin/signin_reauth_handler.cc @@ -25,13 +25,13 @@ SigninReauthHandler::SigninReauthHandler( SigninReauthHandler::~SigninReauthHandler() = default; void SigninReauthHandler::RegisterMessages() { - web_ui()->RegisterDeprecatedMessageCallback( + web_ui()->RegisterMessageCallback( "initialize", base::BindRepeating(&SigninReauthHandler::HandleInitialize, base::Unretained(this))); - web_ui()->RegisterDeprecatedMessageCallback( + web_ui()->RegisterMessageCallback( "confirm", base::BindRepeating(&SigninReauthHandler::HandleConfirm, base::Unretained(this))); - web_ui()->RegisterDeprecatedMessageCallback( + web_ui()->RegisterMessageCallback( "cancel", base::BindRepeating(&SigninReauthHandler::HandleCancel, base::Unretained(this))); } @@ -61,27 +61,25 @@ void SigninReauthHandler::OnGaiaReauthTypeDetermined( FireWebUIListener("reauth-type-determined"); } -void SigninReauthHandler::HandleInitialize(const base::ListValue* args) { +void SigninReauthHandler::HandleInitialize(const base::Value::List& args) { AllowJavascript(); } -void SigninReauthHandler::HandleConfirm(const base::ListValue* args) { +void SigninReauthHandler::HandleConfirm(const base::Value::List& args) { if (controller_) controller_->OnReauthConfirmed(BuildConsent(args)); } -void SigninReauthHandler::HandleCancel(const base::ListValue* args) { +void SigninReauthHandler::HandleCancel(const base::Value::List& args) { if (controller_) controller_->OnReauthDismissed(); } sync_pb::UserConsentTypes::AccountPasswordsConsent -SigninReauthHandler::BuildConsent(const base::ListValue* args) const { - CHECK_EQ(2U, args->GetListDeprecated().size()); - base::Value::ConstListView consent_description = - args->GetListDeprecated()[0].GetListDeprecated(); - const std::string& consent_confirmation = - args->GetListDeprecated()[1].GetString(); +SigninReauthHandler::BuildConsent(const base::Value::List& args) const { + CHECK_EQ(2U, args.size()); + base::Value::ConstListView consent_description = args[0].GetListDeprecated(); + const std::string& consent_confirmation = args[1].GetString(); // The strings returned by the WebUI are not free-form, they must belong into // a pre-determined set of strings (stored in |string_to_grd_id_map_|). As diff --git a/chrome/browser/ui/webui/signin/signin_reauth_handler.h b/chrome/browser/ui/webui/signin/signin_reauth_handler.h index f2fb66b2b072f0..fd1b53ef708c25 100644 --- a/chrome/browser/ui/webui/signin/signin_reauth_handler.h +++ b/chrome/browser/ui/webui/signin/signin_reauth_handler.h @@ -11,10 +11,6 @@ #include "chrome/browser/ui/signin_reauth_view_controller.h" #include "content/public/browser/web_ui_message_handler.h" -namespace base { -class ListValue; -} - // WebUI message handler for the signin reauth dialog. class SigninReauthHandler : public content::WebUIMessageHandler, public SigninReauthViewController::Observer { @@ -38,20 +34,20 @@ class SigninReauthHandler : public content::WebUIMessageHandler, protected: // Handles "initialize" message from the page. No arguments. - virtual void HandleInitialize(const base::ListValue* args); + virtual void HandleInitialize(const base::Value::List& args); // Handles "confirm" message from the page. No arguments. // This message is sent when the user confirms that they want complete the // reauth flow. - virtual void HandleConfirm(const base::ListValue* args); + virtual void HandleConfirm(const base::Value::List& args); // Handles "cancel" message from the page. No arguments. This message is sent // when the user cancels the reauth flow. - virtual void HandleCancel(const base::ListValue* args); + virtual void HandleCancel(const base::Value::List& args); private: sync_pb::UserConsentTypes::AccountPasswordsConsent BuildConsent( - const base::ListValue* args) const; + const base::Value::List& args) const; // May be null if |controller_| gets destroyed earlier than |this|. raw_ptr controller_;