clang/win: Build without -Wno-tautological-compare.
[chromium-blink-merge.git] / components / copresence / public / copresence_state.h
blobf922007815185b09a16ab1f34120c1bff6121385
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_STATE_H_
6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_STATE_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 namespace copresence {
14 class CopresenceObserver;
15 class Directive;
16 struct TransmittedToken;
17 struct ReceivedToken;
19 // This class tracks the state of the copresence component and can notify
20 // interested parties when it changes. This is useful for debugging purposes.
21 class CopresenceState {
22 public:
23 // Add a listener for future state changes. |observer| is owned by the caller,
24 // and must be valid until removed (or the CopresenceState is destroyed).
25 virtual void AddObserver(CopresenceObserver* observer) = 0;
27 // Remove a state change listener.
28 virtual void RemoveObserver(CopresenceObserver* observer) = 0;
30 // Accessor for the currently active directives.
31 virtual const std::vector<Directive>& active_directives() const = 0;
33 // Accessor for recently transmitted tokens.
34 virtual const std::map<std::string, TransmittedToken>&
35 transmitted_tokens() const = 0;
37 // Accessor for recently received tokens.
38 virtual const std::map<std::string, ReceivedToken>&
39 received_tokens() const = 0;
41 protected:
42 virtual ~CopresenceState() {}
45 } // namespace copresence
47 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_STATE_H_