Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/settings/about_handler.h" | 5 #include "chrome/browser/ui/webui/settings/about_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 namespace settings { | 256 namespace settings { |
| 257 | 257 |
| 258 AboutHandler::AboutHandler() : weak_factory_(this) {} | 258 AboutHandler::AboutHandler() : weak_factory_(this) {} |
| 259 | 259 |
| 260 AboutHandler::~AboutHandler() {} | 260 AboutHandler::~AboutHandler() {} |
| 261 | 261 |
| 262 AboutHandler* AboutHandler::Create(content::WebUIDataSource* html_source, | 262 AboutHandler* AboutHandler::Create(content::WebUIDataSource* html_source, |
| 263 Profile* profile) { | 263 Profile* profile) { |
| 264 html_source->AddString( | 264 html_source->AddString( |
| 265 "aboutBrowserVersion", | 265 "aboutBrowserVersion", |
| 266 l10n_util::GetStringFUTF16(IDS_ABOUT_PRODUCT_VERSION, | 266 l10n_util::GetStringFUTF16( |
| 267 BuildBrowserVersionString())); | 267 IDS_SETTINGS_ABOUT_PAGE_BROWSER_VERSION, |
| 268 base::UTF8ToUTF16(version_info::GetVersionNumber()), | |
| 269 l10n_util::GetStringUTF16(version_info::IsOfficialBuild() | |
| 270 ? IDS_VERSION_UI_OFFICIAL | |
| 271 : IDS_VERSION_UI_UNOFFICIAL), | |
| 272 base::UTF8ToUTF16(chrome::GetChannelString()), | |
| 273 #if defined(ARCH_CPU_64_BITS) | |
| 274 l10n_util::GetStringUTF16(IDS_VERSION_UI_64BIT))); | |
| 275 #else | |
| 276 l10n_util::GetStringUTF16(IDS_VERSION_UI_32BIT))); | |
| 277 #endif | |
| 268 | 278 |
| 269 html_source->AddString( | 279 html_source->AddString( |
| 270 "aboutProductCopyright", | 280 "aboutProductCopyright", |
| 271 base::i18n::MessageFormatter::FormatWithNumberedArgs( | 281 base::i18n::MessageFormatter::FormatWithNumberedArgs( |
| 272 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT), | 282 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT), |
| 273 base::Time::Now())); | 283 base::Time::Now())); |
| 274 | 284 |
| 275 base::string16 license = l10n_util::GetStringFUTF16( | 285 base::string16 license = l10n_util::GetStringFUTF16( |
| 276 IDS_VERSION_UI_LICENSE, base::ASCIIToUTF16(chrome::kChromiumProjectURL), | 286 IDS_VERSION_UI_LICENSE, base::ASCIIToUTF16(chrome::kChromiumProjectURL), |
| 277 base::ASCIIToUTF16(chrome::kChromeUICreditsURL)); | 287 base::ASCIIToUTF16(chrome::kChromeUICreditsURL)); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 389 void AboutHandler::Observe(int type, | 399 void AboutHandler::Observe(int type, |
| 390 const content::NotificationSource& source, | 400 const content::NotificationSource& source, |
| 391 const content::NotificationDetails& details) { | 401 const content::NotificationDetails& details) { |
| 392 DCHECK_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, type); | 402 DCHECK_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, type); |
| 393 | 403 |
| 394 // A version update is installed and ready to go. Refresh the UI so the | 404 // A version update is installed and ready to go. Refresh the UI so the |
| 395 // correct state will be shown. | 405 // correct state will be shown. |
| 396 RequestUpdate(); | 406 RequestUpdate(); |
| 397 } | 407 } |
| 398 | 408 |
| 399 // static | |
| 400 base::string16 AboutHandler::BuildBrowserVersionString() { | |
| 401 std::string version = version_info::GetVersionNumber(); | |
| 402 | |
| 403 std::string modifier = chrome::GetChannelString(); | |
| 404 if (!modifier.empty()) | |
| 405 version += " " + modifier; | |
| 406 | |
| 407 #if defined(ARCH_CPU_64_BITS) | |
| 408 version += " (64-bit)"; | |
|
Dan Beam
2016/12/03 01:26:07
ahhhh, this wasn't using IDS_VERSION_UI_{32,64}BIT
dpapad
2016/12/03 02:08:30
Acknowledged.
| |
| 409 #endif | |
| 410 | |
| 411 return base::UTF8ToUTF16(version); | |
| 412 } | |
| 413 | |
| 414 void AboutHandler::OnDeviceAutoUpdatePolicyChanged( | 409 void AboutHandler::OnDeviceAutoUpdatePolicyChanged( |
| 415 const base::Value* previous_policy, | 410 const base::Value* previous_policy, |
| 416 const base::Value* current_policy) { | 411 const base::Value* current_policy) { |
| 417 bool previous_auto_update_disabled = false; | 412 bool previous_auto_update_disabled = false; |
| 418 if (previous_policy) | 413 if (previous_policy) |
| 419 CHECK(previous_policy->GetAsBoolean(&previous_auto_update_disabled)); | 414 CHECK(previous_policy->GetAsBoolean(&previous_auto_update_disabled)); |
| 420 | 415 |
| 421 bool current_auto_update_disabled = false; | 416 bool current_auto_update_disabled = false; |
| 422 if (current_policy) | 417 if (current_policy) |
| 423 CHECK(current_policy->GetAsBoolean(¤t_auto_update_disabled)); | 418 CHECK(current_policy->GetAsBoolean(¤t_auto_update_disabled)); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 std::string url = | 643 std::string url = |
| 649 std::string("chrome://") + chrome::kChromeOSAssetHost + "/" + image_path; | 644 std::string("chrome://") + chrome::kChromeOSAssetHost + "/" + image_path; |
| 650 regulatory_info->SetString("url", url); | 645 regulatory_info->SetString("url", url); |
| 651 | 646 |
| 652 ResolveJavascriptCallback(base::StringValue(callback_id), *regulatory_info); | 647 ResolveJavascriptCallback(base::StringValue(callback_id), *regulatory_info); |
| 653 } | 648 } |
| 654 | 649 |
| 655 #endif // defined(OS_CHROMEOS) | 650 #endif // defined(OS_CHROMEOS) |
| 656 | 651 |
| 657 } // namespace settings | 652 } // namespace settings |
| OLD | NEW |