Chromium Code Reviews| 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/enterprise_enrollment_view.h" | 5 #include "chrome/browser/chromeos/login/enterprise_enrollment_view.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/cros/cros_library.h" | |
| 10 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | |
| 9 #include "chrome/browser/chromeos/login/enterprise_enrollment_screen.h" | 11 #include "chrome/browser/chromeos/login/enterprise_enrollment_screen.h" |
| 10 #include "chrome/browser/chromeos/login/helper.h" | 12 #include "chrome/browser/chromeos/login/helper.h" |
| 11 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 13 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.h" | 15 #include "chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.h" |
| 14 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 15 #include "content/browser/renderer_host/render_view_host.h" | 17 #include "content/browser/renderer_host/render_view_host.h" |
| 16 #include "content/browser/site_instance.h" | 18 #include "content/browser/site_instance.h" |
| 17 #include "content/browser/tab_contents/tab_contents_delegate.h" | 19 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 18 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 Profile* profile = ProfileManager::GetDefaultProfile(); | 106 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 105 GURL url(chrome::kChromeUIEnterpriseEnrollmentURL); | 107 GURL url(chrome::kChromeUIEnterpriseEnrollmentURL); |
| 106 enrollment_page_view_->Init( | 108 enrollment_page_view_->Init( |
| 107 profile, SiteInstance::CreateSiteInstanceForURL(profile, url)); | 109 profile, SiteInstance::CreateSiteInstanceForURL(profile, url)); |
| 108 EnterpriseEnrollmentUI::SetController(enrollment_page_view_->tab_contents(), | 110 EnterpriseEnrollmentUI::SetController(enrollment_page_view_->tab_contents(), |
| 109 this); | 111 this); |
| 110 enrollment_page_view_->LoadURL(url); | 112 enrollment_page_view_->LoadURL(url); |
| 111 } | 113 } |
| 112 | 114 |
| 113 void EnterpriseEnrollmentView::ShowConfirmationScreen() { | 115 void EnterpriseEnrollmentView::ShowConfirmationScreen() { |
| 116 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { | |
|
pastarmovj
2011/04/13 15:00:35
This code is here only as an example how to use th
| |
| 117 chromeos::CryptohomeLibrary* cryptohome = chromeos::CrosLibrary::Get()->GetC ryptohomeLibrary(); | |
| 118 if (cryptohome->TpmIsEnabled() && !cryptohome->TpmIsBeingOwned()) { | |
| 119 if (cryptohome->TpmIsOwned()) { | |
| 120 cryptohome->TpmClearStoredPassword(); | |
| 121 } else { | |
| 122 cryptohome->TpmCanAttemptOwnership(); | |
| 123 } | |
| 124 } | |
| 125 while(cryptohome->TpmIsBeingOwned()); | |
| 126 LOG(ERROR) << "### FI : " << cryptohome->InstallAttributesIsFirstInstall(); | |
| 127 LOG(ERROR) << "### count : " << cryptohome->InstallAttributesCount(); | |
| 128 LOG(ERROR) << "### set : " << cryptohome->InstallAttributesSet("enterprise.o wned", "true"); | |
| 129 LOG(ERROR) << "### set : " << cryptohome->InstallAttributesSet("enterprise.u ser", user_); | |
| 130 LOG(ERROR) << "### count : " << cryptohome->InstallAttributesCount(); | |
| 131 std::string test; | |
| 132 LOG(ERROR) << "### get : " << cryptohome->InstallAttributesGet("enterprise.u ser", &test); | |
| 133 LOG(ERROR) << "### " << test; | |
| 134 LOG(ERROR) << "### stat : " << cryptohome->InstallAttributesIsSecure(); | |
| 135 LOG(ERROR) << "### lock : " << cryptohome->InstallAttributesFinalize(); | |
| 136 LOG(ERROR) << "### stat : " << cryptohome->InstallAttributesIsSecure(); | |
| 137 } else { | |
| 138 LOG(ERROR) << "Cros library not loaded. " | |
| 139 << "We must have disabled the link that led here."; | |
| 140 } | |
| 141 | |
| 114 RenderViewHost* render_view_host = | 142 RenderViewHost* render_view_host = |
| 115 enrollment_page_view_->tab_contents()->render_view_host(); | 143 enrollment_page_view_->tab_contents()->render_view_host(); |
| 116 render_view_host->ExecuteJavascriptInWebFrame( | 144 render_view_host->ExecuteJavascriptInWebFrame( |
| 117 string16(), | 145 string16(), |
| 118 UTF8ToUTF16("enterpriseEnrollment.showScreen('confirmation-screen');")); | 146 UTF8ToUTF16("enterpriseEnrollment.showScreen('confirmation-screen');")); |
| 119 } | 147 } |
| 120 | 148 |
| 121 void EnterpriseEnrollmentView::ShowAuthError( | 149 void EnterpriseEnrollmentView::ShowAuthError( |
| 122 const GoogleServiceAuthError& error) { | 150 const GoogleServiceAuthError& error) { |
| 123 DictionaryValue args; | 151 DictionaryValue args; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 140 } | 168 } |
| 141 | 169 |
| 142 void EnterpriseEnrollmentView::ShowNetworkEnrollmentError() { | 170 void EnterpriseEnrollmentView::ShowNetworkEnrollmentError() { |
| 143 ShowError(IDS_ENTERPRISE_ENROLLMENT_NETWORK_ENROLLMENT_ERROR); | 171 ShowError(IDS_ENTERPRISE_ENROLLMENT_NETWORK_ENROLLMENT_ERROR); |
| 144 } | 172 } |
| 145 | 173 |
| 146 void EnterpriseEnrollmentView::OnAuthSubmitted(const std::string& user, | 174 void EnterpriseEnrollmentView::OnAuthSubmitted(const std::string& user, |
| 147 const std::string& password, | 175 const std::string& password, |
| 148 const std::string& captcha, | 176 const std::string& captcha, |
| 149 const std::string& access_code) { | 177 const std::string& access_code) { |
| 178 user_ = user; | |
| 150 controller_->Authenticate(user, password, captcha, access_code); | 179 controller_->Authenticate(user, password, captcha, access_code); |
| 151 } | 180 } |
| 152 | 181 |
| 153 void EnterpriseEnrollmentView::OnAuthCancelled() { | 182 void EnterpriseEnrollmentView::OnAuthCancelled() { |
| 154 controller_->CancelEnrollment(); | 183 controller_->CancelEnrollment(); |
| 155 } | 184 } |
| 156 | 185 |
| 157 void EnterpriseEnrollmentView::OnConfirmationClosed() { | 186 void EnterpriseEnrollmentView::OnConfirmationClosed() { |
| 158 controller_->CloseConfirmation(); | 187 controller_->CloseConfirmation(); |
| 159 } | 188 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 175 args.SetBoolean("editable_user", true); | 204 args.SetBoolean("editable_user", true); |
| 176 args.SetString("error_message", l10n_util::GetStringUTF16(message_id)); | 205 args.SetString("error_message", l10n_util::GetStringUTF16(message_id)); |
| 177 UpdateGaiaLogin(args); | 206 UpdateGaiaLogin(args); |
| 178 } | 207 } |
| 179 | 208 |
| 180 void EnterpriseEnrollmentView::Layout() { | 209 void EnterpriseEnrollmentView::Layout() { |
| 181 enrollment_page_view_->SetBoundsRect(GetContentsBounds()); | 210 enrollment_page_view_->SetBoundsRect(GetContentsBounds()); |
| 182 } | 211 } |
| 183 | 212 |
| 184 } // namespace chromeos | 213 } // namespace chromeos |
| OLD | NEW |