| 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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/message_loop/message_loop_proxy.h" | 14 #include "base/message_loop/message_loop_proxy.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
| 19 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 19 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 20 #include "chrome/browser/chromeos/camera_presence_notifier.h" | 20 #include "chrome/browser/chromeos/camera_presence_notifier.h" |
| 21 #include "chrome/browser/chromeos/login/login_utils.h" | |
| 22 #include "chrome/browser/chromeos/login/screen_manager.h" | 21 #include "chrome/browser/chromeos/login/screen_manager.h" |
| 23 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" | 22 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" |
| 24 #include "chrome/browser/chromeos/login/screens/user_image_view.h" | 23 #include "chrome/browser/chromeos/login/screens/user_image_view.h" |
| 25 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" | 24 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" |
| 26 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 25 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 27 #include "chrome/browser/chromeos/login/wizard_controller.h" | 26 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 28 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 27 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 29 #include "chrome/browser/policy/profile_policy_connector.h" | 28 #include "chrome/browser/policy/profile_policy_connector.h" |
| 30 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 29 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 31 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 kContextKeySelectedImageURL, | 292 kContextKeySelectedImageURL, |
| 294 user_manager::GetDefaultImageUrl(selected_image_)); | 293 user_manager::GetDefaultImageUrl(selected_image_)); |
| 295 | 294 |
| 296 // Start fetching the profile image. | 295 // Start fetching the profile image. |
| 297 GetUserImageManager()->DownloadProfileImage(kProfileDownloadReason); | 296 GetUserImageManager()->DownloadProfileImage(kProfileDownloadReason); |
| 298 } | 297 } |
| 299 | 298 |
| 300 void UserImageScreen::Hide() { | 299 void UserImageScreen::Hide() { |
| 301 CameraPresenceNotifier::GetInstance()->RemoveObserver(this); | 300 CameraPresenceNotifier::GetInstance()->RemoveObserver(this); |
| 302 notification_registrar_.RemoveAll(); | 301 notification_registrar_.RemoveAll(); |
| 302 policy_registrar_.reset(); |
| 303 sync_timer_.reset(); |
| 304 if (UserImageSyncObserver* sync_observer = GetSyncObserver()) |
| 305 sync_observer->RemoveObserver(this); |
| 303 if (view_) | 306 if (view_) |
| 304 view_->Hide(); | 307 view_->Hide(); |
| 305 } | 308 } |
| 306 | 309 |
| 307 void UserImageScreen::OnViewDestroyed(UserImageView* view) { | 310 void UserImageScreen::OnViewDestroyed(UserImageView* view) { |
| 308 if (view_ == view) | 311 if (view_ == view) |
| 309 view_ = nullptr; | 312 view_ = nullptr; |
| 310 } | 313 } |
| 311 | 314 |
| 312 void UserImageScreen::Observe(int type, | 315 void UserImageScreen::Observe(int type, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 342 | 345 |
| 343 void UserImageScreen::ExitScreen() { | 346 void UserImageScreen::ExitScreen() { |
| 344 policy_registrar_.reset(); | 347 policy_registrar_.reset(); |
| 345 sync_timer_.reset(); | 348 sync_timer_.reset(); |
| 346 if (UserImageSyncObserver* sync_observer = GetSyncObserver()) | 349 if (UserImageSyncObserver* sync_observer = GetSyncObserver()) |
| 347 sync_observer->RemoveObserver(this); | 350 sync_observer->RemoveObserver(this); |
| 348 Finish(BaseScreenDelegate::USER_IMAGE_SELECTED); | 351 Finish(BaseScreenDelegate::USER_IMAGE_SELECTED); |
| 349 } | 352 } |
| 350 | 353 |
| 351 } // namespace chromeos | 354 } // namespace chromeos |
| OLD | NEW |