Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: components/gcm_driver/instance_id/instance_id_impl.h

Issue 1113213002: Generate Instance ID locally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address more feedback Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_ 5 #ifndef COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_
6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_ 6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "components/gcm_driver/instance_id/instance_id.h" 15 #include "components/gcm_driver/instance_id/instance_id.h"
15 16
16 namespace instance_id { 17 namespace instance_id {
17 18
18 // InstanceID implementation for desktop and iOS. 19 // InstanceID implementation for desktop and iOS.
19 class InstanceIDImpl : public InstanceID { 20 class InstanceIDImpl : public InstanceID {
20 public: 21 public:
21 explicit InstanceIDImpl(const std::string& app_id); 22 explicit InstanceIDImpl(const std::string& app_id);
22 ~InstanceIDImpl() override; 23 ~InstanceIDImpl() override;
23 24
24 // InstanceID: 25 // InstanceID:
25 std::string GetID() override; 26 std::string GetID() override;
26 base::Time GetCreationTime() override; 27 base::Time GetCreationTime() override;
27 void GetToken(const std::string& audience, 28 void GetToken(const std::string& audience,
28 const std::string& scope, 29 const std::string& scope,
29 const std::map<std::string, std::string>& options, 30 const std::map<std::string, std::string>& options,
30 const GetTokenCallback& callback) override; 31 const GetTokenCallback& callback) override;
31 void DeleteToken(const std::string& audience, 32 void DeleteToken(const std::string& audience,
32 const std::string& scope, 33 const std::string& scope,
33 const DeleteTokenCallback& callback) override; 34 const DeleteTokenCallback& callback) override;
34 void DeleteID(const DeleteIDCallback& callback) override; 35 void DeleteID(const DeleteIDCallback& callback) override;
35 36
36 private: 37 private:
38 void EnsureIDGenerated();
39
40 // The generated Instance ID.
41 std::string id_;
42
43 // The time when the Instance ID has been generated.
44 base::Time creation_time_;
45
37 DISALLOW_COPY_AND_ASSIGN(InstanceIDImpl); 46 DISALLOW_COPY_AND_ASSIGN(InstanceIDImpl);
38 }; 47 };
39 48
40 } // namespace instance_id 49 } // namespace instance_id
41 50
42 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_ 51 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698