summaryrefslogtreecommitdiff
path: root/chromium/components/copresence/handlers/gcm_handler.h
blob: 341a7d8ca69768b569993a80139b7b2ad9376e64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_COPRESENCE_HANDLERS_GCM_HANDLER_H_
#define COMPONENTS_COPRESENCE_HANDLERS_GCM_HANDLER_H_

#include <string>

#include "base/callback_forward.h"
#include "base/macros.h"

namespace gcm {
class GCMDriver;
}

namespace copresence {

// A class to handle GCM messages from the Copresence server. As far as the
// rest of the system is concerned, it simply provides the registered GCM ID.
// The implementation will call other classes to enact the message contents.
class GCMHandler {
 public:
  // Callback to report that registration has completed.
  // Returns an empty ID if registration failed.
  using RegistrationCallback = base::Callback<void(const std::string&)>;

  GCMHandler() {}
  virtual ~GCMHandler() {}

  // Request the GCM ID. It may be returned now or later, via the callback.
  virtual void GetGcmId(const RegistrationCallback& callback) = 0;

 private:
  DISALLOW_COPY_AND_ASSIGN(GCMHandler);
};

}  // namespace copresence

#endif  // COMPONENTS_COPRESENCE_HANDLERS_GCM_HANDLER_H_