| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 { "reportAnIssue", IDS_REPORT_AN_ISSUE }, | 143 { "reportAnIssue", IDS_REPORT_AN_ISSUE }, |
| 144 #if defined(OS_CHROMEOS) | 144 #if defined(OS_CHROMEOS) |
| 145 { "platform", IDS_PLATFORM_LABEL }, | 145 { "platform", IDS_PLATFORM_LABEL }, |
| 146 { "firmware", IDS_ABOUT_PAGE_FIRMWARE }, | 146 { "firmware", IDS_ABOUT_PAGE_FIRMWARE }, |
| 147 { "showMoreInfo", IDS_SHOW_MORE_INFO }, | 147 { "showMoreInfo", IDS_SHOW_MORE_INFO }, |
| 148 { "hideMoreInfo", IDS_HIDE_MORE_INFO }, | 148 { "hideMoreInfo", IDS_HIDE_MORE_INFO }, |
| 149 { "channel", IDS_ABOUT_PAGE_CHANNEL }, | 149 { "channel", IDS_ABOUT_PAGE_CHANNEL }, |
| 150 { "stable", IDS_ABOUT_PAGE_CHANNEL_STABLE }, | 150 { "stable", IDS_ABOUT_PAGE_CHANNEL_STABLE }, |
| 151 { "beta", IDS_ABOUT_PAGE_CHANNEL_BETA }, | 151 { "beta", IDS_ABOUT_PAGE_CHANNEL_BETA }, |
| 152 { "dev", IDS_ABOUT_PAGE_CHANNEL_DEVELOPMENT }, | 152 { "dev", IDS_ABOUT_PAGE_CHANNEL_DEVELOPMENT }, |
| 153 { "channel-changed", IDS_ABOUT_PAGE_CHANNEL_CHANGED }, |
| 153 { "webkit", IDS_WEBKIT }, | 154 { "webkit", IDS_WEBKIT }, |
| 154 { "userAgent", IDS_ABOUT_VERSION_USER_AGENT }, | 155 { "userAgent", IDS_ABOUT_VERSION_USER_AGENT }, |
| 155 { "commandLine", IDS_ABOUT_VERSION_COMMAND_LINE }, | 156 { "commandLine", IDS_ABOUT_VERSION_COMMAND_LINE }, |
| 156 { "buildDate", IDS_ABOUT_VERSION_BUILD_DATE }, | 157 { "buildDate", IDS_ABOUT_VERSION_BUILD_DATE }, |
| 157 #endif | 158 #endif |
| 158 #if defined(OS_MACOSX) | 159 #if defined(OS_MACOSX) |
| 159 { "promote", IDS_ABOUT_CHROME_PROMOTE_UPDATER }, | 160 { "promote", IDS_ABOUT_CHROME_PROMOTE_UPDATER }, |
| 160 { "learnMore", IDS_LEARN_MORE }, | 161 { "learnMore", IDS_LEARN_MORE }, |
| 161 #endif | 162 #endif |
| 162 }; | 163 }; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 320 |
| 320 const std::string channel = UTF16ToUTF8(ExtractStringValue(args)); | 321 const std::string channel = UTF16ToUTF8(ExtractStringValue(args)); |
| 321 version_updater_->SetReleaseChannel(channel); | 322 version_updater_->SetReleaseChannel(channel); |
| 322 // On enterprise machines we can only use SetReleaseChannel to store the | 323 // On enterprise machines we can only use SetReleaseChannel to store the |
| 323 // user choice in the lsb-release file but we can not modify the policy blob. | 324 // user choice in the lsb-release file but we can not modify the policy blob. |
| 324 // Therefore we only call SetString if the device is locally owned and the | 325 // Therefore we only call SetString if the device is locally owned and the |
| 325 // currently logged in user is the owner. | 326 // currently logged in user is the owner. |
| 326 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { | 327 if (chromeos::UserManager::Get()->IsCurrentUserOwner()) { |
| 327 chromeos::CrosSettings::Get()->SetString(chromeos::kReleaseChannel, | 328 chromeos::CrosSettings::Get()->SetString(chromeos::kReleaseChannel, |
| 328 channel); | 329 channel); |
| 330 // Check for update after switching release channel. |
| 331 version_updater_->CheckForUpdate(base::Bind(&HelpHandler::SetUpdateStatus, |
| 332 base::Unretained(this))); |
| 329 } | 333 } |
| 330 } | 334 } |
| 331 | 335 |
| 332 #endif // defined(OS_CHROMEOS) | 336 #endif // defined(OS_CHROMEOS) |
| 333 | 337 |
| 334 void HelpHandler::SetUpdateStatus(VersionUpdater::Status status, | 338 void HelpHandler::SetUpdateStatus(VersionUpdater::Status status, |
| 335 int progress, const string16& message) { | 339 int progress, const string16& message) { |
| 336 // Only UPDATING state should have progress set. | 340 // Only UPDATING state should have progress set. |
| 337 DCHECK(status == VersionUpdater::UPDATING || progress == 0); | 341 DCHECK(status == VersionUpdater::UPDATING || progress == 0); |
| 338 | 342 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 | 437 |
| 434 // Note that this string will be internationalized. | 438 // Note that this string will be internationalized. |
| 435 string16 build_date = base::TimeFormatFriendlyDate(time); | 439 string16 build_date = base::TimeFormatFriendlyDate(time); |
| 436 g_build_date_string = Value::CreateStringValue(build_date); | 440 g_build_date_string = Value::CreateStringValue(build_date); |
| 437 } | 441 } |
| 438 | 442 |
| 439 web_ui()->CallJavascriptFunction("help.HelpPage.setBuildDate", | 443 web_ui()->CallJavascriptFunction("help.HelpPage.setBuildDate", |
| 440 *g_build_date_string); | 444 *g_build_date_string); |
| 441 } | 445 } |
| 442 #endif // defined(OS_CHROMEOS) | 446 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |