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 #include "chrome/browser/chromeos/login/owner_manager.h" | 5 #include "chrome/browser/chromeos/login/owner_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chromeos/boot_times_loader.h" | 14 #include "chrome/browser/chromeos/boot_times_loader.h" |
15 #include "chrome/browser/chromeos/login/signed_settings_temp_storage.h" | 15 #include "chrome/browser/chromeos/login/signed_settings_temp_storage.h" |
16 #include "content/browser/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
18 #include "content/common/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
19 | 19 |
20 namespace chromeos { | 20 namespace chromeos { |
21 | 21 |
22 OwnerManager::OwnerManager() | 22 OwnerManager::OwnerManager() |
23 : private_key_(NULL), | 23 : private_key_(NULL), |
24 public_key_(0), | 24 public_key_(0), |
25 utils_(OwnerKeyUtils::Create()) { | 25 utils_(OwnerKeyUtils::Create()) { |
26 } | 26 } |
27 | 27 |
28 OwnerManager::~OwnerManager() {} | 28 OwnerManager::~OwnerManager() {} |
(...skipping 20 matching lines...) Expand all Loading... |
49 if (public_key_.empty() && | 49 if (public_key_.empty() && |
50 !utils_->ImportPublicKey(utils_->GetOwnerKeyFilePath(), &public_key_)) { | 50 !utils_->ImportPublicKey(utils_->GetOwnerKeyFilePath(), &public_key_)) { |
51 result = chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED; | 51 result = chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED; |
52 } | 52 } |
53 | 53 |
54 // Whether we loaded the public key or not, send a notification indicating | 54 // Whether we loaded the public key or not, send a notification indicating |
55 // that we're done with this attempt. | 55 // that we're done with this attempt. |
56 BrowserThread::PostTask( | 56 BrowserThread::PostTask( |
57 BrowserThread::UI, FROM_HERE, | 57 BrowserThread::UI, FROM_HERE, |
58 base::Bind(&OwnerManager::SendNotification, this, result, | 58 base::Bind(&OwnerManager::SendNotification, this, result, |
59 NotificationService::NoDetails())); | 59 content::NotificationService::NoDetails())); |
60 } | 60 } |
61 | 61 |
62 bool OwnerManager::EnsurePublicKey() { | 62 bool OwnerManager::EnsurePublicKey() { |
63 if (public_key_.empty()) | 63 if (public_key_.empty()) |
64 LoadOwnerKey(); | 64 LoadOwnerKey(); |
65 | 65 |
66 return !public_key_.empty(); | 66 return !public_key_.empty(); |
67 } | 67 } |
68 | 68 |
69 bool OwnerManager::EnsurePrivateKey() { | 69 bool OwnerManager::EnsurePrivateKey() { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 BrowserThread::PostTask( | 129 BrowserThread::PostTask( |
130 thread_id, FROM_HERE, | 130 thread_id, FROM_HERE, |
131 base::Bind(&OwnerManager::CallDelegate, this, d, return_code, | 131 base::Bind(&OwnerManager::CallDelegate, this, d, return_code, |
132 std::vector<uint8>())); | 132 std::vector<uint8>())); |
133 BootTimesLoader::Get()->AddLoginTimeMarker("VerifyEnd", false); | 133 BootTimesLoader::Get()->AddLoginTimeMarker("VerifyEnd", false); |
134 } | 134 } |
135 | 135 |
136 void OwnerManager::SendNotification( | 136 void OwnerManager::SendNotification( |
137 int type, | 137 int type, |
138 const content::NotificationDetails& details) { | 138 const content::NotificationDetails& details) { |
139 NotificationService::current()->Notify( | 139 content::NotificationService::current()->Notify( |
140 type, | 140 type, |
141 NotificationService::AllSources(), | 141 content::NotificationService::AllSources(), |
142 details); | 142 details); |
143 } | 143 } |
144 | 144 |
145 } // namespace chromeos | 145 } // namespace chromeos |
OLD | NEW |