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

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

Issue 2847923002: [Chromecast] Add method to CastCdm for the session expiration updating. (Closed)
Patch Set: Add InstanceIDFactory class to help with testing. Created 3 years, 5 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_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 <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.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 class InstanceIDFactory;
21 22
22 // Bridge between Instance ID users in Chrome and the platform-specific 23 // Bridge between Instance ID users in Chrome and the platform-specific
23 // implementation. 24 // implementation.
24 class InstanceIDDriver { 25 class InstanceIDDriver {
25 public: 26 public:
26 // Returns whether InstanceID is enabled. 27 // Returns whether InstanceID is enabled.
27 static bool IsInstanceIDEnabled(); 28 static bool IsInstanceIDEnabled();
28 29
29 explicit InstanceIDDriver(gcm::GCMDriver* gcm_driver); 30 InstanceIDDriver(gcm::GCMDriver* gcm_driver, InstanceIDFactory* factory);
30 virtual ~InstanceIDDriver(); 31 virtual ~InstanceIDDriver();
31 32
32 // Returns the InstanceID that provides the Instance ID service for the given 33 // Returns the InstanceID that provides the Instance ID service for the given
33 // application. The lifetime of the InstanceID will be managed by this class. 34 // application. The lifetime of the InstanceID will be managed by this class.
34 InstanceID* GetInstanceID(const std::string& app_id); 35 InstanceID* GetInstanceID(const std::string& app_id);
35 36
36 // Removes the InstanceID when it is not longer needed, i.e. the app is being 37 // Removes the InstanceID when it is not longer needed, i.e. the app is being
37 // uninstalled. 38 // uninstalled.
38 void RemoveInstanceID(const std::string& app_id); 39 void RemoveInstanceID(const std::string& app_id);
39 40
40 // Returns true if the InstanceID for the given application has been created. 41 // Returns true if the InstanceID for the given application has been created.
41 // This is currently only used for testing purpose. 42 // This is currently only used for testing purpose.
42 bool ExistsInstanceID(const std::string& app_id) const; 43 bool ExistsInstanceID(const std::string& app_id) const;
43 44
44 private: 45 private:
45 // Owned by GCMProfileServiceFactory, which is a dependency of 46 // Owned by GCMProfileServiceFactory, which is a dependency of
46 // InstanceIDProfileServiceFactory, which owns this. 47 // InstanceIDProfileServiceFactory, which owns this.
47 gcm::GCMDriver* gcm_driver_; 48 gcm::GCMDriver* gcm_driver_;
49 InstanceIDFactory* const factory_;
48 50
49 std::map<std::string, std::unique_ptr<InstanceID>> instance_id_map_; 51 std::map<std::string, std::unique_ptr<InstanceID>> instance_id_map_;
50 52
51 DISALLOW_COPY_AND_ASSIGN(InstanceIDDriver); 53 DISALLOW_COPY_AND_ASSIGN(InstanceIDDriver);
52 }; 54 };
53 55
54 } // namespace instance_id 56 } // namespace instance_id
55 57
56 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_DRIVER_H_ 58 #endif // COMPONENTS_GCM_DRIVER_INSTANCE_ID_INSTANCE_ID_DRIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698