| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } else if (user_manager::UserManager::Get()->IsCurrentUserOwner()) { | 105 } else if (user_manager::UserManager::Get()->IsCurrentUserOwner()) { |
| 106 // On non managed machines we have local owner who is the only one to change | 106 // On non managed machines we have local owner who is the only one to change |
| 107 // anything. Ensure that ReleaseChannelDelegated is false. | 107 // anything. Ensure that ReleaseChannelDelegated is false. |
| 108 return !value; | 108 return !value; |
| 109 } | 109 } |
| 110 return false; | 110 return false; |
| 111 } | 111 } |
| 112 | 112 |
| 113 #endif // defined(OS_CHROMEOS) | 113 #endif // defined(OS_CHROMEOS) |
| 114 | 114 |
| 115 base::string16 BrowserVersionString(bool long_html) { | |
| 116 chrome::VersionInfo version_info; | |
| 117 DCHECK(version_info.is_valid()); | |
| 118 | |
| 119 std::string version = version_info.Version(); | |
| 120 | |
| 121 std::string modifier = chrome::VersionInfo::GetVersionStringModifier(); | |
| 122 if (!modifier.empty()) | |
| 123 version += " " + modifier; | |
| 124 | |
| 125 #if defined(ARCH_CPU_64_BITS) | |
| 126 version += " (64-bit)"; | |
| 127 #endif | |
| 128 | |
| 129 if (long_html) | |
| 130 version += "<br>(" + version_info.LastChange() + ")"; | |
| 131 | |
| 132 return base::UTF8ToUTF16(version); | |
| 133 } | |
| 134 | |
| 135 } // namespace | 115 } // namespace |
| 136 | 116 |
| 137 HelpHandler::HelpHandler() | 117 HelpHandler::HelpHandler() |
| 138 : version_updater_(VersionUpdater::Create()), | 118 : version_updater_(VersionUpdater::Create()), |
| 139 weak_factory_(this) { | 119 weak_factory_(this) { |
| 140 } | 120 } |
| 141 | 121 |
| 142 HelpHandler::~HelpHandler() { | 122 HelpHandler::~HelpHandler() { |
| 143 } | 123 } |
| 144 | 124 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 "updateObsoleteSystem", | 207 "updateObsoleteSystem", |
| 228 ObsoleteSystemMac::LocalizedObsoleteSystemString()); | 208 ObsoleteSystemMac::LocalizedObsoleteSystemString()); |
| 229 localized_strings->SetString( | 209 localized_strings->SetString( |
| 230 "updateObsoleteSystemURL", | 210 "updateObsoleteSystemURL", |
| 231 chrome::kMac32BitDeprecationURL); | 211 chrome::kMac32BitDeprecationURL); |
| 232 #endif | 212 #endif |
| 233 | 213 |
| 234 localized_strings->SetString( | 214 localized_strings->SetString( |
| 235 "browserVersion", | 215 "browserVersion", |
| 236 l10n_util::GetStringFUTF16(IDS_ABOUT_PRODUCT_VERSION, | 216 l10n_util::GetStringFUTF16(IDS_ABOUT_PRODUCT_VERSION, |
| 237 BrowserVersionString(false))); | 217 BuildBrowserVersionString())); |
| 238 localized_strings->SetString( | |
| 239 "browserVersionLongHtml", | |
| 240 l10n_util::GetStringFUTF16(IDS_ABOUT_PRODUCT_VERSION, | |
| 241 BrowserVersionString(true))); | |
| 242 | 218 |
| 243 base::Time::Exploded exploded_time; | 219 base::Time::Exploded exploded_time; |
| 244 base::Time::Now().LocalExplode(&exploded_time); | 220 base::Time::Now().LocalExplode(&exploded_time); |
| 245 localized_strings->SetString( | 221 localized_strings->SetString( |
| 246 "productCopyright", | 222 "productCopyright", |
| 247 l10n_util::GetStringFUTF16(IDS_ABOUT_VERSION_COPYRIGHT, | 223 l10n_util::GetStringFUTF16(IDS_ABOUT_VERSION_COPYRIGHT, |
| 248 base::IntToString16(exploded_time.year))); | 224 base::IntToString16(exploded_time.year))); |
| 249 | 225 |
| 250 base::string16 license = l10n_util::GetStringFUTF16( | 226 base::string16 license = l10n_util::GetStringFUTF16( |
| 251 IDS_ABOUT_VERSION_LICENSE, | 227 IDS_ABOUT_VERSION_LICENSE, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 RequestUpdate(NULL); | 304 RequestUpdate(NULL); |
| 329 break; | 305 break; |
| 330 } | 306 } |
| 331 default: | 307 default: |
| 332 NOTREACHED(); | 308 NOTREACHED(); |
| 333 } | 309 } |
| 334 } | 310 } |
| 335 | 311 |
| 336 // static | 312 // static |
| 337 base::string16 HelpHandler::BuildBrowserVersionString() { | 313 base::string16 HelpHandler::BuildBrowserVersionString() { |
| 338 return BrowserVersionString(false); | 314 chrome::VersionInfo version_info; |
| 315 DCHECK(version_info.is_valid()); |
| 316 |
| 317 std::string version = version_info.Version(); |
| 318 |
| 319 std::string modifier = chrome::VersionInfo::GetVersionStringModifier(); |
| 320 if (!modifier.empty()) |
| 321 version += " " + modifier; |
| 322 |
| 323 #if defined(ARCH_CPU_64_BITS) |
| 324 version += " (64-bit)"; |
| 325 #endif |
| 326 |
| 327 return base::UTF8ToUTF16(version); |
| 339 } | 328 } |
| 340 | 329 |
| 341 void HelpHandler::OnPageLoaded(const base::ListValue* args) { | 330 void HelpHandler::OnPageLoaded(const base::ListValue* args) { |
| 342 #if defined(OS_CHROMEOS) | 331 #if defined(OS_CHROMEOS) |
| 343 // Version information is loaded from a callback | 332 // Version information is loaded from a callback |
| 344 loader_.GetVersion( | 333 loader_.GetVersion( |
| 345 chromeos::VersionLoader::VERSION_FULL, | 334 chromeos::VersionLoader::VERSION_FULL, |
| 346 base::Bind(&HelpHandler::OnOSVersion, base::Unretained(this)), | 335 base::Bind(&HelpHandler::OnOSVersion, base::Unretained(this)), |
| 347 &tracker_); | 336 &tracker_); |
| 348 loader_.GetFirmware( | 337 loader_.GetFirmware( |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 web_ui()->CallJavascriptFunction( | 553 web_ui()->CallJavascriptFunction( |
| 565 "help.HelpPage.updateCurrentChannel", base::StringValue(channel)); | 554 "help.HelpPage.updateCurrentChannel", base::StringValue(channel)); |
| 566 } | 555 } |
| 567 | 556 |
| 568 void HelpHandler::OnTargetChannel(const std::string& channel) { | 557 void HelpHandler::OnTargetChannel(const std::string& channel) { |
| 569 web_ui()->CallJavascriptFunction( | 558 web_ui()->CallJavascriptFunction( |
| 570 "help.HelpPage.updateTargetChannel", base::StringValue(channel)); | 559 "help.HelpPage.updateTargetChannel", base::StringValue(channel)); |
| 571 } | 560 } |
| 572 | 561 |
| 573 #endif // defined(OS_CHROMEOS) | 562 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |