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/login/enterprise_enrollment_screen.h" | 9 #include "chrome/browser/chromeos/login/enterprise_enrollment_screen.h" |
10 #include "chrome/browser/chromeos/login/helper.h" | 10 #include "chrome/browser/chromeos/login/helper.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 | 129 |
130 void EnterpriseEnrollmentView::ShowAccountError() { | 130 void EnterpriseEnrollmentView::ShowAccountError() { |
131 ShowError(IDS_ENTERPRISE_ENROLLMENT_ACCOUNT_ERROR); | 131 ShowError(IDS_ENTERPRISE_ENROLLMENT_ACCOUNT_ERROR); |
132 } | 132 } |
133 | 133 |
134 void EnterpriseEnrollmentView::ShowFatalAuthError() { | 134 void EnterpriseEnrollmentView::ShowFatalAuthError() { |
135 ShowError(IDS_ENTERPRISE_ENROLLMENT_FATAL_AUTH_ERROR); | 135 ShowError(IDS_ENTERPRISE_ENROLLMENT_FATAL_AUTH_ERROR); |
136 } | 136 } |
137 | 137 |
| 138 void EnterpriseEnrollmentView::ShowFatalEnrollmentError() { |
| 139 ShowError(IDS_ENTERPRISE_ENROLLMENT_FATAL_ENROLLMENT_ERROR); |
| 140 } |
| 141 |
| 142 void EnterpriseEnrollmentView::ShowNetworkEnrollmentError() { |
| 143 ShowError(IDS_ENTERPRISE_ENROLLMENT_NETWORK_ENROLLMENT_ERROR); |
| 144 } |
| 145 |
138 void EnterpriseEnrollmentView::OnAuthSubmitted(const std::string& user, | 146 void EnterpriseEnrollmentView::OnAuthSubmitted(const std::string& user, |
139 const std::string& password, | 147 const std::string& password, |
140 const std::string& captcha, | 148 const std::string& captcha, |
141 const std::string& access_code) { | 149 const std::string& access_code) { |
142 controller_->Authenticate(user, password, captcha, access_code); | 150 controller_->Authenticate(user, password, captcha, access_code); |
143 } | 151 } |
144 | 152 |
145 void EnterpriseEnrollmentView::OnAuthCancelled() { | 153 void EnterpriseEnrollmentView::OnAuthCancelled() { |
146 controller_->CancelEnrollment(); | 154 controller_->CancelEnrollment(); |
147 } | 155 } |
148 | 156 |
149 void EnterpriseEnrollmentView::OnConfirmationClosed() { | 157 void EnterpriseEnrollmentView::OnConfirmationClosed() { |
150 controller_->CloseConfirmation(); | 158 controller_->CloseConfirmation(); |
151 } | 159 } |
152 | 160 |
153 void EnterpriseEnrollmentView::UpdateGaiaLogin(const DictionaryValue& args) { | 161 void EnterpriseEnrollmentView::UpdateGaiaLogin(const DictionaryValue& args) { |
154 std::string json; | 162 std::string json; |
155 base::JSONWriter::Write(&args, false, &json); | 163 base::JSONWriter::Write(&args, false, &json); |
156 | 164 |
157 RenderViewHost* render_view_host = | 165 RenderViewHost* render_view_host = |
158 enrollment_page_view_->tab_contents()->render_view_host(); | 166 enrollment_page_view_->tab_contents()->render_view_host(); |
159 render_view_host->ExecuteJavascriptInWebFrame( | 167 render_view_host->ExecuteJavascriptInWebFrame( |
160 ASCIIToUTF16("//iframe[@id='gaialogin']"), | 168 ASCIIToUTF16("//iframe[@id='gaialogin']"), |
161 UTF8ToUTF16("showGaiaLogin(" + json + ");")); | 169 UTF8ToUTF16("showGaiaLogin(" + json + ");")); |
162 } | 170 } |
163 | 171 |
164 void EnterpriseEnrollmentView::ShowError(int message_id) { | 172 void EnterpriseEnrollmentView::ShowError(int message_id) { |
165 DictionaryValue args; | 173 DictionaryValue args; |
166 args.SetInteger("error", GoogleServiceAuthError::NONE); | 174 args.SetInteger("error", GoogleServiceAuthError::NONE); |
| 175 args.SetBoolean("editable_user", true); |
167 args.SetString("error_message", l10n_util::GetStringUTF16(message_id)); | 176 args.SetString("error_message", l10n_util::GetStringUTF16(message_id)); |
168 UpdateGaiaLogin(args); | 177 UpdateGaiaLogin(args); |
169 } | 178 } |
170 | 179 |
171 void EnterpriseEnrollmentView::Layout() { | 180 void EnterpriseEnrollmentView::Layout() { |
172 enrollment_page_view_->SetBoundsRect(GetContentsBounds()); | 181 enrollment_page_view_->SetBoundsRect(GetContentsBounds()); |
173 } | 182 } |
174 | 183 |
175 } // namespace chromeos | 184 } // namespace chromeos |
OLD | NEW |