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_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> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" |
13 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
14 #include "chrome/browser/chromeos/login/owner_key_utils.h" | 15 #include "chrome/browser/chromeos/login/owner_key_utils.h" |
15 #include "chrome/browser/chromeos/login/owner_manager.h" | 16 #include "chrome/browser/chromeos/login/owner_manager.h" |
16 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 17 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 template <typename T> struct DefaultLazyInstanceTraits; | 23 template <typename T> struct DefaultLazyInstanceTraits; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // OWNERSHIP_TAKEN (and not OWNERSHIP_UNKNOWN), however in this case it may | 98 // OWNERSHIP_TAKEN (and not OWNERSHIP_UNKNOWN), however in this case it may |
98 // occasionally block doing i/o. | 99 // occasionally block doing i/o. |
99 virtual Status GetStatus(bool blocking); | 100 virtual Status GetStatus(bool blocking); |
100 | 101 |
101 protected: | 102 protected: |
102 OwnershipService(); | 103 OwnershipService(); |
103 | 104 |
104 // content::NotificationObserver implementation. | 105 // content::NotificationObserver implementation. |
105 virtual void Observe(int type, | 106 virtual void Observe(int type, |
106 const content::NotificationSource& source, | 107 const content::NotificationSource& source, |
107 const content::NotificationDetails& details); | 108 const content::NotificationDetails& details) OVERRIDE; |
108 | 109 |
109 private: | 110 private: |
110 friend struct base::DefaultLazyInstanceTraits<OwnershipService>; | 111 friend struct base::DefaultLazyInstanceTraits<OwnershipService>; |
111 friend class OwnershipServiceTest; | 112 friend class OwnershipServiceTest; |
112 | 113 |
113 // Task posted on FILE thread on startup to prefetch ownership status. | 114 // Task posted on FILE thread on startup to prefetch ownership status. |
114 void FetchStatus(); | 115 void FetchStatus(); |
115 | 116 |
116 // Sets ownership status. May be called on either thread. | 117 // Sets ownership status. May be called on either thread. |
117 void SetStatus(Status new_status); | 118 void SetStatus(Status new_status); |
(...skipping 20 matching lines...) Expand all Loading... |
138 scoped_refptr<OwnerKeyUtils> utils_; | 139 scoped_refptr<OwnerKeyUtils> utils_; |
139 scoped_ptr<em::PolicyData> policy_; | 140 scoped_ptr<em::PolicyData> policy_; |
140 content::NotificationRegistrar notification_registrar_; | 141 content::NotificationRegistrar notification_registrar_; |
141 volatile Status ownership_status_; | 142 volatile Status ownership_status_; |
142 base::Lock ownership_status_lock_; | 143 base::Lock ownership_status_lock_; |
143 }; | 144 }; |
144 | 145 |
145 } // namespace chromeos | 146 } // namespace chromeos |
146 | 147 |
147 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OWNERSHIP_SERVICE_H_ | 148 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OWNERSHIP_SERVICE_H_ |
OLD | NEW |