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