OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_STATE_H_ | |
6 #define COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_STATE_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 namespace copresence { | |
13 | |
14 class CopresenceObserver; | |
15 class Directive; | |
16 struct TransmittedToken; | |
17 struct ReceivedToken; | |
18 | |
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; | |
26 | |
27 // Remove a state change listener. | |
28 virtual void RemoveObserver(CopresenceObserver* observer) = 0; | |
29 | |
30 // Accessor for the currently active directives. | |
31 virtual const std::vector<Directive>& active_directives() const = 0; | |
32 | |
33 // Accessor for recently transmitted tokens. | |
34 virtual const std::map<std::string, TransmittedToken>& | |
35 transmitted_tokens() const = 0; | |
36 | |
37 // Accessor for recently received tokens. | |
38 virtual const std::map<std::string, ReceivedToken>& | |
39 received_tokens() const = 0; | |
40 | |
41 protected: | |
42 virtual ~CopresenceState() {} | |
43 }; | |
44 | |
45 } // namespace copresence | |
46 | |
47 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_STATE_H_ | |
OLD | NEW |