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

Side by Side Diff: chrome/browser/chromeos/login/ownership_service.h

Issue 6821075: Chrome-side lockbox bindings (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: CL RC1. Created 9 years, 8 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
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_CHROMEOS_LOGIN_OWNERSHIP_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_OWNERSHIP_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_OWNERSHIP_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_OWNERSHIP_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 namespace chromeos { 24 namespace chromeos {
25 25
26 class OwnershipService : public NotificationObserver { 26 class OwnershipService : public NotificationObserver {
27 public: 27 public:
28 enum Status { 28 enum Status {
29 // Listed in upgrade order. 29 // Listed in upgrade order.
30 OWNERSHIP_UNKNOWN = 0, 30 OWNERSHIP_UNKNOWN = 0,
31 OWNERSHIP_NONE, 31 OWNERSHIP_NONE,
32 OWNERSHIP_TAKEN 32 OWNERSHIP_USER,
33 OWNERSHIP_ENTERPRISE
33 }; 34 };
34 35
35 // Returns the singleton instance of the OwnershipService. 36 // Returns the singleton instance of the OwnershipService.
36 static OwnershipService* GetSharedInstance(); 37 static OwnershipService* GetSharedInstance();
37 virtual ~OwnershipService(); 38 virtual ~OwnershipService();
38 39
39 // If the device has been owned already, posts a task to the FILE thread to 40 // If the device has been owned already, posts a task to the FILE thread to
40 // fetch the public key off disk. 41 // fetch the public key off disk.
41 // 42 //
42 // Sends out a OWNER_KEY_FETCH_ATTEMPT_SUCCESS notification on success, 43 // Sends out a OWNER_KEY_FETCH_ATTEMPT_SUCCESS notification on success,
(...skipping 21 matching lines...) Expand all
64 65
65 // This method must be run on the FILE thread. 66 // This method must be run on the FILE thread.
66 virtual bool CurrentUserIsOwner(); 67 virtual bool CurrentUserIsOwner();
67 68
68 // This method should be run on FILE thread. 69 // This method should be run on FILE thread.
69 // Note: not static, for better mocking. 70 // Note: not static, for better mocking.
70 virtual bool IsAlreadyOwned(); 71 virtual bool IsAlreadyOwned();
71 72
72 // This method can be run either on FILE or UI threads. If |blocking| flag 73 // This method can be run either on FILE or UI threads. If |blocking| flag
73 // is specified then it is guaranteed to return either OWNERSHIP_NONE or 74 // is specified then it is guaranteed to return either OWNERSHIP_NONE or
74 // OWNERSHIP_TAKEN (and not OWNERSHIP_UNKNOWN), however in this case it may 75 // OWNERSHIP_USER or OWNERSHIP_ENTERPRISE (and not OWNERSHIP_UNKNOWN), however
75 // occasionally block doing i/o. 76 // in this case it may occasionally block doing i/o.
76 virtual Status GetStatus(bool blocking); 77 virtual Status GetStatus(bool blocking);
77 78
78 protected: 79 protected:
79 OwnershipService(); 80 OwnershipService();
80 81
81 // NotificationObserver implementation. 82 // NotificationObserver implementation.
82 virtual void Observe(NotificationType type, 83 virtual void Observe(NotificationType type,
83 const NotificationSource& source, 84 const NotificationSource& source,
84 const NotificationDetails& details); 85 const NotificationDetails& details);
85 86
(...skipping 11 matching lines...) Expand all
97 static void TrySigningAttempt(OwnershipService* service, 98 static void TrySigningAttempt(OwnershipService* service,
98 const BrowserThread::ID thread_id, 99 const BrowserThread::ID thread_id,
99 const std::string& data, 100 const std::string& data,
100 OwnerManager::Delegate* d); 101 OwnerManager::Delegate* d);
101 static void TryVerifyAttempt(OwnershipService* service, 102 static void TryVerifyAttempt(OwnershipService* service,
102 const BrowserThread::ID thread_id, 103 const BrowserThread::ID thread_id,
103 const std::string& data, 104 const std::string& data,
104 const std::vector<uint8>& signature, 105 const std::vector<uint8>& signature,
105 OwnerManager::Delegate* d); 106 OwnerManager::Delegate* d);
106 static void FailAttempt(OwnerManager::Delegate* d); 107 static void FailAttempt(OwnerManager::Delegate* d);
108 static Status DetermineOwnerType();
107 109
108 OwnerManager* manager() { return manager_.get(); } 110 OwnerManager* manager() { return manager_.get(); }
109 111
110 scoped_refptr<OwnerManager> manager_; 112 scoped_refptr<OwnerManager> manager_;
111 scoped_refptr<OwnerKeyUtils> utils_; 113 scoped_refptr<OwnerKeyUtils> utils_;
112 NotificationRegistrar notification_registrar_; 114 NotificationRegistrar notification_registrar_;
113 Status ownership_status_; 115 Status ownership_status_;
114 base::Lock ownership_status_lock_; 116 base::Lock ownership_status_lock_;
115 }; 117 };
116 118
117 } // namespace chromeos 119 } // namespace chromeos
118 120
119 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OWNERSHIP_SERVICE_H_ 121 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OWNERSHIP_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698