OLD | NEW |
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_COPRESENCE_MANAGER_IMPL_H_ | 5 #ifndef COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_ |
6 #define COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_ | 6 #define COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "components/copresence/public/copresence_manager.h" | 13 #include "components/copresence/public/copresence_manager.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class Timer; | 16 class Timer; |
17 } | 17 } |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 class URLContextGetter; | 20 class URLContextGetter; |
21 } | 21 } |
22 | 22 |
23 namespace copresence { | 23 namespace copresence { |
24 | 24 |
25 class DirectiveHandler; | 25 class DirectiveHandler; |
26 class GCMHandler; | |
27 class ReportRequest; | 26 class ReportRequest; |
28 class RpcHandler; | 27 class RpcHandler; |
29 class WhispernetClient; | 28 class WhispernetClient; |
30 | 29 |
31 // The implementation for CopresenceManager. Responsible primarily for | 30 // The implementation for CopresenceManager. Responsible primarily for |
32 // client-side initialization. The RpcHandler handles all the details | 31 // client-side initialization. The RpcHandler handles all the details |
33 // of interacting with the server. | 32 // of interacting with the server. |
34 // TODO(rkc): Add tests for this class. | 33 // TODO(rkc): Add tests for this class. |
35 class CopresenceManagerImpl : public CopresenceManager { | 34 class CopresenceManagerImpl : public CopresenceManager { |
36 public: | 35 public: |
(...skipping 18 matching lines...) Expand all Loading... |
55 // kAudioCheckIntervalMs milliseconds. | 54 // kAudioCheckIntervalMs milliseconds. |
56 void AudioCheck(); | 55 void AudioCheck(); |
57 | 56 |
58 // Belongs to the caller. | 57 // Belongs to the caller. |
59 CopresenceDelegate* const delegate_; | 58 CopresenceDelegate* const delegate_; |
60 | 59 |
61 // We use a CancelableCallback here because Whispernet | 60 // We use a CancelableCallback here because Whispernet |
62 // does not provide a way to unregister its init callback. | 61 // does not provide a way to unregister its init callback. |
63 base::CancelableCallback<void(bool)> whispernet_init_callback_; | 62 base::CancelableCallback<void(bool)> whispernet_init_callback_; |
64 | 63 |
65 bool init_failed_; | 64 // The |directive handler_| needs to destruct before |rpc_handler_|, do not |
66 | 65 // change this order. |
67 // The GCMHandler must destruct before the DirectiveHandler, | |
68 // which must destruct before the RpcHandler. Do not change this order. | |
69 scoped_ptr<RpcHandler> rpc_handler_; | 66 scoped_ptr<RpcHandler> rpc_handler_; |
70 scoped_ptr<DirectiveHandler> directive_handler_; | 67 scoped_ptr<DirectiveHandler> directive_handler_; |
71 scoped_ptr<GCMHandler> gcm_handler_; | |
72 | 68 |
73 scoped_ptr<base::Timer> poll_timer_; | 69 scoped_ptr<base::Timer> poll_timer_; |
74 scoped_ptr<base::Timer> audio_check_timer_; | 70 scoped_ptr<base::Timer> audio_check_timer_; |
75 | 71 |
| 72 bool init_failed_; |
| 73 |
76 DISALLOW_COPY_AND_ASSIGN(CopresenceManagerImpl); | 74 DISALLOW_COPY_AND_ASSIGN(CopresenceManagerImpl); |
77 }; | 75 }; |
78 | 76 |
79 } // namespace copresence | 77 } // namespace copresence |
80 | 78 |
81 #endif // COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_ | 79 #endif // COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_ |
OLD | NEW |