| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/screens/user_image_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/user_image_screen.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 CameraPresenceNotifier::GetInstance()->AddObserver(this); | 275 CameraPresenceNotifier::GetInstance()->AddObserver(this); |
| 276 view_->Show(); | 276 view_->Show(); |
| 277 | 277 |
| 278 selected_image_ = GetUser()->image_index(); | 278 selected_image_ = GetUser()->image_index(); |
| 279 GetContextEditor().SetString( | 279 GetContextEditor().SetString( |
| 280 kContextKeySelectedImageURL, | 280 kContextKeySelectedImageURL, |
| 281 default_user_image::GetDefaultImageUrl(selected_image_)); | 281 default_user_image::GetDefaultImageUrl(selected_image_)); |
| 282 | 282 |
| 283 // Start fetching the profile image. | 283 const user_manager::User* user = GetUser(); |
| 284 GetUserImageManager()->DownloadProfileImage(kProfileDownloadReason); | 284 // Fetch profile image for GAIA accounts. |
| 285 if (user && user->HasGaiaAccount()) { |
| 286 GetContextEditor().SetBoolean(kContextKeyHasGaiaAccount, true); |
| 287 GetUserImageManager()->DownloadProfileImage(kProfileDownloadReason); |
| 288 } else { |
| 289 GetContextEditor().SetBoolean(kContextKeyHasGaiaAccount, false); |
| 290 } |
| 285 } | 291 } |
| 286 | 292 |
| 287 void UserImageScreen::Hide() { | 293 void UserImageScreen::Hide() { |
| 288 CameraPresenceNotifier::GetInstance()->RemoveObserver(this); | 294 CameraPresenceNotifier::GetInstance()->RemoveObserver(this); |
| 289 user_manager::UserManager::Get()->RemoveObserver(this); | 295 user_manager::UserManager::Get()->RemoveObserver(this); |
| 290 policy_registrar_.reset(); | 296 policy_registrar_.reset(); |
| 291 sync_timer_.reset(); | 297 sync_timer_.reset(); |
| 292 if (UserImageSyncObserver* sync_observer = GetSyncObserver()) | 298 if (UserImageSyncObserver* sync_observer = GetSyncObserver()) |
| 293 sync_observer->RemoveObserver(this); | 299 sync_observer->RemoveObserver(this); |
| 294 if (view_) | 300 if (view_) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 | 337 |
| 332 void UserImageScreen::ReportSyncResult(SyncResult timed_out) const { | 338 void UserImageScreen::ReportSyncResult(SyncResult timed_out) const { |
| 333 base::TimeDelta duration = base::Time::Now() - sync_waiting_start_time_; | 339 base::TimeDelta duration = base::Time::Now() - sync_waiting_start_time_; |
| 334 UMA_HISTOGRAM_TIMES("Login.NewUserPriorityPrefsSyncTime", duration); | 340 UMA_HISTOGRAM_TIMES("Login.NewUserPriorityPrefsSyncTime", duration); |
| 335 UMA_HISTOGRAM_ENUMERATION("Login.NewUserPriorityPrefsSyncResult", | 341 UMA_HISTOGRAM_ENUMERATION("Login.NewUserPriorityPrefsSyncResult", |
| 336 static_cast<int>(timed_out), | 342 static_cast<int>(timed_out), |
| 337 static_cast<int>(SyncResult::COUNT)); | 343 static_cast<int>(SyncResult::COUNT)); |
| 338 } | 344 } |
| 339 | 345 |
| 340 } // namespace chromeos | 346 } // namespace chromeos |
| OLD | NEW |