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_CLOUD_POLICY_IDENTITY_STRATEGY_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_POLICY_IDENTITY_STRATEGY_H_ |
6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_IDENTITY_STRATEGY_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_IDENTITY_STRATEGY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
12 | 13 |
13 namespace policy { | 14 namespace policy { |
14 | 15 |
| 16 namespace em = enterprise_management; |
| 17 |
15 // Manages a device management token, i.e. an identifier that represents a | 18 // Manages a device management token, i.e. an identifier that represents a |
16 // registration with the device management service, and the associated | 19 // registration with the device management service, and the associated |
17 // credentials. Responsibilities include storing and loading the token from | 20 // credentials. Responsibilities include storing and loading the token from |
18 // disk, observing and triggering relevant notifications. | 21 // disk, observing and triggering relevant notifications. |
19 class CloudPolicyIdentityStrategy { | 22 class CloudPolicyIdentityStrategy { |
20 public: | 23 public: |
21 class Observer { | 24 class Observer { |
22 public: | 25 public: |
23 virtual ~Observer() {} | 26 virtual ~Observer() {} |
24 | 27 |
(...skipping 17 matching lines...) Expand all Loading... |
42 observer_list_.RemoveObserver(obs); | 45 observer_list_.RemoveObserver(obs); |
43 } | 46 } |
44 | 47 |
45 // Returns the device management token, if available. Returns the empty string | 48 // Returns the device management token, if available. Returns the empty string |
46 // if the device token is currently unavailable. | 49 // if the device token is currently unavailable. |
47 virtual std::string GetDeviceToken() = 0; | 50 virtual std::string GetDeviceToken() = 0; |
48 | 51 |
49 // Returns the device ID for this device. | 52 // Returns the device ID for this device. |
50 virtual std::string GetDeviceID() = 0; | 53 virtual std::string GetDeviceID() = 0; |
51 | 54 |
| 55 // Returns physical machine ID for this device. |
| 56 virtual std::string GetMachineID() = 0; |
| 57 |
| 58 // Returns the policy type to be used for registering at the device management |
| 59 // server. |
| 60 virtual em::DeviceRegisterRequest_Type GetPolicyRegisterType() = 0; |
| 61 |
| 62 // Returns the policy type to be used for requesting policies from the device |
| 63 // management server. |
| 64 virtual std::string GetPolicyType() = 0; |
| 65 |
52 // Retrieves authentication credentials to use when talking to the device | 66 // Retrieves authentication credentials to use when talking to the device |
53 // management service. Returns true if the data is available and writes the | 67 // management service. Returns true if the data is available and writes the |
54 // values to the provided pointers. | 68 // values to the provided pointers. |
55 virtual bool GetCredentials(std::string* username, | 69 virtual bool GetCredentials(std::string* username, |
56 std::string* auth_token) = 0; | 70 std::string* auth_token) = 0; |
57 | 71 |
58 // Notifies the identity strategy that a new token has been fetched. It is up | 72 // Notifies the identity strategy that a new token has been fetched. It is up |
59 // to the identity strategy to store the token, decide whether it is going | 73 // to the identity strategy to store the token, decide whether it is going |
60 // to be used, send out an appropriate OnDeviceTokenChanged() notification | 74 // to be used, send out an appropriate OnDeviceTokenChanged() notification |
61 // and return the new token in GetDeviceToken() calls. | 75 // and return the new token in GetDeviceToken() calls. |
(...skipping 12 matching lines...) Expand all Loading... |
74 | 88 |
75 private: | 89 private: |
76 ObserverList<Observer, true> observer_list_; | 90 ObserverList<Observer, true> observer_list_; |
77 | 91 |
78 DISALLOW_COPY_AND_ASSIGN(CloudPolicyIdentityStrategy); | 92 DISALLOW_COPY_AND_ASSIGN(CloudPolicyIdentityStrategy); |
79 }; | 93 }; |
80 | 94 |
81 } // namespace policy | 95 } // namespace policy |
82 | 96 |
83 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_IDENTITY_STRATEGY_H_ | 97 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_IDENTITY_STRATEGY_H_ |
OLD | NEW |