summaryrefslogtreecommitdiffstats
path: root/google_apis/gcm/engine/gcm_unregistration_request_handler.h
blob: b5a3b944d3260de55408b451c7890baba8f2f158 (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
// Copyright 2015 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 GOOGLE_APIS_GCM_ENGINE_GCM_UNREGISTRATION_REQUEST_HANDLER_H_
#define GOOGLE_APIS_GCM_ENGINE_GCM_UNREGISTRATION_REQUEST_HANDLER_H_

#include "base/macros.h"
#include "google_apis/gcm/engine/unregistration_request.h"

namespace gcm {

// Used to revoke the registration ID when unregister is called or the
// application has been uninstalled.
class GCM_EXPORT GCMUnregistrationRequestHandler :
    public UnregistrationRequest::CustomRequestHandler {
 public:
  GCMUnregistrationRequestHandler(const std::string& app_id);
  ~GCMUnregistrationRequestHandler() override;

  // UnregistrationRequest::CustomRequestHandler overrides:
  void BuildRequestBody(std::string* body) override;
  UnregistrationRequest::Status ParseResponse(
      const net::URLFetcher* source) override;
  void ReportUMAs(UnregistrationRequest::Status status,
                  int retry_count,
                  base::TimeDelta complete_time) override;

 private:
  std::string app_id_;

  DISALLOW_COPY_AND_ASSIGN(GCMUnregistrationRequestHandler);
};

}  // namespace gcm

#endif  // GOOGLE_APIS_GCM_ENGINE_GCM_UNREGISTRATION_REQUEST_HANDLER_H_