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" | 21 #include "chrome/browser/chromeos/login/login_utils.h" |
| 22 #include "chrome/browser/chromeos/login/screen_manager.h" |
22 #include "chrome/browser/chromeos/login/screens/screen_observer.h" | 23 #include "chrome/browser/chromeos/login/screens/screen_observer.h" |
23 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" | 24 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" |
24 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 25 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
25 #include "chrome/browser/chromeos/login/wizard_controller.h" | 26 #include "chrome/browser/chromeos/login/wizard_controller.h" |
26 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 27 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
27 #include "chrome/browser/policy/profile_policy_connector.h" | 28 #include "chrome/browser/policy/profile_policy_connector.h" |
28 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 29 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
29 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
30 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
31 #include "components/policy/core/common/policy_map.h" | 32 #include "components/policy/core/common/policy_map.h" |
(...skipping 18 matching lines...) Expand all Loading... |
50 | 51 |
51 // Time histogram suffix for profile image download. | 52 // Time histogram suffix for profile image download. |
52 const char kProfileDownloadReason[] = "OOBE"; | 53 const char kProfileDownloadReason[] = "OOBE"; |
53 | 54 |
54 // Maximum amount of time to wait for the user image to sync. | 55 // Maximum amount of time to wait for the user image to sync. |
55 // The screen is shown iff sync failed or time limit exceeded. | 56 // The screen is shown iff sync failed or time limit exceeded. |
56 const int kSyncTimeoutSeconds = 10; | 57 const int kSyncTimeoutSeconds = 10; |
57 | 58 |
58 } // namespace | 59 } // namespace |
59 | 60 |
| 61 // static |
| 62 UserImageScreen* UserImageScreen::Get(ScreenManager* manager) { |
| 63 return static_cast<UserImageScreen*>( |
| 64 manager->GetScreen(WizardController::kUserImageScreenName)); |
| 65 } |
| 66 |
60 UserImageScreen::UserImageScreen(ScreenObserver* screen_observer, | 67 UserImageScreen::UserImageScreen(ScreenObserver* screen_observer, |
61 UserImageScreenActor* actor) | 68 UserImageScreenActor* actor) |
62 : WizardScreen(screen_observer), | 69 : WizardScreen(screen_observer), |
63 actor_(actor), | 70 actor_(actor), |
64 accept_photo_after_decoding_(false), | 71 accept_photo_after_decoding_(false), |
65 selected_image_(user_manager::User::USER_IMAGE_INVALID), | 72 selected_image_(user_manager::User::USER_IMAGE_INVALID), |
66 profile_picture_data_url_(url::kAboutBlankURL), | 73 profile_picture_data_url_(url::kAboutBlankURL), |
67 profile_picture_absent_(false), | 74 profile_picture_absent_(false), |
68 is_screen_ready_(false), | 75 is_screen_ready_(false), |
69 user_has_selected_image_(false) { | 76 user_has_selected_image_(false) { |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 355 |
349 void UserImageScreen::ExitScreen() { | 356 void UserImageScreen::ExitScreen() { |
350 policy_registrar_.reset(); | 357 policy_registrar_.reset(); |
351 sync_timer_.reset(); | 358 sync_timer_.reset(); |
352 if (UserImageSyncObserver* sync_observer = GetSyncObserver()) | 359 if (UserImageSyncObserver* sync_observer = GetSyncObserver()) |
353 sync_observer->RemoveObserver(this); | 360 sync_observer->RemoveObserver(this); |
354 get_screen_observer()->OnExit(ScreenObserver::USER_IMAGE_SELECTED); | 361 get_screen_observer()->OnExit(ScreenObserver::USER_IMAGE_SELECTED); |
355 } | 362 } |
356 | 363 |
357 } // namespace chromeos | 364 } // namespace chromeos |
OLD | NEW |