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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_
10 #include "chrome/browser/chromeos/camera_presence_notifier.h"
20 // Interface for dependency injection between UserImageScreen and its actual
21 // representation, either views based or WebUI.
22 class UserImageScreenActor {
24 class Delegate : public CameraPresenceNotifier::Observer {
26 virtual ~Delegate() {}
28 // CameraPresenceNotifier::Observer implementation:
29 virtual void OnCameraPresenceCheckDone(bool is_camera_present) = 0;
31 // Called when UI ready to be shown.
32 virtual void OnScreenReady() = 0;
33 // Called when user accepts photo as login user image.
34 virtual void OnPhotoTaken(const std::string& raw_data) = 0;
36 // Called when some image was selected. |is_user_selection| indicates if
37 // it was user selection or image was selected programmatically.
38 virtual void OnImageSelected(const std::string& image_url,
39 const std::string& image_type,
40 bool is_user_selection) = 0;
41 // Called when user accepts currently selected image
42 virtual void OnImageAccepted() = 0;
44 // Called when actor is destroyed so there's no dead reference to it.
45 virtual void OnActorDestroyed(UserImageScreenActor* actor) = 0;
47 virtual bool profile_picture_absent() = 0;
48 virtual int selected_image() = 0;
49 virtual std::string profile_picture_data_url() = 0;
53 virtual ~UserImageScreenActor() {}
55 // Sets screen this actor belongs to.
56 virtual void SetDelegate(Delegate* screen) = 0;
58 // Prepare the contents to showing.
59 virtual void PrepareToShow() = 0;
61 // Shows the contents of the screen.
62 virtual void Show() = 0;
64 // Hides the contents of the screen.
65 virtual void Hide() = 0;
67 // Selects image with the index specified.
68 virtual void SelectImage(int index) = 0;
70 // Sends profile image as a data URL to the page.
71 virtual void SendProfileImage(const std::string& data_url) = 0;
73 // Indicates that there is no custom profile image for the user.
74 virtual void OnProfileImageAbsent() = 0;
76 // Enables or disables profile picture.
77 virtual void SetProfilePictureEnabled(bool enabled) = 0;
79 // Sends result of camera check
80 virtual void SetCameraPresent(bool enabled) = 0;
82 // Hides curtain with spinner.
83 virtual void HideCurtain() = 0;
86 } // namespace chromeos
88 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_