summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrt <grt@chromium.org>2015-08-21 19:15:01 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-22 02:16:04 +0000
commit9196d6c99610b85d2007402a2bb46931b7788e67 (patch)
treeae5c84cbe09a025a25cc0a042ee34c56606500e5
parente0e48bdf20670dd0532afc4ed636a5b05ded9b65 (diff)
downloadchromium_src-9196d6c99610b85d2007402a2bb46931b7788e67.zip
chromium_src-9196d6c99610b85d2007402a2bb46931b7788e67.tar.gz
chromium_src-9196d6c99610b85d2007402a2bb46931b7788e67.tar.bz2
Show a meaningful error message when updates are disabled by policy.
BUG=514827 TEST=Install system-level Chrome with Google Update on a domain-joined machine, disable manual updates, then navigate to chrome://help. Chrome should display a message indicating that manual updates are disabled without showing a UAC prompt. Now disable all updates and try again. Chrome should display a message indicating that updates are disabled. R=ganesh@chromium.org, pkasting@chromium.org Review URL: https://codereview.chromium.org/1302403004 Cr-Commit-Position: refs/heads/master@{#344954}
-rw-r--r--chrome/app/generated_resources.grd8
-rw-r--r--chrome/browser/google/google_update_win.cc11
-rw-r--r--chrome/browser/google/google_update_win.h3
-rw-r--r--chrome/browser/google/google_update_win_unittest.cc18
4 files changed, 37 insertions, 3 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 8ff4640..6a768df 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -8318,6 +8318,14 @@ I don't think this site should be blocked!
Update failed (error: <ph name="ERROR_NUMBER">$1<ex>1</ex></ph>)
</message>
</if>
+ <if expr="is_win">
+ <message name="IDS_UPGRADE_DISABLED_BY_POLICY" desc="Status label: Upgrades disabled by policy">
+ Updates are disabled by the administrator (error: <ph name="ERROR_NUMBER">$1<ex>1</ex></ph>)
+ </message>
+ <message name="IDS_UPGRADE_DISABLED_BY_POLICY_MANUAL" desc="Status label: Manual upgrades are disabled by policy">
+ Manual updates are disabled by the administrator (error: <ph name="ERROR_NUMBER">$1<ex>1</ex></ph>)
+ </message>
+ </if>
<if expr="chromeos">
<message name="IDS_UPGRADE_DISABLED_BY_POLICY" desc="Status label: Upgrades disabled by policy">
Updates are disabled by the administrator
diff --git a/chrome/browser/google/google_update_win.cc b/chrome/browser/google/google_update_win.cc
index 22bd062..1490ae4 100644
--- a/chrome/browser/google/google_update_win.cc
+++ b/chrome/browser/google/google_update_win.cc
@@ -60,6 +60,7 @@ const int64_t kGoogleUpdatePollIntervalMs = 250;
// Constants from Google Update.
const HRESULT GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY = 0x80040813;
+const HRESULT GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL = 0x8004081f;
const HRESULT GOOPDATEINSTALL_E_INSTALLER_FAILED = 0x80040902;
// Check if the currently running instance can be updated by Google Update.
@@ -527,6 +528,8 @@ bool UpdateCheckDriver::IsErrorState(
LONG code = 0;
if (*hresult == GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY) {
*error_code = GOOGLE_UPDATE_DISABLED_BY_POLICY;
+ } else if (*hresult == GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL) {
+ *error_code = GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY;
} else if (*hresult == GOOPDATEINSTALL_E_INSTALLER_FAILED &&
SUCCEEDED(current_state->get_installerResultCode(&code))) {
*installer_exit_code = code;
@@ -728,7 +731,13 @@ void UpdateCheckDriver::OnUpgradeError(GoogleUpdateErrorCode error_code,
html_error_msg += base::StringPrintf(L": %d", installer_exit_code_);
if (system_level_install_)
html_error_msg += L" -- system level";
- if (error_string.empty()) {
+ if (error_code == GOOGLE_UPDATE_DISABLED_BY_POLICY) {
+ html_error_message_ = l10n_util::GetStringFUTF16(
+ IDS_UPGRADE_DISABLED_BY_POLICY, html_error_msg);
+ } else if (error_code == GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY) {
+ html_error_message_ = l10n_util::GetStringFUTF16(
+ IDS_UPGRADE_DISABLED_BY_POLICY_MANUAL, html_error_msg);
+ } else if (error_string.empty()) {
html_error_message_ = l10n_util::GetStringFUTF16(
IDS_ABOUT_BOX_ERROR_UPDATE_CHECK_FAILED, html_error_msg);
} else {
diff --git a/chrome/browser/google/google_update_win.h b/chrome/browser/google/google_update_win.h
index 149385a..df9c84a 100644
--- a/chrome/browser/google/google_update_win.h
+++ b/chrome/browser/google/google_update_win.h
@@ -45,8 +45,7 @@ enum GoogleUpdateErrorCode {
GOOGLE_UPDATE_DISABLED_BY_POLICY = 8,
// Updates can not be downloaded because the administrator has disabled
// manual (on-demand) updates. Automatic background updates are allowed.
- // DEPRECATED.
- // GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY = 9,
+ GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY = 9,
NUM_ERROR_CODES
};
diff --git a/chrome/browser/google/google_update_win_unittest.cc b/chrome/browser/google/google_update_win_unittest.cc
index 3b63c21d..297333f 100644
--- a/chrome/browser/google/google_update_win_unittest.cc
+++ b/chrome/browser/google/google_update_win_unittest.cc
@@ -723,6 +723,24 @@ TEST_P(GoogleUpdateWinTest, UpdatesDisabledByPolicy) {
task_runner_->RunUntilIdle();
}
+// Test the case where the GoogleUpdate class reports that manual updates are
+// disabled by Group Policy, but that automatic updates are enabled.
+TEST_P(GoogleUpdateWinTest, ManualUpdatesDisabledByPolicy) {
+ static const HRESULT GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL =
+ 0x8004081f;
+ PrepareSimulatorForUpdateCheck(kChromeBinariesGuid);
+ PushState(STATE_INIT);
+ PushState(STATE_CHECKING_FOR_UPDATE);
+ PushErrorState(GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL,
+ L"manual updates disabled by policy", -1);
+
+ EXPECT_CALL(mock_update_check_delegate_,
+ OnError(GOOGLE_UPDATE_DISABLED_BY_POLICY_AUTO_ONLY, _, _));
+ BeginUpdateCheck(task_runner_, std::string(), false, 0,
+ mock_update_check_delegate_.AsWeakPtr());
+ task_runner_->RunUntilIdle();
+}
+
// Test an update check where no update is available.
TEST_P(GoogleUpdateWinTest, UpdateCheckNoUpdate) {
PrepareSimulatorForUpdateCheck(kChromeBinariesGuid);