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

Unified Diff: components/copresence/public/copresence_state.h

Issue 806853003: Revert of Revert of Adding CopresenceState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « components/copresence/public/copresence_observer.h ('k') | components/copresence/rpc/rpc_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/copresence/public/copresence_state.h
diff --git a/components/copresence/public/copresence_state.h b/components/copresence/public/copresence_state.h
new file mode 100644
index 0000000000000000000000000000000000000000..f922007815185b09a16ab1f34120c1bff6121385
--- /dev/null
+++ b/components/copresence/public/copresence_state.h
@@ -0,0 +1,47 @@
+// Copyright 2014 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 COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_STATE_H_
+#define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_STATE_H_
+
+#include <map>
+#include <string>
+#include <vector>
+
+namespace copresence {
+
+class CopresenceObserver;
+class Directive;
+struct TransmittedToken;
+struct ReceivedToken;
+
+// This class tracks the state of the copresence component and can notify
+// interested parties when it changes. This is useful for debugging purposes.
+class CopresenceState {
+ public:
+ // Add a listener for future state changes. |observer| is owned by the caller,
+ // and must be valid until removed (or the CopresenceState is destroyed).
+ virtual void AddObserver(CopresenceObserver* observer) = 0;
+
+ // Remove a state change listener.
+ virtual void RemoveObserver(CopresenceObserver* observer) = 0;
+
+ // Accessor for the currently active directives.
+ virtual const std::vector<Directive>& active_directives() const = 0;
+
+ // Accessor for recently transmitted tokens.
+ virtual const std::map<std::string, TransmittedToken>&
+ transmitted_tokens() const = 0;
+
+ // Accessor for recently received tokens.
+ virtual const std::map<std::string, ReceivedToken>&
+ received_tokens() const = 0;
+
+ protected:
+ virtual ~CopresenceState() {}
+};
+
+} // namespace copresence
+
+#endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_STATE_H_
« no previous file with comments | « components/copresence/public/copresence_observer.h ('k') | components/copresence/rpc/rpc_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698