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. 4 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_ 7 8 #include <string> 9 10 class SkBitmap; 11 12 namespace gfx { 13 class ImageSkia; 14 } 15 16 namespace chromeos { 17 18 // Interface for dependency injection between UserImageScreen and its actual 19 // representation, either views based or WebUI. 20 class UserImageScreenActor { 21 public: 22 class Delegate { 23 public: 24 virtual ~Delegate() {} 25 26 // Called when UI ready to be shown. 27 virtual void OnScreenReady() = 0; 28 // Called when user accepts photo as login user image. 29 virtual void OnPhotoTaken(const std::string& raw_data) = 0; 30 31 // Called when some image was selected. |is_user_selection| indicates if 32 // it was user selection or image was selected programmatically. 33 virtual void OnImageSelected(const std::string& image_url, 34 const std::string& image_type, 35 bool is_user_selection) = 0; 36 // Called when user accepts currently selected image 37 virtual void OnImageAccepted() = 0; 38 39 // Called when actor is destroyed so there's no dead reference to it. 40 virtual void OnActorDestroyed(UserImageScreenActor* actor) = 0; 41 42 virtual bool profile_picture_absent() = 0; 43 virtual int selected_image() = 0; 44 virtual std::string profile_picture_data_url() = 0; 45 46 }; 47 48 virtual ~UserImageScreenActor() {} 49 50 // Sets screen this actor belongs to. 51 virtual void SetDelegate(Delegate* screen) = 0; 52 53 // Prepare the contents to showing. 54 virtual void PrepareToShow() = 0; 55 56 // Shows the contents of the screen. 57 virtual void Show() = 0; 58 59 // Hides the contents of the screen. 60 virtual void Hide() = 0; 61 62 // Selects image with the index specified. 63 virtual void SelectImage(int index) = 0; 64 65 // Sends profile image as a data URL to the page. 66 virtual void SendProfileImage(const std::string& data_url) = 0; 67 68 // Indicates that there is no custom profile image for the user. 69 virtual void OnProfileImageAbsent() = 0; 70 71 // Sends result of camera check 72 virtual void SetCameraPresent(bool enabled) = 0; 73 74 // Hides curtain with spinner. 75 virtual void HideCurtain() = 0; 76 }; 77 78 } // namespace chromeos 79 80 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_ 81