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

Side by Side Diff: components/copresence/handlers/directive_handler_impl.h

Issue 764673003: Adding CopresenceState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 months 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_IMPL_H_ 5 #ifndef COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_IMPL_H_
6 #define COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_IMPL_H_ 6 #define COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_IMPL_H_
7 7
8 #include "components/copresence/handlers/directive_handler.h" 8 #include "components/copresence/handlers/directive_handler.h"
9 9
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "components/copresence/handlers/audio/audio_directive_handler_impl.h" 15 #include "components/copresence/handlers/audio/audio_directive_handler_impl.h"
16 #include "components/copresence/public/copresence_constants.h"
16 17
17 namespace copresence { 18 namespace copresence {
18 19
19 // The directive handler manages transmit and receive directives. 20 // The directive handler manages transmit and receive directives.
20 class DirectiveHandlerImpl final : public DirectiveHandler { 21 class DirectiveHandlerImpl final : public DirectiveHandler {
21 public: 22 public:
22 explicit DirectiveHandlerImpl(scoped_ptr<AudioDirectiveHandler> 23 explicit DirectiveHandlerImpl(
23 audio_handler = make_scoped_ptr(new AudioDirectiveHandlerImpl)); 24 const DirectivesCallback& update_directives_callback);
25 DirectiveHandlerImpl(
26 const DirectivesCallback& update_directives_callback,
27 scoped_ptr<AudioDirectiveHandler> audio_handler);
24 ~DirectiveHandlerImpl() override; 28 ~DirectiveHandlerImpl() override;
25 29
26 // DirectiveHandler overrides 30 // DirectiveHandler overrides.
27 void Start(WhispernetClient* whispernet_client, 31 void Start(WhispernetClient* whispernet_client,
28 const TokensCallback& tokens_cb) override; 32 const TokensCallback& tokens_cb) override;
29 void AddDirective(const Directive& directive) override; 33 void AddDirective(const Directive& directive) override;
30 void RemoveDirectives(const std::string& op_id) override; 34 void RemoveDirectives(const std::string& op_id) override;
31 const std::string GetCurrentAudioToken(AudioType type) const override; 35 const std::string GetCurrentAudioToken(AudioType type) const override;
32 bool IsAudioTokenHeard(AudioType type) const override; 36 bool IsAudioTokenHeard(AudioType type) const override;
33 37
34 private: 38 private:
35 // Starts actually running a directive. 39 // Starts actually running a directive.
36 void StartDirective(const std::string& op_id, const Directive& directive); 40 void StartDirective(const std::string& op_id, const Directive& directive);
37 41
38 scoped_ptr<AudioDirectiveHandler> audio_handler_; 42 scoped_ptr<AudioDirectiveHandler> audio_handler_;
39 std::map<std::string, std::vector<Directive>> pending_directives_; 43 std::map<std::string, std::vector<Directive>> pending_directives_;
40 44
41 bool is_started_; 45 bool is_started_;
42 46
43 DISALLOW_COPY_AND_ASSIGN(DirectiveHandlerImpl); 47 DISALLOW_COPY_AND_ASSIGN(DirectiveHandlerImpl);
44 }; 48 };
45 49
46 } // namespace copresence 50 } // namespace copresence
47 51
48 #endif // COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_IMPL_H_ 52 #endif // COMPONENTS_COPRESENCE_HANDLERS_DIRECTIVE_HANDLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698