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

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: rebase the branch 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 423444a5088bcbe386d7028910e974ca65e1884e..f2050af552a10f4b7701e223774eab6721f9306a 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/common/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,20 @@ std::string ReadRegulatoryLabelText(const base::FilePath& path) {
return std::string();
}
+// Returns messages that applys to this eol status
+base::string16 GetEolMessage(int status) {
+ if (status == update_engine::EndOfLifeStatus::kSecurityOnly) {
+ return l10n_util::GetStringFUTF16(
+ IDS_ABOUT_PAGE_EOL_SECURITY_ONLY,
+ base::ASCIIToUTF16(chrome::kEolNotificationURL));
+
+ } else {
+ return l10n_util::GetStringFUTF16(
+ IDS_ABOUT_PAGE_EOL_EOL,
+ base::ASCIIToUTF16(chrome::kEolNotificationURL));
+ }
+}
+
#endif // defined(OS_CHROMEOS)
} // namespace
@@ -516,6 +532,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 +764,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