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

Side by Side Diff: chrome/browser/ui/webui/help/help_handler.cc

Issue 2081873002: Incorporate comments in Dbus code and add Eol icon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "chrome/browser/profiles/profile.h" 67 #include "chrome/browser/profiles/profile.h"
68 #include "chrome/browser/ui/webui/chromeos/image_source.h" 68 #include "chrome/browser/ui/webui/chromeos/image_source.h"
69 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h" 69 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h"
70 #include "chrome/browser/ui/webui/help/version_updater_chromeos.h" 70 #include "chrome/browser/ui/webui/help/version_updater_chromeos.h"
71 #include "chromeos/chromeos_switches.h" 71 #include "chromeos/chromeos_switches.h"
72 #include "chromeos/dbus/dbus_thread_manager.h" 72 #include "chromeos/dbus/dbus_thread_manager.h"
73 #include "chromeos/dbus/power_manager_client.h" 73 #include "chromeos/dbus/power_manager_client.h"
74 #include "chromeos/system/statistics_provider.h" 74 #include "chromeos/system/statistics_provider.h"
75 #include "components/prefs/pref_service.h" 75 #include "components/prefs/pref_service.h"
76 #include "components/user_manager/user_manager.h" 76 #include "components/user_manager/user_manager.h"
77 #include "third_party/cros_system_api/dbus/update_engine/dbus-constants.h"
78 #endif 77 #endif
79 78
80 using base::ListValue; 79 using base::ListValue;
81 using content::BrowserThread; 80 using content::BrowserThread;
82 81
83 namespace { 82 namespace {
84 83
85 #if defined(OS_CHROMEOS) 84 #if defined(OS_CHROMEOS)
86 85
87 // Directory containing the regulatory labels for supported regions. 86 // Directory containing the regulatory labels for supported regions.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 text_path = text_path.Append(path); 200 text_path = text_path.Append(path);
202 text_path = text_path.AppendASCII(kRegulatoryLabelTextFilename); 201 text_path = text_path.AppendASCII(kRegulatoryLabelTextFilename);
203 202
204 std::string contents; 203 std::string contents;
205 if (base::ReadFileToString(text_path, &contents)) 204 if (base::ReadFileToString(text_path, &contents))
206 return contents; 205 return contents;
207 return std::string(); 206 return std::string();
208 } 207 }
209 208
210 // Returns messages that applys to this eol status 209 // Returns messages that applys to this eol status
211 base::string16 GetEolMessage(int status) { 210 base::string16 GetEolMessage(update_engine::EndOfLifeStatus status) {
212 if (status == update_engine::EndOfLifeStatus::kSecurityOnly) { 211 if (status == update_engine::EndOfLifeStatus::kSecurityOnly) {
213 return l10n_util::GetStringFUTF16( 212 return l10n_util::GetStringFUTF16(
214 IDS_ABOUT_PAGE_EOL_SECURITY_ONLY, 213 IDS_ABOUT_PAGE_EOL_SECURITY_ONLY,
215 base::ASCIIToUTF16(chrome::kEolNotificationURL)); 214 base::ASCIIToUTF16(chrome::kEolNotificationURL));
216 215
217 } else { 216 } else {
218 return l10n_util::GetStringFUTF16( 217 return l10n_util::GetStringFUTF16(
219 IDS_ABOUT_PAGE_EOL_EOL, 218 IDS_ABOUT_PAGE_EOL_EOL,
220 base::ASCIIToUTF16(chrome::kEolNotificationURL)); 219 base::ASCIIToUTF16(chrome::kEolNotificationURL));
221 } 220 }
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 base::StringValue(url)); 756 base::StringValue(url));
758 } 757 }
759 758
760 void HelpHandler::OnRegulatoryLabelTextRead(const std::string& text) { 759 void HelpHandler::OnRegulatoryLabelTextRead(const std::string& text) {
761 // Remove unnecessary whitespace. 760 // Remove unnecessary whitespace.
762 web_ui()->CallJavascriptFunctionUnsafe( 761 web_ui()->CallJavascriptFunctionUnsafe(
763 "help.HelpPage.setRegulatoryLabelText", 762 "help.HelpPage.setRegulatoryLabelText",
764 base::StringValue(base::CollapseWhitespaceASCII(text, true))); 763 base::StringValue(base::CollapseWhitespaceASCII(text, true)));
765 } 764 }
766 765
767 void HelpHandler::OnEolStatus(const int status) { 766 void HelpHandler::OnEolStatus(update_engine::EndOfLifeStatus status) {
768 if (status == update_engine::EndOfLifeStatus::kSupported || 767 if (status == update_engine::EndOfLifeStatus::kSupported ||
769 IsEnterpriseManaged()) { 768 IsEnterpriseManaged()) {
770 return; 769 return;
771 } 770 }
772 771
773 if (status == update_engine::EndOfLifeStatus::kSupported) { 772 if (status == update_engine::EndOfLifeStatus::kSupported) {
774 web_ui()->CallJavascriptFunctionUnsafe( 773 web_ui()->CallJavascriptFunctionUnsafe(
775 "help.HelpPage.updateEolMessage", base::StringValue("device_supported"), 774 "help.HelpPage.updateEolMessage", base::StringValue("device_supported"),
776 base::StringValue("")); 775 base::StringValue(""));
777 } else { 776 } else {
778 base::string16 message = GetEolMessage(status); 777 base::string16 message = GetEolMessage(status);
779 web_ui()->CallJavascriptFunctionUnsafe( 778 web_ui()->CallJavascriptFunctionUnsafe(
780 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"), 779 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"),
781 base::StringValue(message)); 780 base::StringValue(message));
782 } 781 }
783 } 782 }
784 783
785 #endif // defined(OS_CHROMEOS) 784 #endif // defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698