| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/managed/locally_managed_user_creation_sc
reen.h" | 5 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc
reen.h" |
| 6 | 6 |
| 7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } // namespace | 82 } // namespace |
| 83 | 83 |
| 84 LocallyManagedUserCreationScreen::LocallyManagedUserCreationScreen( | 84 LocallyManagedUserCreationScreen::LocallyManagedUserCreationScreen( |
| 85 ScreenObserver* observer, | 85 ScreenObserver* observer, |
| 86 LocallyManagedUserCreationScreenHandler* actor) | 86 LocallyManagedUserCreationScreenHandler* actor) |
| 87 : WizardScreen(observer), | 87 : WizardScreen(observer), |
| 88 weak_factory_(this), | 88 weak_factory_(this), |
| 89 actor_(actor), | 89 actor_(actor), |
| 90 on_error_screen_(false), | 90 on_error_screen_(false), |
| 91 last_page_(kNameOfIntroScreen), | 91 last_page_(kNameOfIntroScreen), |
| 92 sync_service_(NULL), |
| 92 image_decoder_(NULL), | 93 image_decoder_(NULL), |
| 93 apply_photo_after_decoding_(false), | 94 apply_photo_after_decoding_(false), |
| 94 selected_image_(0) { | 95 selected_image_(0) { |
| 95 DCHECK(actor_); | 96 DCHECK(actor_); |
| 96 if (actor_) | 97 if (actor_) |
| 97 actor_->SetDelegate(this); | 98 actor_->SetDelegate(this); |
| 98 } | 99 } |
| 99 | 100 |
| 100 LocallyManagedUserCreationScreen::~LocallyManagedUserCreationScreen() { | 101 LocallyManagedUserCreationScreen::~LocallyManagedUserCreationScreen() { |
| 101 CameraPresenceNotifier::GetInstance()->RemoveObserver(this); | 102 CameraPresenceNotifier::GetInstance()->RemoveObserver(this); |
| 103 if (sync_service_) |
| 104 sync_service_->RemoveObserver(this); |
| 102 if (actor_) | 105 if (actor_) |
| 103 actor_->SetDelegate(NULL); | 106 actor_->SetDelegate(NULL); |
| 104 if (image_decoder_.get()) | 107 if (image_decoder_.get()) |
| 105 image_decoder_->set_delegate(NULL); | 108 image_decoder_->set_delegate(NULL); |
| 106 NetworkPortalDetector::Get()->RemoveObserver(this); | 109 NetworkPortalDetector::Get()->RemoveObserver(this); |
| 107 } | 110 } |
| 108 | 111 |
| 109 void LocallyManagedUserCreationScreen::PrepareToShow() { | 112 void LocallyManagedUserCreationScreen::PrepareToShow() { |
| 110 if (actor_) | 113 if (actor_) |
| 111 actor_->PrepareToShow(); | 114 actor_->PrepareToShow(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 master_key); | 328 master_key); |
| 326 } | 329 } |
| 327 | 330 |
| 328 void LocallyManagedUserCreationScreen::OnManagerLoginFailure() { | 331 void LocallyManagedUserCreationScreen::OnManagerLoginFailure() { |
| 329 if (actor_) | 332 if (actor_) |
| 330 actor_->ShowManagerPasswordError(); | 333 actor_->ShowManagerPasswordError(); |
| 331 } | 334 } |
| 332 | 335 |
| 333 void LocallyManagedUserCreationScreen::OnManagerFullyAuthenticated( | 336 void LocallyManagedUserCreationScreen::OnManagerFullyAuthenticated( |
| 334 Profile* manager_profile) { | 337 Profile* manager_profile) { |
| 338 LOG(ERROR) << "-----------------------------OnManagerFullyAuthenticated"; |
| 335 DCHECK(controller_.get()); | 339 DCHECK(controller_.get()); |
| 336 // For manager user, move desktop to locked container so that windows created | 340 // For manager user, move desktop to locked container so that windows created |
| 337 // during the user image picker step are below it. | 341 // during the user image picker step are below it. |
| 338 ash::Shell::GetInstance()-> | 342 ash::Shell::GetInstance()-> |
| 339 desktop_background_controller()->MoveDesktopToLockedContainer(); | 343 desktop_background_controller()->MoveDesktopToLockedContainer(); |
| 340 | 344 |
| 341 controller_->SetManagerProfile(manager_profile); | 345 controller_->SetManagerProfile(manager_profile); |
| 342 if (actor_) | 346 if (actor_) |
| 343 actor_->ShowUsernamePage(); | 347 actor_->ShowUsernamePage(); |
| 344 | 348 |
| 345 last_page_ = kNameOfNewUserParametersScreen; | 349 last_page_ = kNameOfNewUserParametersScreen; |
| 350 CHECK(!sync_service_); |
| 351 sync_service_ = ManagedUserSyncServiceFactory::GetForProfile(manager_profile); |
| 352 sync_service_->AddObserver(this); |
| 353 OnManagedUsersChanged(); |
| 354 } |
| 346 | 355 |
| 347 ManagedUserSyncServiceFactory::GetForProfile(manager_profile)-> | 356 void LocallyManagedUserCreationScreen::OnManagedUsersChanged() { |
| 348 GetManagedUsersAsync(base::Bind( | 357 CHECK(sync_service_); |
| 349 &LocallyManagedUserCreationScreen::OnGetManagedUsers, | 358 sync_service_->GetManagedUsersAsync( |
| 350 weak_factory_.GetWeakPtr())); | 359 base::Bind(&LocallyManagedUserCreationScreen::OnGetManagedUsers, |
| 360 weak_factory_.GetWeakPtr())); |
| 351 } | 361 } |
| 352 | 362 |
| 353 void LocallyManagedUserCreationScreen::OnManagerCryptohomeAuthenticated() { | 363 void LocallyManagedUserCreationScreen::OnManagerCryptohomeAuthenticated() { |
| 354 if (actor_) { | 364 if (actor_) { |
| 355 actor_->ShowStatusMessage(true /* progress */, l10n_util::GetStringUTF16( | 365 actor_->ShowStatusMessage(true /* progress */, l10n_util::GetStringUTF16( |
| 356 IDS_CREATE_LOCALLY_MANAGED_USER_CREATION_AUTH_PROGRESS_MESSAGE)); | 366 IDS_CREATE_LOCALLY_MANAGED_USER_CREATION_AUTH_PROGRESS_MESSAGE)); |
| 357 } | 367 } |
| 358 } | 368 } |
| 359 | 369 |
| 360 void LocallyManagedUserCreationScreen::OnActorDestroyed( | 370 void LocallyManagedUserCreationScreen::OnActorDestroyed( |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 selected_image_ = User::kExternalImageIndex; | 592 selected_image_ = User::kExternalImageIndex; |
| 583 } else { | 593 } else { |
| 584 NOTREACHED() << "Unexpected image type: " << image_type; | 594 NOTREACHED() << "Unexpected image type: " << image_type; |
| 585 } | 595 } |
| 586 } | 596 } |
| 587 | 597 |
| 588 void LocallyManagedUserCreationScreen::OnImageAccepted() { | 598 void LocallyManagedUserCreationScreen::OnImageAccepted() { |
| 589 } | 599 } |
| 590 | 600 |
| 591 } // namespace chromeos | 601 } // namespace chromeos |
| OLD | NEW |