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

Side by Side Diff: components/copresence/public/copresence_state.h

Issue 764673003: Adding CopresenceState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing overzealous DCHECK 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 unified diff | Download patch
OLDNEW
(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 CopresenceState() {}
24 virtual ~CopresenceState() {}
25
26 // Add a listener for future state changes. |observer| is owned by the caller,
27 // and must be valid until removed (or the CopresenceState is destroyed).
28 virtual void AddObserver(CopresenceObserver* observer) = 0;
29
30 // Remove a state change listener.
31 virtual void RemoveObserver(CopresenceObserver* observer) = 0;
32
33 // Accessor for the currently active directives.
34 virtual const std::vector<Directive>& active_directives() = 0;
xiyuan 2014/12/18 18:10:52 nit: Can this and the two accessors below be const
Charlie 2014/12/19 03:53:33 Done.
35
36 // Accessor for recently transmitted tokens.
37 virtual const std::map<std::string, TransmittedToken>&
38 transmitted_tokens() = 0;
39
40 // Accessor for recently received tokens.
41 virtual const std::map<std::string, ReceivedToken>& received_tokens() = 0;
42
43 private:
44 DISALLOW_COPY_AND_ASSIGN(CopresenceState);
45 };
46
47 } // namespace copresence
48
49 #endif // COMPONENTS_COPRESENCE_PUBLIC_COPRESENCE_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698