| 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/ui/webui/chromeos/login/enterprise_enrollment_screen_ha
ndler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/enterprise_enrollment_screen_ha
ndler.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // Value carries single list entry, which is a json-encoded string that | 229 // Value carries single list entry, which is a json-encoded string that |
| 230 // contains the auth parameters (see gaia_login.js). | 230 // contains the auth parameters (see gaia_login.js). |
| 231 std::string json_params; | 231 std::string json_params; |
| 232 if (!value->GetString(0, &json_params)) { | 232 if (!value->GetString(0, &json_params)) { |
| 233 NOTREACHED(); | 233 NOTREACHED(); |
| 234 return; | 234 return; |
| 235 } | 235 } |
| 236 | 236 |
| 237 // Check the value type. | 237 // Check the value type. |
| 238 scoped_ptr<base::Value> params(base::JSONReader::Read(json_params, false)); | 238 scoped_ptr<base::Value> params(base::JSONReader::Read(json_params, false)); |
| 239 if (!params.get() || !params->IsType(base::Value::TYPE_DICTIONARY)) { | 239 if (!params.get() || !params->IsDictionary()) { |
| 240 NOTREACHED(); | 240 NOTREACHED(); |
| 241 return; | 241 return; |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Read the parameters. | 244 // Read the parameters. |
| 245 base::DictionaryValue* params_dict = | 245 base::DictionaryValue* params_dict = |
| 246 static_cast<base::DictionaryValue*>(params.get()); | 246 static_cast<base::DictionaryValue*>(params.get()); |
| 247 std::string user; | 247 std::string user; |
| 248 std::string pass; | 248 std::string pass; |
| 249 std::string captcha; | 249 std::string captcha; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 base::JSONWriter::Write(&args, false, &json); | 293 base::JSONWriter::Write(&args, false, &json); |
| 294 | 294 |
| 295 RenderViewHost* render_view_host = | 295 RenderViewHost* render_view_host = |
| 296 web_ui_->tab_contents()->render_view_host(); | 296 web_ui_->tab_contents()->render_view_host(); |
| 297 render_view_host->ExecuteJavascriptInWebFrame( | 297 render_view_host->ExecuteJavascriptInWebFrame( |
| 298 ASCIIToUTF16("//iframe[@id='gaia-local-login']"), | 298 ASCIIToUTF16("//iframe[@id='gaia-local-login']"), |
| 299 UTF8ToUTF16("showGaiaLogin(" + json + ");")); | 299 UTF8ToUTF16("showGaiaLogin(" + json + ");")); |
| 300 } | 300 } |
| 301 | 301 |
| 302 } // namespace chromeos | 302 } // namespace chromeos |
| OLD | NEW |