Chromium Code Reviews| Index: chrome/browser/chromeos/login/enterprise_enrollment_view.cc |
| diff --git a/chrome/browser/chromeos/login/enterprise_enrollment_view.cc b/chrome/browser/chromeos/login/enterprise_enrollment_view.cc |
| index 44c7de5a9810528baeca7234cbffbbf6c6fab88c..1bd091382060ec5bb13510b205378fdc4048273e 100644 |
| --- a/chrome/browser/chromeos/login/enterprise_enrollment_view.cc |
| +++ b/chrome/browser/chromeos/login/enterprise_enrollment_view.cc |
| @@ -6,6 +6,8 @@ |
| #include "base/json/json_writer.h" |
| #include "base/values.h" |
| +#include "chrome/browser/chromeos/cros/cros_library.h" |
| +#include "chrome/browser/chromeos/cros/cryptohome_library.h" |
| #include "chrome/browser/chromeos/login/enterprise_enrollment_screen.h" |
| #include "chrome/browser/chromeos/login/helper.h" |
| #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| @@ -24,6 +26,9 @@ namespace chromeos { |
| namespace { |
| +// Retry for lockbox initialization every 500ms. |
| +const int kLockboxRetryInterval = 500; |
| + |
| // Layout constants. |
| const int kBorderSize = 30; |
| @@ -75,6 +80,7 @@ class EnrollmentDomView : public WebPageDomView, |
| } |
| private: |
| + |
| DISALLOW_COPY_AND_ASSIGN(EnrollmentDomView); |
| }; |
| @@ -82,7 +88,8 @@ class EnrollmentDomView : public WebPageDomView, |
| EnterpriseEnrollmentView::EnterpriseEnrollmentView( |
| EnterpriseEnrollmentController* controller) |
| - : controller_(controller) {} |
| + : controller_(controller), |
| + ALLOW_THIS_IN_INITIALIZER_LIST(runnable_method_factory_(this)) {} |
| EnterpriseEnrollmentView::~EnterpriseEnrollmentView() {} |
| @@ -147,6 +154,7 @@ void EnterpriseEnrollmentView::OnAuthSubmitted(const std::string& user, |
| const std::string& password, |
| const std::string& captcha, |
| const std::string& access_code) { |
| + user_ = user; |
| controller_->Authenticate(user, password, captcha, access_code); |
| } |
| @@ -181,4 +189,65 @@ void EnterpriseEnrollmentView::Layout() { |
| enrollment_page_view_->SetBoundsRect(GetContentsBounds()); |
| } |
| + |
| +void EnterpriseEnrollmentView::WriteLockboxData() { |
| + // Since this method is also called directly. |
| + runnable_method_factory_.RevokeAll(); |
| + |
| + chromeos::CryptohomeLibrary* cryptohome = |
| + chromeos::CrosLibrary::Get()->GetCryptohomeLibrary(); |
| + // TODO(pastarmovj): This is being done either on the eula screen or on first |
| + // login so maybe we should do it already here? If not remove. |
| + if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) { |
| + if (cryptohome->TpmIsOwned()) |
| + cryptohome->TpmClearStoredPassword(); |
| + else |
| + cryptohome->TpmCanAttemptOwnership(); |
| + } |
| + |
| + if (!cryptohome->InstallAttributesIsReady()) { |
|
kmixter1
2011/04/14 16:52:22
How does this look to the user? Do they provide c
|
| + // Lockbox is not read yet, reschedule pulling. |
| + LOG(INFO) << "Lockbox is not ready yet will retry in " |
| + << kLockboxRetryInterval << "ms."; |
| + MessageLoop::current()->PostDelayedTask( |
| + FROM_HERE, |
| + runnable_method_factory_.NewRunnableMethod( |
| + &EnterpriseEnrollmentView::WriteLockboxData), |
| + kLockboxRetryInterval); |
| + } else { |
| + // Set values in the lockbox and lock it. |
| + /* |
|
kmixter1
2011/04/14 16:52:22
remove?
|
| + DCHECK(cryptohome->InstallAttributesIsFirstInstall()); |
| + cryptohome->InstallAttributesSet("enterprise.owned", "true"); |
| + cryptohome->InstallAttributesSet("enterprise.user", user_); |
| + DCHECK(cryptohome->InstallAttributesCount() == 2); |
| + cryptohome->InstallAttributesFinalize(); |
| + DCHECK(cryptohome->InstallAttributesIsSecure()); |
| + */ |
| + |
| + // The same code but much more verbose for debugging! |
| + LOG(ERROR) << "### FI : " << cryptohome->InstallAttributesIsFirstInstall(); |
|
kmixter1
2011/04/14 16:52:22
remove?
|
| + LOG(ERROR) << "### count : " << cryptohome->InstallAttributesCount(); |
| + LOG(ERROR) << "### set : " |
| + << cryptohome->InstallAttributesSet("enterprise.owned", "true"); |
| + LOG(ERROR) << "### set : " |
| + << cryptohome->InstallAttributesSet("enterprise.user", user_); |
| + LOG(ERROR) << "### count : " << cryptohome->InstallAttributesCount(); |
| + std::string test; |
| + LOG(ERROR) << "### get owned : " |
| + << cryptohome->InstallAttributesGet("enterprise.owned", &test); |
| + LOG(ERROR) << "### " << test; |
| + LOG(ERROR) << "### get user : " |
| + << cryptohome->InstallAttributesGet("enterprise.user", &test); |
| + LOG(ERROR) << "### " << test; |
| + LOG(ERROR) << "### stat : " << cryptohome->InstallAttributesIsSecure(); |
| + LOG(ERROR) << "### lock : " << cryptohome->InstallAttributesFinalize(); |
| + LOG(ERROR) << "### stat : " << cryptohome->InstallAttributesIsSecure(); |
| + |
| + ShowConfirmationScreen(); |
| + } |
| +} |
| + |
| + |
| + |
| } // namespace chromeos |