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(); |
achuithb
2017/01/31 20:33:05
Maybe add a comment like:
// Fetch profile image f
Roman Sorokin (ftl)
2017/02/01 13:15:56
Done.
| |
284 GetUserImageManager()->DownloadProfileImage(kProfileDownloadReason); | 284 if (user && user->HasGaiaAccount()) { |
285 GetContextEditor().SetBoolean(kContextKeyHasGaiaAccount, true); | |
286 GetUserImageManager()->DownloadProfileImage(kProfileDownloadReason); | |
287 } else { | |
288 GetContextEditor().SetBoolean(kContextKeyHasGaiaAccount, false); | |
289 } | |
285 } | 290 } |
286 | 291 |
287 void UserImageScreen::Hide() { | 292 void UserImageScreen::Hide() { |
288 CameraPresenceNotifier::GetInstance()->RemoveObserver(this); | 293 CameraPresenceNotifier::GetInstance()->RemoveObserver(this); |
289 user_manager::UserManager::Get()->RemoveObserver(this); | 294 user_manager::UserManager::Get()->RemoveObserver(this); |
290 policy_registrar_.reset(); | 295 policy_registrar_.reset(); |
291 sync_timer_.reset(); | 296 sync_timer_.reset(); |
292 if (UserImageSyncObserver* sync_observer = GetSyncObserver()) | 297 if (UserImageSyncObserver* sync_observer = GetSyncObserver()) |
293 sync_observer->RemoveObserver(this); | 298 sync_observer->RemoveObserver(this); |
294 if (view_) | 299 if (view_) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 | 336 |
332 void UserImageScreen::ReportSyncResult(SyncResult timed_out) const { | 337 void UserImageScreen::ReportSyncResult(SyncResult timed_out) const { |
333 base::TimeDelta duration = base::Time::Now() - sync_waiting_start_time_; | 338 base::TimeDelta duration = base::Time::Now() - sync_waiting_start_time_; |
334 UMA_HISTOGRAM_TIMES("Login.NewUserPriorityPrefsSyncTime", duration); | 339 UMA_HISTOGRAM_TIMES("Login.NewUserPriorityPrefsSyncTime", duration); |
335 UMA_HISTOGRAM_ENUMERATION("Login.NewUserPriorityPrefsSyncResult", | 340 UMA_HISTOGRAM_ENUMERATION("Login.NewUserPriorityPrefsSyncResult", |
336 static_cast<int>(timed_out), | 341 static_cast<int>(timed_out), |
337 static_cast<int>(SyncResult::COUNT)); | 342 static_cast<int>(SyncResult::COUNT)); |
338 } | 343 } |
339 | 344 |
340 } // namespace chromeos | 345 } // namespace chromeos |
OLD | NEW |