| Index: chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
|
| diff --git a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
|
| index 6f5f7d2152039757a72b6bfaaeb2606d03a1ea96..34b65605cc9864c73ca91de3be66d46d8b8feed0 100644
|
| --- a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
|
| +++ b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
|
| @@ -165,49 +165,18 @@ void CoreOobeHandler::RegisterMessages() {
|
| &CoreOobeHandler::HandleSetOobeBootstrappingSlave);
|
| }
|
|
|
| -template <typename... Args>
|
| -void CoreOobeHandler::ExecuteDeferredJSCall(const std::string& function_name,
|
| - std::unique_ptr<Args>... args) {
|
| - CallJS(function_name, *args...);
|
| -}
|
| -
|
| -template <typename... Args>
|
| -void CoreOobeHandler::CallJSOrDefer(const std::string& function_name,
|
| - const Args&... args) {
|
| - if (is_initialized_) {
|
| - CallJS(function_name, args...);
|
| - } else {
|
| - // Note that std::conditional is used here in order to obtain a sequence of
|
| - // base::Value types with the length equal to sizeof...(Args); the C++
|
| - // template parameter pack expansion rules require that the name of the
|
| - // parameter pack appears in the pattern, even though the elements of the
|
| - // Args pack are not actually in this code.
|
| - deferred_js_calls_.push_back(base::Bind(
|
| - &CoreOobeHandler::ExecuteDeferredJSCall<
|
| - typename std::conditional<true, base::Value, Args>::type...>,
|
| - base::Unretained(this), function_name,
|
| - base::Passed(::login::MakeValue(args).CreateDeepCopy())...));
|
| - }
|
| -}
|
| -
|
| -void CoreOobeHandler::ExecuteDeferredJSCalls() {
|
| - for (const auto& deferred_js_call : deferred_js_calls_)
|
| - deferred_js_call.Run();
|
| - deferred_js_calls_.clear();
|
| -}
|
| -
|
| void CoreOobeHandler::ShowSignInError(
|
| int login_attempts,
|
| const std::string& error_text,
|
| const std::string& help_link_text,
|
| HelpAppLauncher::HelpTopic help_topic_id) {
|
| LOG(ERROR) << "CoreOobeHandler::ShowSignInError: error_text=" << error_text;
|
| - CallJSOrDefer("showSignInError", login_attempts, error_text,
|
| - help_link_text, static_cast<int>(help_topic_id));
|
| + oobe_ui_->CallJSOrDefer("showSignInError", this, login_attempts, error_text,
|
| + help_link_text, static_cast<int>(help_topic_id));
|
| }
|
|
|
| void CoreOobeHandler::ShowTpmError() {
|
| - CallJSOrDefer("showTpmError");
|
| + oobe_ui_->CallJSOrDefer("showTpmError", this);
|
| }
|
|
|
| void CoreOobeHandler::ShowDeviceResetScreen() {
|
| @@ -239,66 +208,66 @@ void CoreOobeHandler::ShowEnableDebuggingScreen() {
|
|
|
| void CoreOobeHandler::ShowActiveDirectoryPasswordChangeScreen(
|
| const std::string& username) {
|
| - CallJSOrDefer("showActiveDirectoryPasswordChangeScreen", username);
|
| + oobe_ui_->CallJSOrDefer("showActiveDirectoryPasswordChangeScreen", this,
|
| + username);
|
| }
|
|
|
| void CoreOobeHandler::ShowSignInUI(const std::string& email) {
|
| - CallJSOrDefer("showSigninUI", email);
|
| + oobe_ui_->CallJSOrDefer("showSigninUI", this, email);
|
| }
|
|
|
| void CoreOobeHandler::ResetSignInUI(bool force_online) {
|
| - CallJSOrDefer("resetSigninUI", force_online);
|
| + oobe_ui_->CallJSOrDefer("resetSigninUI", this, force_online);
|
| }
|
|
|
| void CoreOobeHandler::ClearUserPodPassword() {
|
| - CallJSOrDefer("clearUserPodPassword");
|
| + oobe_ui_->CallJSOrDefer("clearUserPodPassword", this);
|
| }
|
|
|
| void CoreOobeHandler::RefocusCurrentPod() {
|
| - CallJSOrDefer("refocusCurrentPod");
|
| + oobe_ui_->CallJSOrDefer("refocusCurrentPod", this);
|
| }
|
|
|
| void CoreOobeHandler::ShowPasswordChangedScreen(bool show_password_error,
|
| const std::string& email) {
|
| - CallJSOrDefer("showPasswordChangedScreen", show_password_error, email);
|
| + oobe_ui_->CallJSOrDefer("showPasswordChangedScreen", this,
|
| + show_password_error, email);
|
| }
|
|
|
| void CoreOobeHandler::SetUsageStats(bool checked) {
|
| - CallJSOrDefer("setUsageStats", checked);
|
| + oobe_ui_->CallJSOrDefer("setUsageStats", this, checked);
|
| }
|
|
|
| void CoreOobeHandler::SetOemEulaUrl(const std::string& oem_eula_url) {
|
| - CallJSOrDefer("setOemEulaUrl", oem_eula_url);
|
| + oobe_ui_->CallJSOrDefer("setOemEulaUrl", this, oem_eula_url);
|
| }
|
|
|
| void CoreOobeHandler::SetTpmPassword(const std::string& tpm_password) {
|
| - CallJSOrDefer("setTpmPassword", tpm_password);
|
| + oobe_ui_->CallJSOrDefer("setTpmPassword", this, tpm_password);
|
| }
|
|
|
| void CoreOobeHandler::ClearErrors() {
|
| - CallJSOrDefer("clearErrors");
|
| + oobe_ui_->CallJSOrDefer("clearErrors", this);
|
| }
|
|
|
| void CoreOobeHandler::ReloadContent(const base::DictionaryValue& dictionary) {
|
| - CallJSOrDefer("reloadContent", dictionary);
|
| + oobe_ui_->CallJSOrDefer("reloadContent", this, dictionary);
|
| }
|
|
|
| void CoreOobeHandler::ShowControlBar(bool show) {
|
| - CallJSOrDefer("showControlBar", show);
|
| + oobe_ui_->CallJSOrDefer("showControlBar", this, show);
|
| }
|
|
|
| void CoreOobeHandler::ShowPinKeyboard(bool show) {
|
| - CallJSOrDefer("showPinKeyboard", show);
|
| + oobe_ui_->CallJSOrDefer("showPinKeyboard", this, show);
|
| }
|
|
|
| void CoreOobeHandler::SetClientAreaSize(int width, int height) {
|
| - CallJSOrDefer("setClientAreaSize", width, height);
|
| + oobe_ui_->CallJSOrDefer("setClientAreaSize", this, width, height);
|
| }
|
|
|
| void CoreOobeHandler::HandleInitialized() {
|
| - DCHECK(!is_initialized_);
|
| - is_initialized_ = true;
|
| - ExecuteDeferredJSCalls();
|
| + oobe_ui_->ExecuteDeferredJSCalls();
|
| oobe_ui_->InitializeHandlers();
|
| }
|
|
|
| @@ -396,7 +365,7 @@ void CoreOobeHandler::ShowOobeUI(bool show) {
|
|
|
| void CoreOobeHandler::UpdateShutdownAndRebootVisibility(
|
| bool reboot_on_shutdown) {
|
| - CallJSOrDefer("showShutdown", !reboot_on_shutdown);
|
| + oobe_ui_->CallJSOrDefer("showShutdown", this, !reboot_on_shutdown);
|
| }
|
|
|
| void CoreOobeHandler::UpdateA11yState() {
|
| @@ -417,14 +386,15 @@ void CoreOobeHandler::UpdateA11yState() {
|
| MagnificationManager::Get()->IsMagnifierEnabled());
|
| a11y_info.SetBoolean("virtualKeyboardEnabled",
|
| AccessibilityManager::Get()->IsVirtualKeyboardEnabled());
|
| - CallJSOrDefer("refreshA11yInfo", a11y_info);
|
| + oobe_ui_->CallJSOrDefer("refreshA11yInfo", this, a11y_info);
|
| }
|
|
|
| void CoreOobeHandler::UpdateOobeUIVisibility() {
|
| const std::string& display = oobe_ui_->display_type();
|
| - CallJSOrDefer("showAPIKeysNotice", !google_apis::HasKeysConfigured() &&
|
| - (display == OobeUI::kOobeDisplay ||
|
| - display == OobeUI::kLoginDisplay));
|
| + oobe_ui_->CallJSOrDefer(
|
| + "showAPIKeysNotice", this,
|
| + !google_apis::HasKeysConfigured() && (display == OobeUI::kOobeDisplay ||
|
| + display == OobeUI::kLoginDisplay));
|
|
|
| // Don't show version label on the stable channel by default.
|
| bool should_show_version = true;
|
| @@ -433,10 +403,10 @@ void CoreOobeHandler::UpdateOobeUIVisibility() {
|
| channel == version_info::Channel::BETA) {
|
| should_show_version = false;
|
| }
|
| - CallJSOrDefer("showVersion", should_show_version);
|
| - CallJSOrDefer("showOobeUI", show_oobe_ui_);
|
| + oobe_ui_->CallJSOrDefer("showVersion", this, should_show_version);
|
| + oobe_ui_->CallJSOrDefer("showOobeUI", this, show_oobe_ui_);
|
| if (system::InputDeviceSettings::Get()->ForceKeyboardDrivenUINavigation())
|
| - CallJSOrDefer("enableKeyboardFlow", true);
|
| + oobe_ui_->CallJSOrDefer("enableKeyboardFlow", this, true);
|
| }
|
|
|
| void CoreOobeHandler::OnOSVersionLabelTextUpdated(
|
| @@ -446,7 +416,7 @@ void CoreOobeHandler::OnOSVersionLabelTextUpdated(
|
|
|
| void CoreOobeHandler::OnEnterpriseInfoUpdated(
|
| const std::string& message_text, const std::string& asset_id) {
|
| - CallJSOrDefer("setEnterpriseInfo", message_text, asset_id);
|
| + oobe_ui_->CallJSOrDefer("setEnterpriseInfo", this, message_text, asset_id);
|
| }
|
|
|
| ui::EventProcessor* CoreOobeHandler::GetEventProcessor() {
|
| @@ -455,7 +425,7 @@ ui::EventProcessor* CoreOobeHandler::GetEventProcessor() {
|
|
|
| void CoreOobeHandler::UpdateLabel(const std::string& id,
|
| const std::string& text) {
|
| - CallJSOrDefer("setLabelText", id, text);
|
| + oobe_ui_->CallJSOrDefer("setLabelText", this, id, text);
|
| }
|
|
|
| void CoreOobeHandler::UpdateDeviceRequisition() {
|
| @@ -464,8 +434,8 @@ void CoreOobeHandler::UpdateDeviceRequisition() {
|
| ->browser_policy_connector_chromeos()
|
| ->GetDeviceCloudPolicyManager();
|
| if (policy_manager) {
|
| - CallJSOrDefer("updateDeviceRequisition",
|
| - policy_manager->GetDeviceRequisition());
|
| + oobe_ui_->CallJSOrDefer("updateDeviceRequisition", this,
|
| + policy_manager->GetDeviceRequisition());
|
| }
|
| }
|
|
|
|
|