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

Side by Side Diff: chrome/browser/policy/device_policy_identity_strategy.h

Issue 6520008: Device policy infrastructure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_POLICY_DEVICE_POLICY_IDENTITY_STRATEGY_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_POLICY_IDENTITY_STRATEGY_H_
7 #pragma once
8
9 #include <string>
10
11 #include "chrome/browser/policy/cloud_policy_identity_strategy.h"
12 #include "chrome/common/notification_observer.h"
13 #include "chrome/common/notification_registrar.h"
14
15 class TokenService;
16
17 namespace policy {
18
19 // DM token provider that stores the token in CrOS signed settings.
20 class DevicePolicyIdentityStrategy : public CloudPolicyIdentityStrategy,
21 public NotificationObserver {
22 public:
23 DevicePolicyIdentityStrategy();
24 virtual ~DevicePolicyIdentityStrategy() {}
25
26 // CloudPolicyIdentityStrategy implementation:
27 virtual std::string GetDeviceToken();
28 virtual std::string GetDeviceID();
29 virtual bool GetCredentials(std::string* username,
30 std::string* auth_token);
31 virtual void OnDeviceTokenAvailable(const std::string& token);
32
33 private:
34 // Recheck whether all parameters are available and if so, trigger a
35 // credentials changed notification.
36 void CheckAndTriggerFetch();
37
38 // NotificationObserver method overrides:
39 virtual void Observe(NotificationType type,
40 const NotificationSource& source,
41 const NotificationDetails& details);
42
43 // The machine identifier.
44 std::string machine_id_;
45
46 // Current token. Empty if not available.
47 std::string device_token_;
48
49 // Whether to try and register. Device policy enrollment does not happen
50 // automatically except for the case that the device gets claimed. This
51 // situation is detected by listening for the OWNERSHIP_TAKEN notification.
52 bool should_register_;
53
54 // Registers the provider for notification of successful Gaia logins.
55 NotificationRegistrar registrar_;
56
57 DISALLOW_COPY_AND_ASSIGN(DevicePolicyIdentityStrategy);
58 };
59
60 } // namespace policy
61
62 #endif // CHROME_BROWSER_POLICY_DEVICE_POLICY_IDENTITY_STRATEGY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698