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_HANDLERS_GCM_HANDLER_H_ | 5 #ifndef COMPONENTS_COPRESENCE_HANDLERS_GCM_HANDLER_H_ |
6 #define COMPONENTS_COPRESENCE_HANDLERS_GCM_HANDLER_H_ | 6 #define COMPONENTS_COPRESENCE_HANDLERS_GCM_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/macros.h" |
11 | 12 |
12 namespace gcm { | 13 namespace gcm { |
13 class GCMDriver; | 14 class GCMDriver; |
14 } | 15 } |
15 | 16 |
16 namespace copresence { | 17 namespace copresence { |
17 | 18 |
18 // A class to handle GCM messages from the Copresence server. As far as the | 19 // A class to handle GCM messages from the Copresence server. As far as the |
19 // rest of the system is concerned, it simply provides the registered GCM ID. | 20 // rest of the system is concerned, it simply provides the registered GCM ID. |
20 // The implementation will call other classes to enact the message contents. | 21 // The implementation will call other classes to enact the message contents. |
21 class GCMHandler { | 22 class GCMHandler { |
22 public: | 23 public: |
23 // Callback to report that registration has completed. | 24 // Callback to report that registration has completed. |
24 // Returns an empty ID if registration failed. | 25 // Returns an empty ID if registration failed. |
25 using RegistrationCallback = base::Callback<void(const std::string&)>; | 26 using RegistrationCallback = base::Callback<void(const std::string&)>; |
26 | 27 |
27 GCMHandler() {} | 28 GCMHandler() {} |
28 virtual ~GCMHandler() {} | 29 virtual ~GCMHandler() {} |
29 | 30 |
30 // Request the GCM ID. It may be returned now or later, via the callback. | 31 // Request the GCM ID. It may be returned now or later, via the callback. |
31 virtual void GetGcmId(const RegistrationCallback& callback) = 0; | 32 virtual void GetGcmId(const RegistrationCallback& callback) = 0; |
32 | 33 |
33 private: | 34 private: |
34 DISALLOW_COPY_AND_ASSIGN(GCMHandler); | 35 DISALLOW_COPY_AND_ASSIGN(GCMHandler); |
35 }; | 36 }; |
36 | 37 |
37 } // namespace copresence | 38 } // namespace copresence |
38 | 39 |
39 #endif // COMPONENTS_COPRESENCE_HANDLERS_GCM_HANDLER_H_ | 40 #endif // COMPONENTS_COPRESENCE_HANDLERS_GCM_HANDLER_H_ |
OLD | NEW |