| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_cache.h" | 15 #include "chrome/browser/chromeos/login/signed_settings_cache.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 19 | 19 |
| 20 using content::BrowserThread; | 20 using content::BrowserThread; |
| 21 | 21 |
| 22 namespace chromeos { | 22 namespace chromeos { |
| 23 | 23 |
| 24 OwnerManager::OwnerManager() | 24 OwnerManager::OwnerManager() |
| 25 : private_key_(NULL), | 25 : private_key_(NULL), |
| 26 public_key_(0), | 26 public_key_(0), |
| 27 utils_(OwnerKeyUtils::Create()) { | 27 utils_(OwnerKeyUtils::Create()) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 OwnerManager::~OwnerManager() {} | |
| 31 | |
| 32 void OwnerManager::UpdateOwnerKey(const BrowserThread::ID thread_id, | 30 void OwnerManager::UpdateOwnerKey(const BrowserThread::ID thread_id, |
| 33 const std::vector<uint8>& key, | 31 const std::vector<uint8>& key, |
| 34 KeyUpdateDelegate* d) { | 32 KeyUpdateDelegate* d) { |
| 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 36 | 34 |
| 37 public_key_ = key; | 35 public_key_ = key; |
| 38 | 36 |
| 39 BrowserThread::PostTask( | 37 BrowserThread::PostTask( |
| 40 thread_id, FROM_HERE, | 38 thread_id, FROM_HERE, |
| 41 base::Bind(&OwnerManager::CallKeyUpdateDelegate, this, d)); | 39 base::Bind(&OwnerManager::CallKeyUpdateDelegate, this, d)); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 if (!utils_->Verify(data, signature, public_key_)) { | 126 if (!utils_->Verify(data, signature, public_key_)) { |
| 129 return_code = OPERATION_FAILED; | 127 return_code = OPERATION_FAILED; |
| 130 } | 128 } |
| 131 BrowserThread::PostTask( | 129 BrowserThread::PostTask( |
| 132 thread_id, FROM_HERE, | 130 thread_id, FROM_HERE, |
| 133 base::Bind(&OwnerManager::CallDelegate, this, d, return_code, | 131 base::Bind(&OwnerManager::CallDelegate, this, d, return_code, |
| 134 std::vector<uint8>())); | 132 std::vector<uint8>())); |
| 135 BootTimesLoader::Get()->AddLoginTimeMarker("VerifyEnd", false); | 133 BootTimesLoader::Get()->AddLoginTimeMarker("VerifyEnd", false); |
| 136 } | 134 } |
| 137 | 135 |
| 136 OwnerManager::~OwnerManager() {} |
| 137 |
| 138 void OwnerManager::SendNotification( | 138 void OwnerManager::SendNotification( |
| 139 int type, | 139 int type, |
| 140 const content::NotificationDetails& details) { | 140 const content::NotificationDetails& details) { |
| 141 content::NotificationService::current()->Notify( | 141 content::NotificationService::current()->Notify( |
| 142 type, | 142 type, |
| 143 content::NotificationService::AllSources(), | 143 content::NotificationService::AllSources(), |
| 144 details); | 144 details); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace chromeos | 147 } // namespace chromeos |
| OLD | NEW |