| 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 20 matching lines...) Expand all Loading... |
| 31 #include "content/public/browser/web_ui_data_source.h" | 31 #include "content/public/browser/web_ui_data_source.h" |
| 32 #include "content/public/common/content_client.h" | 32 #include "content/public/common/content_client.h" |
| 33 #include "grit/chromium_strings.h" | 33 #include "grit/chromium_strings.h" |
| 34 #include "grit/generated_resources.h" | 34 #include "grit/generated_resources.h" |
| 35 #include "grit/google_chrome_strings.h" | 35 #include "grit/google_chrome_strings.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 37 #include "ui/base/resource/resource_bundle.h" | 37 #include "ui/base/resource/resource_bundle.h" |
| 38 #include "v8/include/v8.h" | 38 #include "v8/include/v8.h" |
| 39 #include "webkit/common/user_agent/user_agent_util.h" | 39 #include "webkit/common/user_agent/user_agent_util.h" |
| 40 | 40 |
| 41 #if defined(OS_MACOSX) |
| 42 #include "chrome/browser/mac/obsolete_system.h" |
| 43 #endif |
| 44 |
| 41 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
| 42 #include "base/files/file_util_proxy.h" | 46 #include "base/files/file_util_proxy.h" |
| 43 #include "base/i18n/time_formatting.h" | 47 #include "base/i18n/time_formatting.h" |
| 44 #include "base/prefs/pref_service.h" | 48 #include "base/prefs/pref_service.h" |
| 45 #include "base/sys_info.h" | 49 #include "base/sys_info.h" |
| 46 #include "chrome/browser/chromeos/login/user_manager.h" | 50 #include "chrome/browser/chromeos/login/user_manager.h" |
| 47 #include "chrome/browser/chromeos/settings/cros_settings.h" | 51 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 48 #include "chrome/browser/profiles/profile.h" | 52 #include "chrome/browser/profiles/profile.h" |
| 49 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h" | 53 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h" |
| 50 #include "chromeos/chromeos_switches.h" | 54 #include "chromeos/chromeos_switches.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 { "promote", IDS_ABOUT_CHROME_PROMOTE_UPDATER }, | 212 { "promote", IDS_ABOUT_CHROME_PROMOTE_UPDATER }, |
| 209 { "learnMore", IDS_LEARN_MORE }, | 213 { "learnMore", IDS_LEARN_MORE }, |
| 210 #endif | 214 #endif |
| 211 }; | 215 }; |
| 212 | 216 |
| 213 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) { | 217 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) { |
| 214 source->AddString(resources[i].name, | 218 source->AddString(resources[i].name, |
| 215 l10n_util::GetStringUTF16(resources[i].ids)); | 219 l10n_util::GetStringUTF16(resources[i].ids)); |
| 216 } | 220 } |
| 217 | 221 |
| 222 #if defined(OS_MACOSX) |
| 223 source->AddString("updateObsoleteSystem", |
| 224 ObsoleteSystemMac::LocalizedObsoleteSystemString()); |
| 225 source->AddString("updateObsoleteSystemURL", |
| 226 chrome::kMac32BitDeprecationURL); |
| 227 #endif |
| 228 |
| 218 source->AddString( | 229 source->AddString( |
| 219 "browserVersion", | 230 "browserVersion", |
| 220 l10n_util::GetStringFUTF16(IDS_ABOUT_PRODUCT_VERSION, | 231 l10n_util::GetStringFUTF16(IDS_ABOUT_PRODUCT_VERSION, |
| 221 BuildBrowserVersionString())); | 232 BuildBrowserVersionString())); |
| 222 | 233 |
| 223 base::Time::Exploded exploded_time; | 234 base::Time::Exploded exploded_time; |
| 224 base::Time::Now().LocalExplode(&exploded_time); | 235 base::Time::Now().LocalExplode(&exploded_time); |
| 225 source->AddString( | 236 source->AddString( |
| 226 "productCopyright", | 237 "productCopyright", |
| 227 l10n_util::GetStringFUTF16(IDS_ABOUT_VERSION_COPYRIGHT, | 238 l10n_util::GetStringFUTF16(IDS_ABOUT_VERSION_COPYRIGHT, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 base::StringValue(build_date)); | 348 base::StringValue(build_date)); |
| 338 #endif // defined(OS_CHROMEOS) | 349 #endif // defined(OS_CHROMEOS) |
| 339 | 350 |
| 340 version_updater_->CheckForUpdate( | 351 version_updater_->CheckForUpdate( |
| 341 base::Bind(&HelpHandler::SetUpdateStatus, base::Unretained(this)) | 352 base::Bind(&HelpHandler::SetUpdateStatus, base::Unretained(this)) |
| 342 #if defined(OS_MACOSX) | 353 #if defined(OS_MACOSX) |
| 343 , base::Bind(&HelpHandler::SetPromotionState, base::Unretained(this)) | 354 , base::Bind(&HelpHandler::SetPromotionState, base::Unretained(this)) |
| 344 #endif | 355 #endif |
| 345 ); | 356 ); |
| 346 | 357 |
| 358 #if defined(OS_MACOSX) |
| 359 web_ui()->CallJavascriptFunction( |
| 360 "help.HelpPage.setObsoleteSystem", |
| 361 base::FundamentalValue(ObsoleteSystemMac::Is32BitObsoleteNowOrSoon() && |
| 362 ObsoleteSystemMac::Has32BitOnlyCPU())); |
| 363 web_ui()->CallJavascriptFunction( |
| 364 "help.HelpPage.setObsoleteSystemEndOfTheLine", |
| 365 base::FundamentalValue(ObsoleteSystemMac::Is32BitObsoleteNowOrSoon() && |
| 366 ObsoleteSystemMac::Is32BitEndOfTheLine())); |
| 367 #endif |
| 368 |
| 347 #if defined(OS_CHROMEOS) | 369 #if defined(OS_CHROMEOS) |
| 348 web_ui()->CallJavascriptFunction( | 370 web_ui()->CallJavascriptFunction( |
| 349 "help.HelpPage.updateIsEnterpriseManaged", | 371 "help.HelpPage.updateIsEnterpriseManaged", |
| 350 base::FundamentalValue(IsEnterpriseManaged())); | 372 base::FundamentalValue(IsEnterpriseManaged())); |
| 351 // First argument to GetChannel() is a flag that indicates whether | 373 // First argument to GetChannel() is a flag that indicates whether |
| 352 // current channel should be returned (if true) or target channel | 374 // current channel should be returned (if true) or target channel |
| 353 // (otherwise). | 375 // (otherwise). |
| 354 version_updater_->GetChannel(true, | 376 version_updater_->GetChannel(true, |
| 355 base::Bind(&HelpHandler::OnCurrentChannel, weak_factory_.GetWeakPtr())); | 377 base::Bind(&HelpHandler::OnCurrentChannel, weak_factory_.GetWeakPtr())); |
| 356 version_updater_->GetChannel(false, | 378 version_updater_->GetChannel(false, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 web_ui()->CallJavascriptFunction( | 543 web_ui()->CallJavascriptFunction( |
| 522 "help.HelpPage.updateCurrentChannel", base::StringValue(channel)); | 544 "help.HelpPage.updateCurrentChannel", base::StringValue(channel)); |
| 523 } | 545 } |
| 524 | 546 |
| 525 void HelpHandler::OnTargetChannel(const std::string& channel) { | 547 void HelpHandler::OnTargetChannel(const std::string& channel) { |
| 526 web_ui()->CallJavascriptFunction( | 548 web_ui()->CallJavascriptFunction( |
| 527 "help.HelpPage.updateTargetChannel", base::StringValue(channel)); | 549 "help.HelpPage.updateTargetChannel", base::StringValue(channel)); |
| 528 } | 550 } |
| 529 | 551 |
| 530 #endif // defined(OS_CHROMEOS) | 552 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |