OLD | NEW |
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_DRIVER_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_DRIVER_H_ |
6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_DRIVER_H_ | 6 #define COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_DRIVER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 | 13 |
14 namespace gcm { | 14 namespace gcm { |
15 class GCMDriver; | 15 class GCMDriver; |
16 } // namespace gcm | 16 } // namespace gcm |
17 | 17 |
18 namespace instance_id { | 18 namespace instance_id { |
19 | 19 |
20 class InstanceID; | 20 class InstanceID; |
21 | 21 |
22 // Bridge between Instance ID users in Chrome and the platform-specific | 22 // Bridge between Instance ID users in Chrome and the platform-specific |
23 // implementation. | 23 // implementation. |
24 class InstanceIDDriver { | 24 class InstanceIDDriver { |
25 public: | 25 public: |
| 26 // Returns whether InstanceID is enabled. |
| 27 static bool IsInstanceIDEnabled(); |
| 28 |
26 explicit InstanceIDDriver(gcm::GCMDriver* gcm_driver); | 29 explicit InstanceIDDriver(gcm::GCMDriver* gcm_driver); |
27 virtual ~InstanceIDDriver(); | 30 virtual ~InstanceIDDriver(); |
28 | 31 |
29 // Returns the InstanceID that provides the Instance ID service for the given | 32 // Returns the InstanceID that provides the Instance ID service for the given |
30 // application. The lifetime of InstanceID will be managed by this class. | 33 // application. The lifetime of InstanceID will be managed by this class. |
31 InstanceID* GetInstanceID(const std::string& app_id); | 34 InstanceID* GetInstanceID(const std::string& app_id); |
32 | 35 |
33 private: | 36 private: |
34 gcm::GCMDriver* gcm_driver_; // Not owned. | 37 gcm::GCMDriver* gcm_driver_; // Not owned. |
35 typedef std::map<std::string, InstanceID*> InstanceIDMap; | 38 typedef std::map<std::string, InstanceID*> InstanceIDMap; |
36 InstanceIDMap instance_id_map_; | 39 InstanceIDMap instance_id_map_; |
37 STLValueDeleter<InstanceIDMap> instance_id_map_deleter_; | 40 STLValueDeleter<InstanceIDMap> instance_id_map_deleter_; |
38 | 41 |
39 DISALLOW_COPY_AND_ASSIGN(InstanceIDDriver); | 42 DISALLOW_COPY_AND_ASSIGN(InstanceIDDriver); |
40 }; | 43 }; |
41 | 44 |
42 } // namespace instance_id | 45 } // namespace instance_id |
43 | 46 |
44 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_DRIVER_H_ | 47 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_DRIVER_H_ |
OLD | NEW |