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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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::GetStringUTF16(IDS_ABOUT_PAGE_EOL_SECURITY_ONLY); |
214 IDS_ABOUT_PAGE_EOL_SECURITY_ONLY, | |
215 base::ASCIIToUTF16(chrome::kEolNotificationURL)); | |
216 | 213 |
217 } else { | 214 } else { |
218 return l10n_util::GetStringFUTF16( | 215 return l10n_util::GetStringUTF16(IDS_ABOUT_PAGE_EOL_EOL); |
219 IDS_ABOUT_PAGE_EOL_EOL, | |
220 base::ASCIIToUTF16(chrome::kEolNotificationURL)); | |
221 } | 216 } |
222 } | 217 } |
223 | 218 |
224 #endif // defined(OS_CHROMEOS) | 219 #endif // defined(OS_CHROMEOS) |
225 | 220 |
226 } // namespace | 221 } // namespace |
227 | 222 |
228 HelpHandler::HelpHandler() | 223 HelpHandler::HelpHandler() |
229 : policy_registrar_( | 224 : policy_registrar_( |
230 g_browser_process->policy_service(), | 225 g_browser_process->policy_service(), |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 localized_strings->SetString( | 360 localized_strings->SetString( |
366 "channelChangePageUnstableMessage", | 361 "channelChangePageUnstableMessage", |
367 l10n_util::GetStringFUTF16( | 362 l10n_util::GetStringFUTF16( |
368 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_UNSTABLE_MESSAGE, | 363 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_UNSTABLE_MESSAGE, |
369 product_name)); | 364 product_name)); |
370 | 365 |
371 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 366 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
372 chromeos::switches::kDisableNewChannelSwitcherUI)) { | 367 chromeos::switches::kDisableNewChannelSwitcherUI)) { |
373 localized_strings->SetBoolean("disableNewChannelSwitcherUI", true); | 368 localized_strings->SetBoolean("disableNewChannelSwitcherUI", true); |
374 } | 369 } |
| 370 |
| 371 localized_strings->SetString( |
| 372 "eolLearnMore", l10n_util::GetStringFUTF16( |
| 373 IDS_ABOUT_PAGE_EOL_LEARN_MORE, |
| 374 base::ASCIIToUTF16(chrome::kEolNotificationURL))); |
375 #endif | 375 #endif |
376 | 376 |
377 base::string16 tos = l10n_util::GetStringFUTF16( | 377 base::string16 tos = l10n_util::GetStringFUTF16( |
378 IDS_ABOUT_TERMS_OF_SERVICE, base::UTF8ToUTF16(chrome::kChromeUITermsURL)); | 378 IDS_ABOUT_TERMS_OF_SERVICE, base::UTF8ToUTF16(chrome::kChromeUITermsURL)); |
379 localized_strings->SetString("productTOS", tos); | 379 localized_strings->SetString("productTOS", tos); |
380 | 380 |
381 localized_strings->SetString("webkitVersion", content::GetWebKitVersion()); | 381 localized_strings->SetString("webkitVersion", content::GetWebKitVersion()); |
382 | 382 |
383 localized_strings->SetString("jsEngine", "V8"); | 383 localized_strings->SetString("jsEngine", "V8"); |
384 localized_strings->SetString("jsEngineVersion", v8::V8::GetVersion()); | 384 localized_strings->SetString("jsEngineVersion", v8::V8::GetVersion()); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 "help.HelpPage.updateIsEnterpriseManaged", | 525 "help.HelpPage.updateIsEnterpriseManaged", |
526 base::FundamentalValue(IsEnterpriseManaged())); | 526 base::FundamentalValue(IsEnterpriseManaged())); |
527 // First argument to GetChannel() is a flag that indicates whether | 527 // First argument to GetChannel() is a flag that indicates whether |
528 // current channel should be returned (if true) or target channel | 528 // current channel should be returned (if true) or target channel |
529 // (otherwise). | 529 // (otherwise). |
530 version_updater_->GetChannel(true, | 530 version_updater_->GetChannel(true, |
531 base::Bind(&HelpHandler::OnCurrentChannel, weak_factory_.GetWeakPtr())); | 531 base::Bind(&HelpHandler::OnCurrentChannel, weak_factory_.GetWeakPtr())); |
532 version_updater_->GetChannel(false, | 532 version_updater_->GetChannel(false, |
533 base::Bind(&HelpHandler::OnTargetChannel, weak_factory_.GetWeakPtr())); | 533 base::Bind(&HelpHandler::OnTargetChannel, weak_factory_.GetWeakPtr())); |
534 | 534 |
535 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 535 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
536 chromeos::switches::kEnableEolNotification)) { | 536 chromeos::switches::kDisableEolNotification)) { |
537 version_updater_->GetEolStatus( | 537 version_updater_->GetEolStatus( |
538 base::Bind(&HelpHandler::OnEolStatus, weak_factory_.GetWeakPtr())); | 538 base::Bind(&HelpHandler::OnEolStatus, weak_factory_.GetWeakPtr())); |
539 } | 539 } |
540 | 540 |
541 base::PostTaskAndReplyWithResult( | 541 base::PostTaskAndReplyWithResult( |
542 content::BrowserThread::GetBlockingPool(), | 542 content::BrowserThread::GetBlockingPool(), |
543 FROM_HERE, | 543 FROM_HERE, |
544 base::Bind(&FindRegulatoryLabelDir), | 544 base::Bind(&FindRegulatoryLabelDir), |
545 base::Bind(&HelpHandler::OnRegulatoryLabelDirFound, | 545 base::Bind(&HelpHandler::OnRegulatoryLabelDirFound, |
546 weak_factory_.GetWeakPtr())); | 546 weak_factory_.GetWeakPtr())); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 base::StringValue(url)); | 757 base::StringValue(url)); |
758 } | 758 } |
759 | 759 |
760 void HelpHandler::OnRegulatoryLabelTextRead(const std::string& text) { | 760 void HelpHandler::OnRegulatoryLabelTextRead(const std::string& text) { |
761 // Remove unnecessary whitespace. | 761 // Remove unnecessary whitespace. |
762 web_ui()->CallJavascriptFunctionUnsafe( | 762 web_ui()->CallJavascriptFunctionUnsafe( |
763 "help.HelpPage.setRegulatoryLabelText", | 763 "help.HelpPage.setRegulatoryLabelText", |
764 base::StringValue(base::CollapseWhitespaceASCII(text, true))); | 764 base::StringValue(base::CollapseWhitespaceASCII(text, true))); |
765 } | 765 } |
766 | 766 |
767 void HelpHandler::OnEolStatus(const int status) { | 767 void HelpHandler::OnEolStatus(update_engine::EndOfLifeStatus status) { |
768 if (status == update_engine::EndOfLifeStatus::kSupported || | 768 if (status == update_engine::EndOfLifeStatus::kSupported || |
769 IsEnterpriseManaged()) { | 769 IsEnterpriseManaged()) { |
770 return; | 770 return; |
771 } | 771 } |
772 | 772 |
773 if (status == update_engine::EndOfLifeStatus::kSupported) { | 773 if (status == update_engine::EndOfLifeStatus::kSupported) { |
774 web_ui()->CallJavascriptFunctionUnsafe( | 774 web_ui()->CallJavascriptFunctionUnsafe( |
775 "help.HelpPage.updateEolMessage", base::StringValue("device_supported"), | 775 "help.HelpPage.updateEolMessage", base::StringValue("device_supported"), |
776 base::StringValue("")); | 776 base::StringValue("")); |
777 } else { | 777 } else { |
778 base::string16 message = GetEolMessage(status); | 778 base::string16 message = GetEolMessage(status); |
779 web_ui()->CallJavascriptFunctionUnsafe( | 779 web_ui()->CallJavascriptFunctionUnsafe( |
780 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"), | 780 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"), |
781 base::StringValue(message)); | 781 base::StringValue(message)); |
782 } | 782 } |
783 } | 783 } |
784 | 784 |
785 #endif // defined(OS_CHROMEOS) | 785 #endif // defined(OS_CHROMEOS) |
OLD | NEW |