OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_POLICY_USER_POLICY_IDENTITY_STRATEGY_H_ | 5 #ifndef CHROME_BROWSER_POLICY_USER_POLICY_IDENTITY_STRATEGY_H_ |
6 #define CHROME_BROWSER_POLICY_USER_POLICY_IDENTITY_STRATEGY_H_ | 6 #define CHROME_BROWSER_POLICY_USER_POLICY_IDENTITY_STRATEGY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... | |
26 // A token provider implementation that provides a user device token for the | 26 // A token provider implementation that provides a user device token for the |
27 // user corresponding to a given profile. | 27 // user corresponding to a given profile. |
28 class UserPolicyIdentityStrategy : public CloudPolicyIdentityStrategy, | 28 class UserPolicyIdentityStrategy : public CloudPolicyIdentityStrategy, |
29 public NotificationObserver, | 29 public NotificationObserver, |
30 public UserPolicyTokenCache::Delegate { | 30 public UserPolicyTokenCache::Delegate { |
31 public: | 31 public: |
32 UserPolicyIdentityStrategy(Profile* profile, | 32 UserPolicyIdentityStrategy(Profile* profile, |
33 const FilePath& token_cache_file); | 33 const FilePath& token_cache_file); |
34 virtual ~UserPolicyIdentityStrategy(); | 34 virtual ~UserPolicyIdentityStrategy(); |
35 | 35 |
36 // Start loading the token cache. | |
37 void LoadTokenCache(); | |
38 | |
39 // CloudPolicyIdentityStrategy implementation: | 36 // CloudPolicyIdentityStrategy implementation: |
40 virtual std::string GetDeviceToken() OVERRIDE; | 37 virtual std::string GetDeviceToken() OVERRIDE; |
41 virtual std::string GetDeviceID() OVERRIDE; | 38 virtual std::string GetDeviceID() OVERRIDE; |
42 virtual std::string GetMachineID() OVERRIDE; | 39 virtual std::string GetMachineID() OVERRIDE; |
43 virtual std::string GetMachineModel() OVERRIDE; | 40 virtual std::string GetMachineModel() OVERRIDE; |
44 virtual em::DeviceRegisterRequest_Type GetPolicyRegisterType() OVERRIDE; | 41 virtual em::DeviceRegisterRequest_Type GetPolicyRegisterType() OVERRIDE; |
45 virtual std::string GetPolicyType() OVERRIDE; | 42 virtual std::string GetPolicyType() OVERRIDE; |
46 virtual bool GetCredentials(std::string* username, | 43 virtual bool GetCredentials(std::string* username, |
47 std::string* auth_token) OVERRIDE; | 44 std::string* auth_token) OVERRIDE; |
48 virtual void OnDeviceTokenAvailable(const std::string& token) OVERRIDE; | 45 virtual void OnDeviceTokenAvailable(const std::string& token) OVERRIDE; |
46 virtual void LoadTokenCache(); | |
gfeher
2011/06/22 12:41:31
OVERRIDE?
Mattias Nissler (ping if slow)
2011/06/22 17:17:35
Done.
| |
49 | 47 |
50 private: | 48 private: |
51 // Checks whether a new token should be fetched and if so, sends out a | 49 // Checks whether a new token should be fetched and if so, sends out a |
52 // notification. | 50 // notification. |
53 void CheckAndTriggerFetch(); | 51 void CheckAndTriggerFetch(); |
54 | 52 |
55 // Gets the current user. | 53 // Gets the current user. |
56 std::string GetCurrentUser(); | 54 std::string GetCurrentUser(); |
57 | 55 |
58 // Called from the token cache when the token has been loaded. | 56 // Called from the token cache when the token has been loaded. |
(...skipping 22 matching lines...) Expand all Loading... | |
81 | 79 |
82 // Allows to construct weak ptrs. | 80 // Allows to construct weak ptrs. |
83 base::WeakPtrFactory<UserPolicyTokenCache::Delegate> weak_ptr_factory_; | 81 base::WeakPtrFactory<UserPolicyTokenCache::Delegate> weak_ptr_factory_; |
84 | 82 |
85 DISALLOW_COPY_AND_ASSIGN(UserPolicyIdentityStrategy); | 83 DISALLOW_COPY_AND_ASSIGN(UserPolicyIdentityStrategy); |
86 }; | 84 }; |
87 | 85 |
88 } // namespace policy | 86 } // namespace policy |
89 | 87 |
90 #endif // CHROME_BROWSER_POLICY_USER_POLICY_IDENTITY_STRATEGY_H_ | 88 #endif // CHROME_BROWSER_POLICY_USER_POLICY_IDENTITY_STRATEGY_H_ |
OLD | NEW |