Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1909)

Unified Diff: chrome/browser/ui/webui/help/help_handler.cc

Issue 2060623002: Implementation of Device End of Life Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify browsertest Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/help/help_handler.cc
diff --git a/chrome/browser/ui/webui/help/help_handler.cc b/chrome/browser/ui/webui/help/help_handler.cc
index 3fd9934437ec26d1ef095d98a8ba52a9efe9adea..e8d862165685ccfa960e3d0e13e6965e6ff6e125 100644
--- a/chrome/browser/ui/webui/help/help_handler.cc
+++ b/chrome/browser/ui/webui/help/help_handler.cc
@@ -9,6 +9,7 @@
#include <string>
#include "ash/system/chromeos/devicetype_utils.h"
+#include "base/base_switches.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
@@ -73,6 +74,7 @@
#include "chromeos/system/statistics_provider.h"
#include "components/prefs/pref_service.h"
#include "components/user_manager/user_manager.h"
+#include "third_party/cros_system_api/dbus/update_engine/dbus-constants.h"
#endif
using base::ListValue;
@@ -205,6 +207,19 @@ std::string ReadRegulatoryLabelText(const base::FilePath& path) {
return std::string();
}
+// Returns messages that applys to this eol status
+base::string16 GetEolMessage(int status) {
+ base::string16 eol_link = l10n_util::GetStringFUTF16(
+ IDS_EOL_MORE_INFO_LINK, base::ASCIIToUTF16(chrome::kEolNotificationURL),
+ base::ASCIIToUTF16(chrome::kEolNotificationURL));
+ if (status == update_engine::EndOfLifeStatus::kSecurityOnly) {
+ return l10n_util::GetStringUTF16(IDS_ABOUT_PAGE_EOL_SECURITY_ONLY) +
+ eol_link;
+ } else {
+ return l10n_util::GetStringUTF16(IDS_ABOUT_PAGE_EOL_EOL) + eol_link;
xiyuan 2016/06/16 22:41:28 Cancat strings like this is not i18n friendly beca
xiaoyinh(OOO Sep 11-29) 2016/06/17 04:07:35 Done.
+ }
+}
+
#endif // defined(OS_CHROMEOS)
} // namespace
@@ -516,6 +531,12 @@ void HelpHandler::OnPageLoaded(const base::ListValue* args) {
version_updater_->GetChannel(false,
base::Bind(&HelpHandler::OnTargetChannel, weak_factory_.GetWeakPtr()));
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ chromeos::switches::kEnableEolNotification)) {
+ version_updater_->GetEolStatus(
+ base::Bind(&HelpHandler::OnEolStatus, weak_factory_.GetWeakPtr()));
+ }
+
base::PostTaskAndReplyWithResult(
content::BrowserThread::GetBlockingPool(),
FROM_HERE,
@@ -742,4 +763,22 @@ void HelpHandler::OnRegulatoryLabelTextRead(const std::string& text) {
base::StringValue(base::CollapseWhitespaceASCII(text, true)));
}
+void HelpHandler::OnEolStatus(const int status) {
+ if (status == update_engine::EndOfLifeStatus::kSupported ||
+ IsEnterpriseManaged()) {
+ return;
+ }
+
+ if (status == update_engine::EndOfLifeStatus::kSupported) {
+ web_ui()->CallJavascriptFunctionUnsafe(
+ "help.HelpPage.updateEolMessage", base::StringValue("device_supported"),
+ base::StringValue(""));
+ } else {
+ base::string16 message = GetEolMessage(status);
+ web_ui()->CallJavascriptFunctionUnsafe(
+ "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"),
+ base::StringValue(message));
+ }
+}
+
#endif // defined(OS_CHROMEOS)

Powered by Google App Engine
This is Rietveld 408576698