Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Unified Diff: chromeos/network/managed_state.h

Issue 11192024: Add chromeos::NetworkStateManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to feedback Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/network/managed_state.h
diff --git a/chromeos/network/managed_state.h b/chromeos/network/managed_state.h
new file mode 100644
index 0000000000000000000000000000000000000000..d93ebd24518bb7ba7d7ea54d7b1078f3779667a8
--- /dev/null
+++ b/chromeos/network/managed_state.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2012 The Chromium 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_NETWORK_MANAGED_STATE_H_
+#define CHROMEOS_NETWORK_MANAGED_STATE_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "chromeos/chromeos_export.h"
+#include "third_party/cros_system_api/dbus/service_constants.h"
pneubeck (no reviews) 2012/10/25 14:42:17 unused?
stevenjb 2012/10/25 22:05:22 PropertyChanged keys are defined here. I separated
+
+namespace base {
+class Value;
+}
+
+namespace chromeos {
+
+// Base class for states managed by NetworkStateManger which are associated
+// with a path.
+class ManagedState {
+ public:
+ enum ManagedType {
+ MANAGED_TYPE_NETWORK,
+ MANAGED_TYPE_DEVICE
+ };
+
+ ManagedState(ManagedType type, const std::string& path)
+ : managed_type_(type),
+ path_(path) {
+ }
pneubeck (no reviews) 2012/10/25 14:42:17 virtual destructor
stevenjb 2012/10/25 22:05:22 Done.
+
+ // This will construct and return a new instance of the approprate class
+ // based on |type|.
+ static ManagedState* Create(ManagedType type, const std::string& path);
+
+ // Called by NetworkStateHandler when a property changes.
+ virtual bool PropertyChanged(const std::string& key,
+ const base::Value& value) = 0;
+
+ const ManagedType managed_type() const { return managed_type_; }
+ const std::string& path() const { return path_; }
+
+ private:
+ ManagedType managed_type_;
+ std::string path_;
pneubeck (no reviews) 2012/10/25 14:42:17 disallow copy/assign
stevenjb 2012/10/25 22:05:22 Done.
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_NETWORK_MANAGED_STATE_H_

Powered by Google App Engine
This is Rietveld 408576698