| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/user_image_screen.h" | 5 #include "chrome/browser/chromeos/login/user_image_screen.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/chromeos/login/default_user_images.h" | 9 #include "chrome/browser/chromeos/login/default_user_images.h" |
| 10 #include "chrome/browser/chromeos/login/login_utils.h" | 10 #include "chrome/browser/chromeos/login/login_utils.h" |
| 11 #include "chrome/browser/chromeos/login/screen_observer.h" | 11 #include "chrome/browser/chromeos/login/screen_observer.h" |
| 12 #include "chrome/browser/chromeos/login/user_manager.h" | 12 #include "chrome/browser/chromeos/login/user_manager.h" |
| 13 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
| 13 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "content/common/notification_service.h" | 15 #include "content/common/notification_service.h" |
| 16 #include "grit/generated_resources.h" |
| 15 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
| 18 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 17 | 20 |
| 18 namespace chromeos { | 21 namespace chromeos { |
| 19 | 22 |
| 20 namespace { | 23 namespace { |
| 21 | 24 |
| 22 // The resolution of the picture we want to get from the camera. | 25 // The resolution of the picture we want to get from the camera. |
| 23 const int kFrameWidth = 480; | 26 const int kFrameWidth = 480; |
| 24 const int kFrameHeight = 480; | 27 const int kFrameHeight = 480; |
| 25 | 28 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 UserManager* user_manager = UserManager::Get(); | 61 UserManager* user_manager = UserManager::Get(); |
| 59 std::string logged_in_user = user_manager->logged_in_user().email(); | 62 std::string logged_in_user = user_manager->logged_in_user().email(); |
| 60 int selected_image_index = | 63 int selected_image_index = |
| 61 user_manager->GetUserDefaultImageIndex(logged_in_user); | 64 user_manager->GetUserDefaultImageIndex(logged_in_user); |
| 62 // The image must have been assigned by UserManager on new user login but | 65 // The image must have been assigned by UserManager on new user login but |
| 63 // under some circumstances (i.e. the data is not written to Local State | 66 // under some circumstances (i.e. the data is not written to Local State |
| 64 // or the file was corrupt) -1 could still be returned. | 67 // or the file was corrupt) -1 could still be returned. |
| 65 if (selected_image_index == -1) | 68 if (selected_image_index == -1) |
| 66 selected_image_index = 0; | 69 selected_image_index = 0; |
| 67 actor_->SelectImage(selected_image_index); | 70 actor_->SelectImage(selected_image_index); |
| 71 |
| 72 WizardAccessibilityHelper::GetInstance()->MaybeSpeak( |
| 73 l10n_util::GetStringUTF8(IDS_OPTIONS_CHANGE_PICTURE_DIALOG_TEXT).c_str(), |
| 74 false, true); |
| 68 } | 75 } |
| 69 | 76 |
| 70 void UserImageScreen::Hide() { | 77 void UserImageScreen::Hide() { |
| 71 camera_controller_.Stop(); | 78 camera_controller_.Stop(); |
| 72 if (actor_) | 79 if (actor_) |
| 73 actor_->Hide(); | 80 actor_->Hide(); |
| 74 } | 81 } |
| 75 | 82 |
| 76 void UserImageScreen::OnCaptureSuccess() { | 83 void UserImageScreen::OnCaptureSuccess() { |
| 77 if (!actor_) | 84 if (!actor_) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return; | 159 return; |
| 153 | 160 |
| 154 bool is_screen_locked = *Details<bool>(details).ptr(); | 161 bool is_screen_locked = *Details<bool>(details).ptr(); |
| 155 if (is_screen_locked) | 162 if (is_screen_locked) |
| 156 StopCamera(); | 163 StopCamera(); |
| 157 else if (actor_ && actor_->IsCapturing()) | 164 else if (actor_ && actor_->IsCapturing()) |
| 158 StartCamera(); | 165 StartCamera(); |
| 159 } | 166 } |
| 160 | 167 |
| 161 } // namespace chromeos | 168 } // namespace chromeos |
| 162 | |
| OLD | NEW |