PM: Add a shill provider skeleton.
This introduces an initial implementation of a shill provider. None of
the backend works, of course; for now, this includes the following:
* Three variables used for obtaining the connectivity status, current
connection type and the last time the connection has changed. This
should suffice for computing current policy-related decisions, such as
whether/when to update depending on the connection type. However, as
I'm not entirely sure how to track the last-changed time, it might
change as the implementation ramps up. The variables are currently
initialized to a deterministic default.
* Unit tests for the existing (very minimal) functionality.
BUG=None
TEST=Builds and passes unit tests.
Change-Id: Ib4fcefb6bcbed43cd3ba7615de5eaad996fb7fb3
Reviewed-on: https://chromium-review.googlesource.com/184491
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/policy_manager/real_shill_provider.h b/policy_manager/real_shill_provider.h
new file mode 100644
index 0000000..1a120b7
--- /dev/null
+++ b/policy_manager/real_shill_provider.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_SHILL_PROVIDER_H
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_SHILL_PROVIDER_H
+
+#include "update_engine/policy_manager/shill_provider.h"
+
+using base::Time;
+
+namespace chromeos_policy_manager {
+
+// ShillProvider concrete implementation.
+//
+// TODO(garnold) Much of the functionality in this module was adapted from
+// connection_manager, with slight changes (annotated inline). We need to make
+// sure to deprecate use of connection manager when the time comes.
+class RealShillProvider : public ShillProvider {
+ public:
+ // TODO(garnold) This should take a DBus object for communicating with shill.
+ RealShillProvider()
+ : is_connected_(false), conn_type_(kShillConnTypeUnknown),
+ conn_last_changed_(Time::Now()) {}
+
+ protected:
+ virtual bool DoInit();
+
+ private:
+ // Whether we have network connectivity.
+ bool is_connected_;
+
+ // The current network connection type as reported by shill.
+ ShillConnType conn_type_;
+
+ // The time when the connection type last changed.
+ Time conn_last_changed_;
+
+ DISALLOW_COPY_AND_ASSIGN(RealShillProvider);
+};
+
+} // namespace chromeos_policy_manager
+
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_REAL_SHILL_PROVIDER_H