PM: Policy for checking whether an update may use the current connection.
This is based on logic currently found in
ConnectionManager::IsUpdateAllowedOver() and
LibcurlHttpFetcher::IsUpdateAllowedOverCurrentConnection().
BUG=chromium:358323
TEST=Unit tests.
Change-Id: Ib1a73d3fbe603b8686294088e26bc2d04ee73877
Reviewed-on: https://chromium-review.googlesource.com/199540
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/policy_manager/policy.h b/policy_manager/policy.h
index 8ec3ace..22d651e 100644
--- a/policy_manager/policy.h
+++ b/policy_manager/policy.h
@@ -114,6 +114,17 @@
const bool interactive,
const UpdateState& update_state) const = 0;
+ // Checks whether updating is allowed over the current network connection
+ // Consults the shill provider as well as the device policy (if available).
+ // Returns |EvalStatus::kSucceeded|, setting |result| according to whether or
+ // not the current connection can be used; on failure, returns
+ // |EvalStatus::kFailed| and sets |error| accordingly.
+ virtual EvalStatus UpdateCurrentConnectionAllowed(
+ EvaluationContext* ec,
+ State* state,
+ std::string* error,
+ bool* result) const = 0;
+
protected:
Policy() {}