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/help/help_handler.h" | 5 #include "chrome/browser/ui/webui/help/help_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 std::string ReadRegulatoryLabelText(const base::FilePath& path) { | 191 std::string ReadRegulatoryLabelText(const base::FilePath& path) { |
| 192 base::FilePath text_path(chrome::kChromeOSAssetPath); | 192 base::FilePath text_path(chrome::kChromeOSAssetPath); |
| 193 text_path = text_path.Append(path); | 193 text_path = text_path.Append(path); |
| 194 text_path = text_path.AppendASCII(kRegulatoryLabelTextFilename); | 194 text_path = text_path.AppendASCII(kRegulatoryLabelTextFilename); |
| 195 | 195 |
| 196 std::string contents; | 196 std::string contents; |
| 197 if (base::ReadFileToString(text_path, &contents)) | 197 if (base::ReadFileToString(text_path, &contents)) |
| 198 return contents; | 198 return contents; |
| 199 return std::string(); | 199 return std::string(); |
| 200 } | 200 } |
| 201 | |
| 202 // Returns messages that applys to this eol status | |
| 203 base::string16 GetEolMessage(update_engine::EndOfLifeStatus status) { | |
| 204 if (status == update_engine::EndOfLifeStatus::kSecurityOnly) { | |
| 205 return l10n_util::GetStringUTF16(IDS_ABOUT_PAGE_EOL_SECURITY_ONLY); | |
| 206 | |
| 207 } else { | |
| 208 return l10n_util::GetStringUTF16(IDS_ABOUT_PAGE_EOL_EOL); | |
| 209 } | |
| 210 } | |
| 211 | |
| 212 #endif // defined(OS_CHROMEOS) | 201 #endif // defined(OS_CHROMEOS) |
| 213 | 202 |
| 214 } // namespace | 203 } // namespace |
| 215 | 204 |
| 216 HelpHandler::HelpHandler() | 205 HelpHandler::HelpHandler() |
| 217 : policy_registrar_( | 206 : policy_registrar_( |
| 218 g_browser_process->policy_service(), | 207 g_browser_process->policy_service(), |
| 219 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())), | 208 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())), |
| 220 weak_factory_(this) { | 209 weak_factory_(this) { |
| 221 } | 210 } |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 747 } | 736 } |
| 748 | 737 |
| 749 void HelpHandler::OnRegulatoryLabelTextRead(const std::string& text) { | 738 void HelpHandler::OnRegulatoryLabelTextRead(const std::string& text) { |
| 750 // Remove unnecessary whitespace. | 739 // Remove unnecessary whitespace. |
| 751 web_ui()->CallJavascriptFunctionUnsafe( | 740 web_ui()->CallJavascriptFunctionUnsafe( |
| 752 "help.HelpPage.setRegulatoryLabelText", | 741 "help.HelpPage.setRegulatoryLabelText", |
| 753 base::StringValue(base::CollapseWhitespaceASCII(text, true))); | 742 base::StringValue(base::CollapseWhitespaceASCII(text, true))); |
| 754 } | 743 } |
| 755 | 744 |
| 756 void HelpHandler::OnEolStatus(update_engine::EndOfLifeStatus status) { | 745 void HelpHandler::OnEolStatus(update_engine::EndOfLifeStatus status) { |
| 757 if (status == update_engine::EndOfLifeStatus::kSupported || | 746 // Security only state is no longer supported. |
| 747 if (status == update_engine::EndOfLifeStatus::kSecurityOnly || | |
|
xiyuan
2017/02/27 18:02:33
Just to confirm:
- Before the CL, we skip kSupport
| |
| 758 IsEnterpriseManaged()) { | 748 IsEnterpriseManaged()) { |
| 759 return; | 749 return; |
| 760 } | 750 } |
| 761 | 751 |
| 762 if (status == update_engine::EndOfLifeStatus::kSupported) { | 752 if (status == update_engine::EndOfLifeStatus::kSupported) { |
| 763 web_ui()->CallJavascriptFunctionUnsafe( | 753 web_ui()->CallJavascriptFunctionUnsafe( |
| 764 "help.HelpPage.updateEolMessage", base::StringValue("device_supported"), | 754 "help.HelpPage.updateEolMessage", base::StringValue("device_supported"), |
| 765 base::StringValue("")); | 755 base::StringValue("")); |
| 766 } else { | 756 } else { |
| 767 base::string16 message = GetEolMessage(status); | |
| 768 web_ui()->CallJavascriptFunctionUnsafe( | 757 web_ui()->CallJavascriptFunctionUnsafe( |
| 769 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"), | 758 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"), |
| 770 base::StringValue(message)); | 759 base::StringValue(l10n_util::GetStringUTF16(IDS_ABOUT_PAGE_EOL_EOL))); |
| 771 } | 760 } |
| 772 } | 761 } |
| 773 | 762 |
| 774 #endif // defined(OS_CHROMEOS) | 763 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |