blob: dd7b77524bafdcc349139aa25d83d741de7334be (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// 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 COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_
#define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_
#include <map>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "components/gcm_driver/instance_id/instance_id.h"
namespace gcm {
class GCMDriver;
} // namespace gcm
namespace instance_id {
// InstanceID implementation for desktop and iOS.
class InstanceIDImpl : public InstanceID {
public:
InstanceIDImpl(const std::string& app_id, gcm::GCMDriver* gcm_driver);
~InstanceIDImpl() override;
// InstanceID:
std::string GetID() override;
base::Time GetCreationTime() override;
void GetToken(const std::string& authorized_entity,
const std::string& scope,
const std::map<std::string, std::string>& options,
const GetTokenCallback& callback) override;
void DeleteToken(const std::string& authorized_entity,
const std::string& scope,
const DeleteTokenCallback& callback) override;
void DeleteID(const DeleteIDCallback& callback) override;
private:
gcm::GCMDriver* gcm_driver_; // Not owned.
void EnsureIDGenerated();
// The generated Instance ID.
std::string id_;
// The time when the Instance ID has been generated.
base::Time creation_time_;
DISALLOW_COPY_AND_ASSIGN(InstanceIDImpl);
};
} // namespace instance_id
#endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_
|