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_
12 namespace copresence
{
14 class CopresenceObserver
;
16 struct TransmittedToken
;
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
{
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;
42 virtual ~CopresenceState() {}
45 } // namespace copresence
47 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_STATE_H_