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