| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user_creation_screen
_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen
_handler.h" |
| 6 | 6 |
| 7 #include "ash/audio/sounds.h" | 7 #include "ash/audio/sounds.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" | 10 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 UserFlow* flow = new SupervisedUserCreationFlow(manager_username); | 383 UserFlow* flow = new SupervisedUserCreationFlow(manager_username); |
| 384 UserManager::Get()->SetUserFlow(manager_username, flow); | 384 UserManager::Get()->SetUserFlow(manager_username, flow); |
| 385 | 385 |
| 386 delegate_->AuthenticateManager(manager_username, manager_password); | 386 delegate_->AuthenticateManager(manager_username, manager_password); |
| 387 } | 387 } |
| 388 | 388 |
| 389 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. | 389 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. |
| 390 // It should be removed by issue 251179. | 390 // It should be removed by issue 251179. |
| 391 void SupervisedUserCreationScreenHandler::HandleGetImages() { | 391 void SupervisedUserCreationScreenHandler::HandleGetImages() { |
| 392 base::ListValue image_urls; | 392 base::ListValue image_urls; |
| 393 for (int i = kFirstDefaultImageIndex; i < kDefaultImagesCount; ++i) { | 393 for (int i = user_manager::kFirstDefaultImageIndex; |
| 394 i < user_manager::kDefaultImagesCount; |
| 395 ++i) { |
| 394 scoped_ptr<base::DictionaryValue> image_data(new base::DictionaryValue); | 396 scoped_ptr<base::DictionaryValue> image_data(new base::DictionaryValue); |
| 395 image_data->SetString("url", GetDefaultImageUrl(i)); | 397 image_data->SetString("url", user_manager::GetDefaultImageUrl(i)); |
| 396 image_data->SetString( | 398 image_data->SetString( |
| 397 "author", l10n_util::GetStringUTF16(kDefaultImageAuthorIDs[i])); | 399 "author", |
| 400 l10n_util::GetStringUTF16(user_manager::kDefaultImageAuthorIDs[i])); |
| 398 image_data->SetString( | 401 image_data->SetString( |
| 399 "website", l10n_util::GetStringUTF16(kDefaultImageWebsiteIDs[i])); | 402 "website", |
| 400 image_data->SetString("title", GetDefaultImageDescription(i)); | 403 l10n_util::GetStringUTF16(user_manager::kDefaultImageWebsiteIDs[i])); |
| 404 image_data->SetString("title", user_manager::GetDefaultImageDescription(i)); |
| 401 image_urls.Append(image_data.release()); | 405 image_urls.Append(image_data.release()); |
| 402 } | 406 } |
| 403 CallJS("setDefaultImages", image_urls); | 407 CallJS("setDefaultImages", image_urls); |
| 404 } | 408 } |
| 405 | 409 |
| 406 void SupervisedUserCreationScreenHandler::HandlePhotoTaken | 410 void SupervisedUserCreationScreenHandler::HandlePhotoTaken |
| 407 (const std::string& image_url) { | 411 (const std::string& image_url) { |
| 408 std::string mime_type, charset, raw_data; | 412 std::string mime_type, charset, raw_data; |
| 409 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data)) | 413 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data)) |
| 410 NOTREACHED(); | 414 NOTREACHED(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 void SupervisedUserCreationScreenHandler::SetCameraPresent(bool present) { | 447 void SupervisedUserCreationScreenHandler::SetCameraPresent(bool present) { |
| 444 CallJS("setCameraPresent", present); | 448 CallJS("setCameraPresent", present); |
| 445 } | 449 } |
| 446 | 450 |
| 447 void SupervisedUserCreationScreenHandler::ShowExistingSupervisedUsers( | 451 void SupervisedUserCreationScreenHandler::ShowExistingSupervisedUsers( |
| 448 const base::ListValue* users) { | 452 const base::ListValue* users) { |
| 449 CallJS("setExistingManagedUsers", *users); | 453 CallJS("setExistingManagedUsers", *users); |
| 450 } | 454 } |
| 451 | 455 |
| 452 } // namespace chromeos | 456 } // namespace chromeos |
| OLD | NEW |