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

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: Remove leftover code 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
17 namespace crypto {
18 class RSAPrivateKey;
19 } // namespace crypto
20
16 namespace instance_id { 21 namespace instance_id {
17 22
18 // InstanceID implementation for desktop and iOS. 23 // InstanceID implementation for desktop and iOS.
19 class InstanceIDImpl : public InstanceID { 24 class InstanceIDImpl : public InstanceID {
20 public: 25 public:
21 explicit InstanceIDImpl(const std::string& app_id); 26 explicit InstanceIDImpl(const std::string& app_id);
22 ~InstanceIDImpl() override; 27 ~InstanceIDImpl() override;
23 28
24 // InstanceID: 29 // InstanceID:
25 std::string GetID() override; 30 std::string GetID() override;
26 base::Time GetCreationTime() override; 31 base::Time GetCreationTime() override;
27 void GetToken(const std::string& audience, 32 void GetToken(const std::string& audience,
28 const std::string& scope, 33 const std::string& scope,
29 const std::map<std::string, std::string>& options, 34 const std::map<std::string, std::string>& options,
30 const GetTokenCallback& callback) override; 35 const GetTokenCallback& callback) override;
31 void DeleteToken(const std::string& audience, 36 void DeleteToken(const std::string& audience,
32 const std::string& scope, 37 const std::string& scope,
33 const DeleteTokenCallback& callback) override; 38 const DeleteTokenCallback& callback) override;
34 void DeleteID(const DeleteIDCallback& callback) override; 39 void DeleteID(const DeleteIDCallback& callback) override;
35 40
36 private: 41 private:
42 void EnsureIDGenerated();
43
44 // The Instance ID is based on the public/private key pair.
45 scoped_ptr<crypto::RSAPrivateKey> key_pair_;
fgorski 2015/04/30 22:13:12 do we need to keep the key_pair_ around? what for?
jianli 2015/05/02 00:30:18 Not needed any more.
46
47 // The generated Instance ID.
48 std::string id_;
49
50 // The time when the Instance ID has been generated.
51 base::Time creation_time_;
52
37 DISALLOW_COPY_AND_ASSIGN(InstanceIDImpl); 53 DISALLOW_COPY_AND_ASSIGN(InstanceIDImpl);
38 }; 54 };
39 55
40 } // namespace instance_id 56 } // namespace instance_id
41 57
42 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_ 58 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698