Chromium Code Reviews| Index: chrome/browser/chromeos/login/screens/user_image_screen.cc |
| diff --git a/chrome/browser/chromeos/login/screens/user_image_screen.cc b/chrome/browser/chromeos/login/screens/user_image_screen.cc |
| index 4ceef1e5818aec2b9f7842b896e60ddd8fdcd35b..c4ccca60bf6f31a82b9e60e8ece639ab2a5bd177 100644 |
| --- a/chrome/browser/chromeos/login/screens/user_image_screen.cc |
| +++ b/chrome/browser/chromeos/login/screens/user_image_screen.cc |
| @@ -56,7 +56,7 @@ const char kProfileDownloadReason[] = "OOBE"; |
| // Maximum amount of time to wait for the user image to sync. |
| // The screen is shown iff sync failed or time limit exceeded. |
| -const int kSyncTimeoutSeconds = 10; |
| +const int kSyncTimeoutSeconds = 0; |
|
Nikita (slow)
2014/08/13 16:30:29
Debug change?
dzhioev (left Google)
2014/08/13 18:06:42
Yes. Fixed.
|
| } // namespace |
| @@ -66,13 +66,17 @@ UserImageScreen::UserImageScreen(ScreenObserver* screen_observer, |
| actor_(actor), |
| accept_photo_after_decoding_(false), |
| selected_image_(user_manager::User::USER_IMAGE_INVALID), |
| - profile_picture_enabled_(false), |
| profile_picture_data_url_(url::kAboutBlankURL), |
| profile_picture_absent_(false), |
| is_screen_ready_(false), |
| user_has_selected_image_(false) { |
| actor_->SetDelegate(this); |
| - SetProfilePictureEnabled(true); |
| + notification_registrar_.Add(this, |
| + chrome::NOTIFICATION_PROFILE_IMAGE_UPDATED, |
| + content::NotificationService::AllSources()); |
| + notification_registrar_.Add(this, |
| + chrome::NOTIFICATION_PROFILE_IMAGE_UPDATE_FAILED, |
| + content::NotificationService::AllSources()); |
| notification_registrar_.Add(this, |
| chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, |
| content::NotificationService::AllSources()); |
| @@ -213,45 +217,13 @@ void UserImageScreen::OnImageAccepted() { |
| } |
| -void UserImageScreen::SetProfilePictureEnabled(bool profile_picture_enabled) { |
| - if (profile_picture_enabled_ == profile_picture_enabled) |
| - return; |
| - profile_picture_enabled_ = profile_picture_enabled; |
| - if (profile_picture_enabled) { |
| - notification_registrar_.Add(this, |
| - chrome::NOTIFICATION_PROFILE_IMAGE_UPDATED, |
| - content::NotificationService::AllSources()); |
| - notification_registrar_.Add( |
| - this, |
| - chrome::NOTIFICATION_PROFILE_IMAGE_UPDATE_FAILED, |
| - content::NotificationService::AllSources()); |
| - } else { |
| - notification_registrar_.Remove(this, |
|
Nikita (slow)
2014/08/13 16:30:29
What about this code of removing notification subs
dzhioev (left Google)
2014/08/13 18:06:42
Done.
|
| - chrome::NOTIFICATION_PROFILE_IMAGE_UPDATED, |
| - content::NotificationService::AllSources()); |
| - notification_registrar_.Remove( |
| - this, |
| - chrome::NOTIFICATION_PROFILE_IMAGE_UPDATE_FAILED, |
| - content::NotificationService::AllSources()); |
| - } |
| - if (actor_) |
| - actor_->SetProfilePictureEnabled(profile_picture_enabled); |
| -} |
| - |
| -void UserImageScreen::SetUserID(const std::string& user_id) { |
| - DCHECK(!user_id.empty()); |
| - user_id_ = user_id; |
| -} |
| - |
| void UserImageScreen::PrepareToShow() { |
| if (actor_) |
| actor_->PrepareToShow(); |
| } |
| const user_manager::User* UserImageScreen::GetUser() { |
| - if (user_id_.empty()) |
| - return UserManager::Get()->GetLoggedInUser(); |
| - return UserManager::Get()->FindUser(user_id_); |
| + return UserManager::Get()->GetLoggedInUser(); |
| } |
| UserImageManager* UserImageScreen::GetUserImageManager() { |
| @@ -267,8 +239,7 @@ void UserImageScreen::Show() { |
| return; |
| DCHECK(!policy_registrar_); |
| - Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(GetUser()); |
| - if (profile) { |
| + if (Profile* profile = ProfileHelper::Get()->GetProfileByUser(GetUser())) { |
| policy::PolicyService* policy_service = |
| policy::ProfilePolicyConnectorFactory::GetForProfile(profile)-> |
| policy_service(); |
| @@ -313,15 +284,12 @@ void UserImageScreen::Show() { |
| } |
| CameraPresenceNotifier::GetInstance()->AddObserver(this); |
| actor_->Show(); |
| - actor_->SetProfilePictureEnabled(profile_picture_enabled_); |
| selected_image_ = GetUser()->image_index(); |
| actor_->SelectImage(selected_image_); |
| - if (profile_picture_enabled_) { |
| - // Start fetching the profile image. |
| - GetUserImageManager()->DownloadProfileImage(kProfileDownloadReason); |
| - } |
| + // Start fetching the profile image. |
| + GetUserImageManager()->DownloadProfileImage(kProfileDownloadReason); |
| } |
| void UserImageScreen::Hide() { |
| @@ -342,7 +310,6 @@ void UserImageScreen::OnActorDestroyed(UserImageScreenActor* actor) { |
| void UserImageScreen::Observe(int type, |
| const content::NotificationSource& source, |
| const content::NotificationDetails& details) { |
| - DCHECK(profile_picture_enabled_); |
| switch (type) { |
| case chrome::NOTIFICATION_PROFILE_IMAGE_UPDATED: { |
| // We've got a new profile image. |