Commit e0309342 authored by Yann Dago's avatar Yann Dago Committed by Commit Bot

Policy WebUI: 'Reload Policies' button reloads google update policies

Bug: 1119703
Change-Id: Ib91b37dc1da4f06782caea7b67ecc6d0c8c87b2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2367673
Commit-Queue: Yann Dago <ydago@chromium.org>
Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802644}
parent 4b0ef92c
......@@ -895,15 +895,7 @@ void PolicyUIHandler::RegisterMessages() {
#endif // defined(OS_CHROMEOS)
#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
updater_status_provider_ = std::make_unique<UpdaterStatusProvider>();
base::PostTaskAndReplyWithResult(
base::ThreadPool::CreateCOMSTATaskRunner(
{base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN, base::MayBlock()})
.get(),
FROM_HERE, base::BindOnce(&GetGoogleUpdatePolicies),
base::BindOnce(&PolicyUIHandler::SetUpdaterPolicies,
weak_factory_.GetWeakPtr()));
ReloadUpdaterPolicies();
#endif // defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
if (!user_status_provider_.get())
......@@ -1185,6 +1177,11 @@ void PolicyUIHandler::HandleReloadPolicies(const base::ListValue* args) {
}
}
#endif
#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
ReloadUpdaterPolicies();
#endif // defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
GetPolicyService()->RefreshPolicies(base::BindOnce(
&PolicyUIHandler::OnRefreshPoliciesDone, weak_factory_.GetWeakPtr()));
}
......@@ -1295,6 +1292,20 @@ void PolicyUIHandler::SetUpdaterPolicies(
if (updater_policies_)
SendPolicies();
}
void PolicyUIHandler::ReloadUpdaterPolicies() const {
if (!updater_status_provider_)
updater_status_provider_ = std::make_unique<UpdaterStatusProvider>();
base::PostTaskAndReplyWithResult(
base::ThreadPool::CreateCOMSTATaskRunner(
{base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN, base::MayBlock()})
.get(),
FROM_HERE, base::BindOnce(&GetGoogleUpdatePolicies),
base::BindOnce(&PolicyUIHandler::SetUpdaterPolicies,
weak_factory_.GetWeakPtr()));
}
#endif // defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
void PolicyUIHandler::OnRefreshPoliciesDone() {
......
......@@ -100,6 +100,8 @@ class PolicyUIHandler : public content::WebUIMessageHandler,
// Sets |updater_policies_| in this instance and refreshes the UI via
// SendPolicies.
void SetUpdaterPolicies(std::unique_ptr<policy::PolicyMap> updater_policies);
void ReloadUpdaterPolicies() const;
#endif // defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Send the status of cloud policy to the UI. For each scope that has cloud
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment