| 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/chromeos/camera_presence_notifier.h" | 10 #include "chrome/browser/chromeos/camera_presence_notifier.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class PolicyChangeRegistrar; | 25 class PolicyChangeRegistrar; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace chromeos { | 28 namespace chromeos { |
| 29 | 29 |
| 30 class ScreenManager; | 30 class ScreenManager; |
| 31 class UserImageManager; | 31 class UserImageManager; |
| 32 class UserImageView; | 32 class UserImageView; |
| 33 | 33 |
| 34 class UserImageScreen : public UserImageModel, | 34 class UserImageScreen : public UserImageModel, |
| 35 public ImageDecoder::Delegate, | 35 public ImageDecoder::ImageRequest, |
| 36 public content::NotificationObserver, | 36 public content::NotificationObserver, |
| 37 public UserImageSyncObserver::Observer, | 37 public UserImageSyncObserver::Observer, |
| 38 public CameraPresenceNotifier::Observer { | 38 public CameraPresenceNotifier::Observer { |
| 39 public: | 39 public: |
| 40 UserImageScreen(BaseScreenDelegate* base_screen_delegate, | 40 UserImageScreen(BaseScreenDelegate* base_screen_delegate, |
| 41 UserImageView* view); | 41 UserImageView* view); |
| 42 ~UserImageScreen() override; | 42 ~UserImageScreen() override; |
| 43 | 43 |
| 44 static UserImageScreen* Get(ScreenManager* manager); | 44 static UserImageScreen* Get(ScreenManager* manager); |
| 45 | 45 |
| 46 // BaseScreen implementation: | 46 // BaseScreen implementation: |
| 47 void PrepareToShow() override; | 47 void PrepareToShow() override; |
| 48 void Show() override; | 48 void Show() override; |
| 49 void Hide() override; | 49 void Hide() override; |
| 50 | 50 |
| 51 // UserImageScreenActor::Delegate implementation: | 51 // UserImageScreenActor::Delegate implementation: |
| 52 void OnScreenReady() override; | 52 void OnScreenReady() override; |
| 53 void OnPhotoTaken(const std::string& raw_data) override; | 53 void OnPhotoTaken(const std::string& raw_data) override; |
| 54 void OnImageSelected(const std::string& image_url, | 54 void OnImageSelected(const std::string& image_url, |
| 55 const std::string& image_type, | 55 const std::string& image_type, |
| 56 bool is_user_selection) override; | 56 bool is_user_selection) override; |
| 57 void OnImageAccepted() override; | 57 void OnImageAccepted() override; |
| 58 void OnViewDestroyed(UserImageView* view) override; | 58 void OnViewDestroyed(UserImageView* view) override; |
| 59 | 59 |
| 60 // content::NotificationObserver implementation: | 60 // content::NotificationObserver implementation: |
| 61 void Observe(int type, | 61 void Observe(int type, |
| 62 const content::NotificationSource& source, | 62 const content::NotificationSource& source, |
| 63 const content::NotificationDetails& details) override; | 63 const content::NotificationDetails& details) override; |
| 64 | 64 |
| 65 // ImageDecoder::Delegate implementation: | 65 // ImageDecoder::ImageRequest implementation: |
| 66 void OnImageDecoded(const ImageDecoder* decoder, | 66 void OnImageDecoded(const SkBitmap& decoded_image) override; |
| 67 const SkBitmap& decoded_image) override; | 67 void OnDecodeImageFailed() override; |
| 68 void OnDecodeImageFailed(const ImageDecoder* decoder) override; | |
| 69 | 68 |
| 70 // CameraPresenceNotifier::Observer implementation: | 69 // CameraPresenceNotifier::Observer implementation: |
| 71 void OnCameraPresenceCheckDone(bool is_camera_present) override; | 70 void OnCameraPresenceCheckDone(bool is_camera_present) override; |
| 72 | 71 |
| 73 // UserImageSyncObserver::Observer implementation: | 72 // UserImageSyncObserver::Observer implementation: |
| 74 void OnInitialSync(bool local_image_updated) override; | 73 void OnInitialSync(bool local_image_updated) override; |
| 75 | 74 |
| 76 bool user_selected_image() const { return user_has_selected_image_; } | 75 bool user_selected_image() const { return user_has_selected_image_; } |
| 77 | 76 |
| 78 private: | 77 private: |
| (...skipping 22 matching lines...) Expand all Loading... |
| 101 | 100 |
| 102 // Closes the screen. | 101 // Closes the screen. |
| 103 void ExitScreen(); | 102 void ExitScreen(); |
| 104 | 103 |
| 105 content::NotificationRegistrar notification_registrar_; | 104 content::NotificationRegistrar notification_registrar_; |
| 106 | 105 |
| 107 scoped_ptr<policy::PolicyChangeRegistrar> policy_registrar_; | 106 scoped_ptr<policy::PolicyChangeRegistrar> policy_registrar_; |
| 108 | 107 |
| 109 UserImageView* view_; | 108 UserImageView* view_; |
| 110 | 109 |
| 111 // Last ImageDecoder instance used to decode an image blob received by | |
| 112 // HandlePhotoTaken. | |
| 113 scoped_refptr<ImageDecoder> image_decoder_; | |
| 114 | |
| 115 // Last user photo, if taken. | 110 // Last user photo, if taken. |
| 116 gfx::ImageSkia user_photo_; | 111 gfx::ImageSkia user_photo_; |
| 117 | 112 |
| 118 // If |true|, decoded photo should be immediately accepeted (i.e., both | 113 // If |true|, decoded photo should be immediately accepeted (i.e., both |
| 119 // HandleTakePhoto and HandleImageAccepted have already been called but we're | 114 // HandleTakePhoto and HandleImageAccepted have already been called but we're |
| 120 // still waiting for photo image decoding to finish. | 115 // still waiting for photo image decoding to finish. |
| 121 bool accept_photo_after_decoding_; | 116 bool accept_photo_after_decoding_; |
| 122 | 117 |
| 123 // Index of the selected user image. | 118 // Index of the selected user image. |
| 124 int selected_image_; | 119 int selected_image_; |
| 125 | 120 |
| 126 // Timer used for waiting for user image sync. | 121 // Timer used for waiting for user image sync. |
| 127 scoped_ptr<base::Timer> sync_timer_; | 122 scoped_ptr<base::Timer> sync_timer_; |
| 128 | 123 |
| 129 // If screen ready to be shown. | 124 // If screen ready to be shown. |
| 130 bool is_screen_ready_; | 125 bool is_screen_ready_; |
| 131 | 126 |
| 132 // True if user has explicitly selected some image. | 127 // True if user has explicitly selected some image. |
| 133 bool user_has_selected_image_; | 128 bool user_has_selected_image_; |
| 134 | 129 |
| 135 DISALLOW_COPY_AND_ASSIGN(UserImageScreen); | 130 DISALLOW_COPY_AND_ASSIGN(UserImageScreen); |
| 136 }; | 131 }; |
| 137 | 132 |
| 138 } // namespace chromeos | 133 } // namespace chromeos |
| 139 | 134 |
| 140 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_ | 135 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_ |
| OLD | NEW |