Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 11 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 12 #include "chrome/browser/chromeos/login/helper.h" | 12 #include "chrome/browser/chromeos/login/helper.h" |
| 13 #include "chrome/browser/chromeos/login/oobe_screen.h" | 13 #include "chrome/browser/chromeos/login/oobe_screen.h" |
| 14 #include "chrome/browser/chromeos/login/screens/core_oobe_view.h" | 14 #include "chrome/browser/chromeos/login/screens/core_oobe_view.h" |
| 15 #include "chrome/browser/chromeos/login/screens/eula_screen.h" | 15 #include "chrome/browser/chromeos/login/screens/eula_screen.h" |
| 16 #include "chrome/browser/chromeos/login/ui/login_web_dialog.h" | 16 #include "chrome/browser/chromeos/login/ui/login_web_dialog.h" |
| 17 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 17 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 20 #include "chrome/grit/chromium_strings.h" | 20 #include "chrome/grit/chromium_strings.h" |
| 21 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
| 22 #include "chrome/grit/locale_settings.h" | 22 #include "chrome/grit/locale_settings.h" |
| 23 #include "components/login/localized_values_builder.h" | 23 #include "components/login/localized_values_builder.h" |
| 24 #include "components/login/secure_module_util.h" | |
| 24 #include "components/strings/grit/components_strings.h" | 25 #include "components/strings/grit/components_strings.h" |
| 26 #include "content/public/browser/browser_thread.h" | |
| 25 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 26 #include "rlz/features/features.h" | 28 #include "rlz/features/features.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
| 29 #include "url/gurl.h" | 31 #include "url/gurl.h" |
| 30 | 32 |
| 31 namespace { | 33 namespace { |
| 32 | 34 |
| 33 const char kJsScreenPath[] = "login.EulaScreen"; | 35 const char kJsScreenPath[] = "login.EulaScreen"; |
| 34 | 36 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 IDS_CREDITS_APP_DIALOG_HEIGHT_PIXELS)); | 78 IDS_CREDITS_APP_DIALOG_HEIGHT_PIXELS)); |
| 77 dialog->Show(); | 79 dialog->Show(); |
| 78 // The dialog object will be deleted on dialog close. | 80 // The dialog object will be deleted on dialog close. |
| 79 } | 81 } |
| 80 | 82 |
| 81 } // namespace | 83 } // namespace |
| 82 | 84 |
| 83 namespace chromeos { | 85 namespace chromeos { |
| 84 | 86 |
| 85 EulaScreenHandler::EulaScreenHandler(CoreOobeView* core_oobe_view) | 87 EulaScreenHandler::EulaScreenHandler(CoreOobeView* core_oobe_view) |
| 86 : BaseScreenHandler(kScreenId), core_oobe_view_(core_oobe_view) { | 88 : BaseScreenHandler(kScreenId), |
| 89 core_oobe_view_(core_oobe_view), | |
| 90 weak_factory_(this) { | |
| 87 set_call_js_prefix(kJsScreenPath); | 91 set_call_js_prefix(kJsScreenPath); |
| 88 } | 92 } |
| 89 | 93 |
| 90 EulaScreenHandler::~EulaScreenHandler() { | 94 EulaScreenHandler::~EulaScreenHandler() { |
| 91 if (screen_) | 95 if (screen_) |
| 92 screen_->OnViewDestroyed(this); | 96 screen_->OnViewDestroyed(this); |
| 93 } | 97 } |
| 94 | 98 |
| 95 void EulaScreenHandler::Show() { | 99 void EulaScreenHandler::Show() { |
| 96 if (!page_is_ready()) { | 100 if (!page_is_ready()) { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 118 void EulaScreenHandler::DeclareLocalizedValues( | 122 void EulaScreenHandler::DeclareLocalizedValues( |
| 119 ::login::LocalizedValuesBuilder* builder) { | 123 ::login::LocalizedValuesBuilder* builder) { |
| 120 builder->Add("eulaScreenTitle", IDS_EULA_SCREEN_TITLE); | 124 builder->Add("eulaScreenTitle", IDS_EULA_SCREEN_TITLE); |
| 121 builder->Add("eulaScreenAccessibleTitle", IDS_EULA_SCREEN_ACCESSIBLE_TITLE); | 125 builder->Add("eulaScreenAccessibleTitle", IDS_EULA_SCREEN_ACCESSIBLE_TITLE); |
| 122 builder->Add("checkboxLogging", IDS_EULA_CHECKBOX_ENABLE_LOGGING); | 126 builder->Add("checkboxLogging", IDS_EULA_CHECKBOX_ENABLE_LOGGING); |
| 123 builder->Add("back", IDS_EULA_BACK_BUTTON); | 127 builder->Add("back", IDS_EULA_BACK_BUTTON); |
| 124 builder->Add("next", IDS_EULA_NEXT_BUTTON); | 128 builder->Add("next", IDS_EULA_NEXT_BUTTON); |
| 125 builder->Add("acceptAgreement", IDS_EULA_ACCEPT_AND_CONTINUE_BUTTON); | 129 builder->Add("acceptAgreement", IDS_EULA_ACCEPT_AND_CONTINUE_BUTTON); |
| 126 builder->Add("eulaSystemInstallationSettings", | 130 builder->Add("eulaSystemInstallationSettings", |
| 127 IDS_EULA_SYSTEM_SECURITY_SETTING); | 131 IDS_EULA_SYSTEM_SECURITY_SETTING); |
| 128 builder->Add("eulaTpmDesc", IDS_EULA_TPM_DESCRIPTION); | 132 |
| 129 builder->Add("eulaTpmKeyDesc", IDS_EULA_TPM_KEY_DESCRIPTION); | 133 switch (::login::GetSecureModuleUsed()) { |
| 130 builder->Add("eulaTpmDescPowerwash", IDS_EULA_TPM_KEY_DESCRIPTION_POWERWASH); | 134 case ::login::SecureModuleUsed::CR50: |
| 131 builder->Add("eulaTpmBusy", IDS_EULA_TPM_BUSY); | 135 case ::login::SecureModuleUsed::UNQUERIED: |
| 136 builder->Add("eulaTpmDesc", IDS_EULA_SECURE_MODULE_DESCRIPTION); | |
| 137 builder->Add("eulaTpmKeyDesc", IDS_EULA_SECURE_MODULE_KEY_DESCRIPTION); | |
| 138 builder->Add("eulaTpmDescPowerwash", | |
| 139 IDS_EULA_SECURE_MODULE_KEY_DESCRIPTION_POWERWASH); | |
| 140 builder->Add("eulaTpmBusy", IDS_EULA_SECURE_MODULE_BUSY); | |
| 141 if (::login::GetSecureModuleUsed() == | |
| 142 ::login::SecureModuleUsed::UNQUERIED) { | |
| 143 content::BrowserThread::PostTaskAndReply( | |
| 144 content::BrowserThread::IO, FROM_HERE, | |
| 145 base::BindOnce(&::login::QuerySecureModuleUsed), | |
| 146 base::BindOnce(&EulaScreenHandler::UpdateLocalizedValues, | |
| 147 weak_factory_.GetWeakPtr())); | |
| 148 } | |
| 149 break; | |
| 150 case ::login::SecureModuleUsed::TPM: | |
| 151 builder->Add("eulaTpmDesc", IDS_EULA_TPM_DESCRIPTION); | |
| 152 builder->Add("eulaTpmKeyDesc", IDS_EULA_TPM_KEY_DESCRIPTION); | |
| 153 builder->Add("eulaTpmDescPowerwash", | |
| 154 IDS_EULA_TPM_KEY_DESCRIPTION_POWERWASH); | |
| 155 builder->Add("eulaTpmBusy", IDS_EULA_TPM_BUSY); | |
| 156 break; | |
| 157 } | |
| 158 | |
| 132 builder->Add("eulaSystemInstallationSettingsOkButton", IDS_OK); | 159 builder->Add("eulaSystemInstallationSettingsOkButton", IDS_OK); |
| 133 builder->Add("termsOfServiceLoading", IDS_TERMS_OF_SERVICE_SCREEN_LOADING); | 160 builder->Add("termsOfServiceLoading", IDS_TERMS_OF_SERVICE_SCREEN_LOADING); |
| 134 #if BUILDFLAG(ENABLE_RLZ) | 161 #if BUILDFLAG(ENABLE_RLZ) |
| 135 builder->AddF("eulaRlzDesc", | 162 builder->AddF("eulaRlzDesc", |
| 136 IDS_EULA_RLZ_DESCRIPTION, | 163 IDS_EULA_RLZ_DESCRIPTION, |
| 137 IDS_SHORT_PRODUCT_NAME, | 164 IDS_SHORT_PRODUCT_NAME, |
| 138 IDS_PRODUCT_NAME); | 165 IDS_PRODUCT_NAME); |
| 139 builder->AddF("eulaRlzEnable", | 166 builder->AddF("eulaRlzEnable", |
| 140 IDS_EULA_RLZ_ENABLE, | 167 IDS_EULA_RLZ_ENABLE, |
| 141 IDS_SHORT_PRODUCT_OS_NAME); | 168 IDS_SHORT_PRODUCT_OS_NAME); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 GetNativeWindow(), | 239 GetNativeWindow(), |
| 213 IDS_ABOUT_VERSION_LICENSE_EULA, | 240 IDS_ABOUT_VERSION_LICENSE_EULA, |
| 214 GURL(chrome::kChromeUICreditsURL)); | 241 GURL(chrome::kChromeUICreditsURL)); |
| 215 } | 242 } |
| 216 | 243 |
| 217 void EulaScreenHandler::HandleOnInstallationSettingsPopupOpened() { | 244 void EulaScreenHandler::HandleOnInstallationSettingsPopupOpened() { |
| 218 if (screen_) | 245 if (screen_) |
| 219 screen_->InitiatePasswordFetch(); | 246 screen_->InitiatePasswordFetch(); |
| 220 } | 247 } |
| 221 | 248 |
| 249 void EulaScreenHandler::UpdateLocalizedValues() { | |
| 250 GetOobeUI()->UpdateLocalizedStringsIfNeeded(); | |
|
sammiequon
2017/05/04 16:04:47
Is there a better approach than updating everythin
xiyuan
2017/05/04 18:26:35
UpdateLocalizedStringsIfNeeded() only reloads when
sammiequon
2017/05/04 22:30:41
Attempted.
| |
| 251 } | |
| 252 | |
| 222 } // namespace chromeos | 253 } // namespace chromeos |
| OLD | NEW |