| 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/browser/chromeos/login/wizard_accessibility_helper.h" |
| 14 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "content/common/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 17 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // 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. |
| 26 const int kFrameWidth = 480; | 26 const int kFrameWidth = 480; |
| 27 const int kFrameHeight = 480; | 27 const int kFrameHeight = 480; |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 UserImageScreen::UserImageScreen(ScreenObserver* screen_observer, | 31 UserImageScreen::UserImageScreen(ScreenObserver* screen_observer, |
| 32 UserImageScreenActor* actor) | 32 UserImageScreenActor* actor) |
| 33 : WizardScreen(screen_observer), | 33 : WizardScreen(screen_observer), |
| 34 camera_controller_(this), | 34 camera_controller_(this), |
| 35 actor_(actor) { | 35 actor_(actor) { |
| 36 actor_->SetDelegate(this); | 36 actor_->SetDelegate(this); |
| 37 camera_controller_.set_frame_width(kFrameWidth); | 37 camera_controller_.set_frame_width(kFrameWidth); |
| 38 camera_controller_.set_frame_height(kFrameHeight); | 38 camera_controller_.set_frame_height(kFrameHeight); |
| 39 registrar_.Add( | 39 registrar_.Add( |
| 40 this, | 40 this, |
| 41 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 41 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
| 42 NotificationService::AllSources()); | 42 content::NotificationService::AllSources()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 UserImageScreen::~UserImageScreen() { | 45 UserImageScreen::~UserImageScreen() { |
| 46 if (actor_) | 46 if (actor_) |
| 47 actor_->SetDelegate(NULL); | 47 actor_->SetDelegate(NULL); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void UserImageScreen::PrepareToShow() { | 50 void UserImageScreen::PrepareToShow() { |
| 51 if (actor_) | 51 if (actor_) |
| 52 actor_->PrepareToShow(); | 52 actor_->PrepareToShow(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 StartCamera(); | 180 StartCamera(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void UserImageScreen::OnDownloadSuccess(const SkBitmap& image) { | 183 void UserImageScreen::OnDownloadSuccess(const SkBitmap& image) { |
| 184 // TODO(avayvod): Check for the default image. | 184 // TODO(avayvod): Check for the default image. |
| 185 if (actor_) | 185 if (actor_) |
| 186 actor_->AddProfileImage(image); | 186 actor_->AddProfileImage(image); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace chromeos | 189 } // namespace chromeos |
| OLD | NEW |