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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 // For manager user, move desktop to locked container so that windows created | 339 // For manager user, move desktop to locked container so that windows created |
337 // during the user image picker step are below it. | 340 // during the user image picker step are below it. |
338 ash::Shell::GetInstance()-> | 341 ash::Shell::GetInstance()-> |
339 desktop_background_controller()->MoveDesktopToLockedContainer(); | 342 desktop_background_controller()->MoveDesktopToLockedContainer(); |
340 | 343 |
341 controller_->SetManagerProfile(manager_profile); | 344 controller_->SetManagerProfile(manager_profile); |
342 if (actor_) | 345 if (actor_) |
343 actor_->ShowUsernamePage(); | 346 actor_->ShowUsernamePage(); |
344 | 347 |
345 last_page_ = kNameOfNewUserParametersScreen; | 348 last_page_ = kNameOfNewUserParametersScreen; |
349 sync_service_ = ManagedUserSyncServiceFactory::GetForProfile(manager_profile); | |
Nikita (slow)
2014/04/29 14:03:41
nit:
if (sync_service_) or CHECK(sync_service)?
| |
350 sync_service_->AddObserver(this); | |
351 OnManagedUsersChanged(); | |
352 } | |
346 | 353 |
347 ManagedUserSyncServiceFactory::GetForProfile(manager_profile)-> | 354 void LocallyManagedUserCreationScreen::OnManagedUsersChanged() { |
348 GetManagedUsersAsync(base::Bind( | 355 sync_service_->GetManagedUsersAsync( |
349 &LocallyManagedUserCreationScreen::OnGetManagedUsers, | 356 base::Bind(&LocallyManagedUserCreationScreen::OnGetManagedUsers, |
350 weak_factory_.GetWeakPtr())); | 357 weak_factory_.GetWeakPtr())); |
351 } | 358 } |
352 | 359 |
353 void LocallyManagedUserCreationScreen::OnManagerCryptohomeAuthenticated() { | 360 void LocallyManagedUserCreationScreen::OnManagerCryptohomeAuthenticated() { |
354 if (actor_) { | 361 if (actor_) { |
355 actor_->ShowStatusMessage(true /* progress */, l10n_util::GetStringUTF16( | 362 actor_->ShowStatusMessage(true /* progress */, l10n_util::GetStringUTF16( |
356 IDS_CREATE_LOCALLY_MANAGED_USER_CREATION_AUTH_PROGRESS_MESSAGE)); | 363 IDS_CREATE_LOCALLY_MANAGED_USER_CREATION_AUTH_PROGRESS_MESSAGE)); |
357 } | 364 } |
358 } | 365 } |
359 | 366 |
360 void LocallyManagedUserCreationScreen::OnActorDestroyed( | 367 void LocallyManagedUserCreationScreen::OnActorDestroyed( |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 selected_image_ = User::kExternalImageIndex; | 589 selected_image_ = User::kExternalImageIndex; |
583 } else { | 590 } else { |
584 NOTREACHED() << "Unexpected image type: " << image_type; | 591 NOTREACHED() << "Unexpected image type: " << image_type; |
585 } | 592 } |
586 } | 593 } |
587 | 594 |
588 void LocallyManagedUserCreationScreen::OnImageAccepted() { | 595 void LocallyManagedUserCreationScreen::OnImageAccepted() { |
589 } | 596 } |
590 | 597 |
591 } // namespace chromeos | 598 } // namespace chromeos |
OLD | NEW |