diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/chrome/browser/ui/webui/help | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/chrome/browser/ui/webui/help')
8 files changed, 36 insertions, 26 deletions
diff --git a/chromium/chrome/browser/ui/webui/help/test_version_updater.cc b/chromium/chrome/browser/ui/webui/help/test_version_updater.cc index d10cc076fae..b159078b28a 100644 --- a/chromium/chrome/browser/ui/webui/help/test_version_updater.cc +++ b/chromium/chrome/browser/ui/webui/help/test_version_updater.cc @@ -10,5 +10,6 @@ TestVersionUpdater::~TestVersionUpdater() = default; void TestVersionUpdater::CheckForUpdate(const StatusCallback& callback, const PromoteCallback&) { - callback.Run(status_, progress_, rollback_, version_, update_size_, message_); + callback.Run(status_, progress_, rollback_, powerwash_, version_, + update_size_, message_); } diff --git a/chromium/chrome/browser/ui/webui/help/test_version_updater.h b/chromium/chrome/browser/ui/webui/help/test_version_updater.h index 2db702d317a..e07e61a3ae2 100644 --- a/chromium/chrome/browser/ui/webui/help/test_version_updater.h +++ b/chromium/chrome/browser/ui/webui/help/test_version_updater.h @@ -42,6 +42,7 @@ class TestVersionUpdater : public VersionUpdater { Status status_ = Status::UPDATED; int progress_ = 0; bool rollback_ = false; + bool powerwash_ = false; std::string version_; int64_t update_size_ = 0; base::string16 message_; diff --git a/chromium/chrome/browser/ui/webui/help/version_updater.h b/chromium/chrome/browser/ui/webui/help/version_updater.h index de48fe833ee..34f7adaa37d 100644 --- a/chromium/chrome/browser/ui/webui/help/version_updater.h +++ b/chromium/chrome/browser/ui/webui/help/version_updater.h @@ -58,6 +58,7 @@ class VersionUpdater { // |progress| should only be non-zero for the UPDATING state. // |rollback| indicates whether the update is actually a rollback, which // requires wiping the device upon reboot. + // |powerwash| indicates whether the device will be wiped on reboot. // |version| is the version of the available update and should be empty string // when update is not available. // |update_size| is the size of the available update in bytes and should be 0 @@ -66,6 +67,7 @@ class VersionUpdater { typedef base::Callback<void(Status status, int progress, bool rollback, + bool powerwash, const std::string& version, int64_t update_size, const base::string16& message)> diff --git a/chromium/chrome/browser/ui/webui/help/version_updater_basic.cc b/chromium/chrome/browser/ui/webui/help/version_updater_basic.cc index 93e3f41a76d..2a4c334e2ea 100644 --- a/chromium/chrome/browser/ui/webui/help/version_updater_basic.cc +++ b/chromium/chrome/browser/ui/webui/help/version_updater_basic.cc @@ -13,7 +13,8 @@ void VersionUpdaterBasic::CheckForUpdate( const Status status = UpgradeDetector::GetInstance()->notify_upgrade() ? NEARLY_UPDATED : DISABLED; - status_callback.Run(status, 0, false, std::string(), 0, base::string16()); + status_callback.Run(status, 0, false, false, std::string(), 0, + base::string16()); } VersionUpdater* VersionUpdater::Create(content::WebContents* web_contents) { diff --git a/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc b/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc index 23166d7d304..0a0225fee0c 100644 --- a/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc +++ b/chromium/chrome/browser/ui/webui/help/version_updater_chromeos.cc @@ -51,12 +51,12 @@ enum NetworkStatus { const bool kDefaultAutoUpdateDisabled = false; NetworkStatus GetNetworkStatus(bool interactive, - const chromeos::NetworkState* network) { + const chromeos::NetworkState* network, + bool metered) { if (!network || !network->IsConnectedState()) // Offline state. return NETWORK_STATUS_OFFLINE; - // Treats tethered networks as cellular networks. - if (network->IsUsingMobileData() && + if (metered && !help_utils_chromeos::IsUpdateOverCellularAllowed(interactive)) { return NETWORK_STATUS_DISALLOWED; } @@ -76,10 +76,11 @@ bool IsAutoUpdateDisabled() { return update_disabled; } -base::string16 GetConnectionTypeAsUTF16(const chromeos::NetworkState* network) { +base::string16 GetConnectionTypeAsUTF16(const chromeos::NetworkState* network, + bool metered) { const std::string type = network->type(); if (chromeos::NetworkTypePattern::WiFi().MatchesType(type)) { - if (network->IsUsingMobileData()) + if (metered) return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_METERED_WIFI); return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_WIFI); } @@ -99,7 +100,8 @@ base::string16 GetConnectionTypeAsUTF16(const chromeos::NetworkState* network) { bool EnsureCanUpdate(bool interactive, const VersionUpdater::StatusCallback& callback) { if (IsAutoUpdateDisabled()) { - callback.Run(VersionUpdater::DISABLED_BY_ADMIN, 0, false, std::string(), 0, + callback.Run(VersionUpdater::DISABLED_BY_ADMIN, 0, false, false, + std::string(), 0, l10n_util::GetStringUTF16(IDS_UPGRADE_DISABLED_BY_POLICY)); return false; } @@ -108,19 +110,19 @@ bool EnsureCanUpdate(bool interactive, chromeos::NetworkHandler::Get()->network_state_handler(); const chromeos::NetworkState* network = network_state_handler->DefaultNetwork(); - + const bool metered = network_state_handler->default_network_is_metered(); // Don't allow an update if we're currently offline or connected // to a network for which updates are disallowed. - NetworkStatus status = GetNetworkStatus(interactive, network); + NetworkStatus status = GetNetworkStatus(interactive, network, metered); if (status == NETWORK_STATUS_OFFLINE) { - callback.Run(VersionUpdater::FAILED_OFFLINE, 0, false, std::string(), 0, - l10n_util::GetStringUTF16(IDS_UPGRADE_OFFLINE)); + callback.Run(VersionUpdater::FAILED_OFFLINE, 0, false, false, std::string(), + 0, l10n_util::GetStringUTF16(IDS_UPGRADE_OFFLINE)); return false; } else if (status == NETWORK_STATUS_DISALLOWED) { base::string16 message = l10n_util::GetStringFUTF16( - IDS_UPGRADE_DISALLOWED, GetConnectionTypeAsUTF16(network)); + IDS_UPGRADE_DISALLOWED, GetConnectionTypeAsUTF16(network, metered)); callback.Run(VersionUpdater::FAILED_CONNECTION_TYPE_DISALLOWED, 0, false, - std::string(), 0, message); + false, std::string(), 0, message); return false; } @@ -214,7 +216,7 @@ void VersionUpdaterCros::OnSetUpdateOverCellularOneTimePermission( // TODO(https://crbug.com/927452): invoke callback to signal about page to // show appropriate error message. LOG(ERROR) << "Error setting update over cellular one time permission."; - callback_.Run(VersionUpdater::FAILED, 0, false, std::string(), 0, + callback_.Run(VersionUpdater::FAILED, 0, false, false, std::string(), 0, base::string16()); } } @@ -318,8 +320,8 @@ void VersionUpdaterCros::UpdateStatusChanged( NOTREACHED(); } - callback_.Run(my_status, progress, status.is_enterprise_rollback(), version, - size, message); + callback_.Run(my_status, progress, status.is_enterprise_rollback(), + status.will_powerwash_after_reboot(), version, size, message); last_operation_ = status.current_operation(); if (check_for_update_when_idle_ && @@ -333,5 +335,5 @@ void VersionUpdaterCros::OnUpdateCheck( // If version updating is not implemented, this binary is the most up-to-date // possible with respect to automatic updating. if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED) - callback_.Run(UPDATED, 0, false, std::string(), 0, base::string16()); + callback_.Run(UPDATED, 0, false, false, std::string(), 0, base::string16()); } diff --git a/chromium/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc b/chromium/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc index 5115ce9c60a..999a1a67722 100644 --- a/chromium/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc +++ b/chromium/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc @@ -33,6 +33,7 @@ namespace { void CheckNotification(VersionUpdater::Status /* status */, int /* progress */, bool /* rollback */, + bool /* powerwash */, const std::string& /* version */, int64_t /* size */, const base::string16& /* message */) {} diff --git a/chromium/chrome/browser/ui/webui/help/version_updater_mac.mm b/chromium/chrome/browser/ui/webui/help/version_updater_mac.mm index 4550497b5ab..6680e23b73e 100644 --- a/chromium/chrome/browser/ui/webui/help/version_updater_mac.mm +++ b/chromium/chrome/browser/ui/webui/help/version_updater_mac.mm @@ -108,7 +108,7 @@ void VersionUpdaterMac::CheckForUpdate( } else { // There is no glue, or the application is on a read-only filesystem. // Updates and promotions are impossible. - status_callback_.Run(DISABLED, 0, false, std::string(), 0, + status_callback_.Run(DISABLED, 0, false, false, std::string(), 0, base::string16()); } } @@ -231,7 +231,7 @@ void VersionUpdaterMac::UpdateStatus(NSDictionary* dictionary) { } if (!status_callback_.is_null()) - status_callback_.Run(status, 0, false, std::string(), 0, message); + status_callback_.Run(status, 0, false, false, std::string(), 0, message); PromotionState promotion_state; if (!promote_callback_.is_null()) { diff --git a/chromium/chrome/browser/ui/webui/help/version_updater_win.cc b/chromium/chrome/browser/ui/webui/help/version_updater_win.cc index f77d46664fd..be910614a29 100644 --- a/chromium/chrome/browser/ui/webui/help/version_updater_win.cc +++ b/chromium/chrome/browser/ui/webui/help/version_updater_win.cc @@ -31,7 +31,7 @@ void VersionUpdaterWin::CheckForUpdate(const StatusCallback& callback, // There is no supported integration with Google Update for Chromium. callback_ = callback; - callback_.Run(CHECKING, 0, false, std::string(), 0, base::string16()); + callback_.Run(CHECKING, 0, false, false, std::string(), 0, base::string16()); DoBeginUpdateCheck(false /* !install_update_if_possible */); } @@ -52,18 +52,20 @@ void VersionUpdaterWin::OnUpdateCheckComplete( // Notify the caller that the update is now beginning and initiate it. DoBeginUpdateCheck(true /* install_update_if_possible */); - callback_.Run(UPDATING, 0, false, std::string(), 0, base::string16()); + callback_.Run(UPDATING, 0, false, false, std::string(), 0, base::string16()); } void VersionUpdaterWin::OnUpgradeProgress(int progress, const base::string16& new_version) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - callback_.Run(UPDATING, progress, false, std::string(), 0, base::string16()); + callback_.Run(UPDATING, progress, false, false, std::string(), 0, + base::string16()); } void VersionUpdaterWin::OnUpgradeComplete(const base::string16& new_version) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - callback_.Run(NEARLY_UPDATED, 0, false, std::string(), 0, base::string16()); + callback_.Run(NEARLY_UPDATED, 0, false, false, std::string(), 0, + base::string16()); } void VersionUpdaterWin::OnError(GoogleUpdateErrorCode error_code, @@ -94,7 +96,7 @@ void VersionUpdaterWin::OnError(GoogleUpdateErrorCode error_code, } break; } - callback_.Run(status, 0, false, std::string(), 0, message); + callback_.Run(status, 0, false, false, std::string(), 0, message); } void VersionUpdaterWin::DoBeginUpdateCheck(bool install_update_if_possible) { @@ -107,7 +109,7 @@ void VersionUpdaterWin::DoBeginUpdateCheck(bool install_update_if_possible) { void VersionUpdaterWin::OnPendingRestartCheck(bool is_update_pending_restart) { callback_.Run(is_update_pending_restart ? NEARLY_UPDATED : UPDATED, 0, false, - std::string(), 0, base::string16()); + false, std::string(), 0, base::string16()); } VersionUpdater* VersionUpdater::Create(content::WebContents* web_contents) { |