| 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 28 matching lines...) Expand all Loading... |
| 39 #include "base/file_util_proxy.h" | 39 #include "base/file_util_proxy.h" |
| 40 #include "base/i18n/time_formatting.h" | 40 #include "base/i18n/time_formatting.h" |
| 41 #include "base/sys_info.h" | 41 #include "base/sys_info.h" |
| 42 #include "chrome/browser/chromeos/login/user_manager.h" | 42 #include "chrome/browser/chromeos/login/user_manager.h" |
| 43 #include "chrome/browser/chromeos/settings/cros_settings.h" | 43 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 44 #include "chrome/browser/prefs/pref_service.h" | 44 #include "chrome/browser/prefs/pref_service.h" |
| 45 #include "chrome/browser/profiles/profile.h" | 45 #include "chrome/browser/profiles/profile.h" |
| 46 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 #if defined(OS_MACOSX) | |
| 50 #include "chrome/browser/ui/cocoa/obsolete_os.h" | |
| 51 #endif | |
| 52 | |
| 53 using base::ListValue; | 49 using base::ListValue; |
| 54 using content::BrowserThread; | 50 using content::BrowserThread; |
| 55 | 51 |
| 56 namespace { | 52 namespace { |
| 57 | 53 |
| 58 // Returns the browser version as a string. | 54 // Returns the browser version as a string. |
| 59 string16 BuildBrowserVersionString() { | 55 string16 BuildBrowserVersionString() { |
| 60 chrome::VersionInfo version_info; | 56 chrome::VersionInfo version_info; |
| 61 DCHECK(version_info.is_valid()); | 57 DCHECK(version_info.is_valid()); |
| 62 | 58 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 { "promote", IDS_ABOUT_CHROME_PROMOTE_UPDATER }, | 159 { "promote", IDS_ABOUT_CHROME_PROMOTE_UPDATER }, |
| 164 { "learnMore", IDS_LEARN_MORE }, | 160 { "learnMore", IDS_LEARN_MORE }, |
| 165 #endif | 161 #endif |
| 166 }; | 162 }; |
| 167 | 163 |
| 168 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) { | 164 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resources); ++i) { |
| 169 localized_strings->SetString(resources[i].name, | 165 localized_strings->SetString(resources[i].name, |
| 170 l10n_util::GetStringUTF16(resources[i].ids)); | 166 l10n_util::GetStringUTF16(resources[i].ids)); |
| 171 } | 167 } |
| 172 | 168 |
| 173 #if defined(OS_MACOSX) | |
| 174 localized_strings->SetString("updateObsoleteOS", | |
| 175 chrome::LocalizedObsoleteOSString()); | |
| 176 localized_strings->SetString("updateObsoleteOSURL", | |
| 177 chrome::kMacLeopardObsoleteURL); | |
| 178 #endif | |
| 179 | |
| 180 localized_strings->SetString( | 169 localized_strings->SetString( |
| 181 "browserVersion", | 170 "browserVersion", |
| 182 l10n_util::GetStringFUTF16(IDS_ABOUT_PRODUCT_VERSION, | 171 l10n_util::GetStringFUTF16(IDS_ABOUT_PRODUCT_VERSION, |
| 183 BuildBrowserVersionString())); | 172 BuildBrowserVersionString())); |
| 184 | 173 |
| 185 string16 license = l10n_util::GetStringFUTF16( | 174 string16 license = l10n_util::GetStringFUTF16( |
| 186 IDS_ABOUT_VERSION_LICENSE, | 175 IDS_ABOUT_VERSION_LICENSE, |
| 187 ASCIIToUTF16(chrome::kChromiumProjectURL), | 176 ASCIIToUTF16(chrome::kChromiumProjectURL), |
| 188 ASCIIToUTF16(chrome::kChromeUICreditsURL)); | 177 ASCIIToUTF16(chrome::kChromeUICreditsURL)); |
| 189 localized_strings->SetString("productLicense", license); | 178 localized_strings->SetString("productLicense", license); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 base::Bind(&HelpHandler::SetUpdateStatus, base::Unretained(this)) | 275 base::Bind(&HelpHandler::SetUpdateStatus, base::Unretained(this)) |
| 287 #if defined(OS_MACOSX) | 276 #if defined(OS_MACOSX) |
| 288 , base::Bind(&HelpHandler::SetPromotionState, base::Unretained(this)) | 277 , base::Bind(&HelpHandler::SetPromotionState, base::Unretained(this)) |
| 289 #endif | 278 #endif |
| 290 ); | 279 ); |
| 291 | 280 |
| 292 #if defined(OS_CHROMEOS) | 281 #if defined(OS_CHROMEOS) |
| 293 version_updater_->GetReleaseChannel( | 282 version_updater_->GetReleaseChannel( |
| 294 base::Bind(&HelpHandler::OnReleaseChannel, base::Unretained(this))); | 283 base::Bind(&HelpHandler::OnReleaseChannel, base::Unretained(this))); |
| 295 #endif | 284 #endif |
| 296 | |
| 297 #if defined(OS_MACOSX) | |
| 298 scoped_ptr<base::Value> is_os_obsolete( | |
| 299 base::Value::CreateBooleanValue(chrome::IsOSObsoleteOrNearlySo())); | |
| 300 web_ui()->CallJavascriptFunction("help.HelpPage.setObsoleteOS", | |
| 301 *is_os_obsolete); | |
| 302 #endif | |
| 303 } | 285 } |
| 304 | 286 |
| 305 #if defined(OS_MACOSX) | 287 #if defined(OS_MACOSX) |
| 306 void HelpHandler::PromoteUpdater(const ListValue* args) { | 288 void HelpHandler::PromoteUpdater(const ListValue* args) { |
| 307 version_updater_->PromoteUpdater(); | 289 version_updater_->PromoteUpdater(); |
| 308 } | 290 } |
| 309 #endif | 291 #endif |
| 310 | 292 |
| 311 void HelpHandler::RelaunchNow(const ListValue* args) { | 293 void HelpHandler::RelaunchNow(const ListValue* args) { |
| 312 DCHECK(args->empty()); | 294 DCHECK(args->empty()); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 | 433 |
| 452 // Note that this string will be internationalized. | 434 // Note that this string will be internationalized. |
| 453 string16 last_updated = base::TimeFormatFriendlyDate(time); | 435 string16 last_updated = base::TimeFormatFriendlyDate(time); |
| 454 g_last_updated_string = Value::CreateStringValue(last_updated); | 436 g_last_updated_string = Value::CreateStringValue(last_updated); |
| 455 } | 437 } |
| 456 | 438 |
| 457 web_ui()->CallJavascriptFunction("help.HelpPage.setLastUpdated", | 439 web_ui()->CallJavascriptFunction("help.HelpPage.setLastUpdated", |
| 458 *g_last_updated_string); | 440 *g_last_updated_string); |
| 459 } | 441 } |
| 460 #endif // defined(OS_CHROMEOS) | 442 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |