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 user accepts photo as login user image. 27 virtual void OnPhotoTaken(const std::string& raw_data) = 0; 28 // Called to check camera presence. 29 virtual void CheckCameraPresence() = 0; 30 // Called when user selects some image 31 virtual void OnImageSelected(const std::string& image_url, 32 const std::string& image_type) = 0; 33 // Called when user accepts currently selected image 34 virtual void OnImageAccepted() = 0; 35 36 // Called when actor is destroyed so there's no dead reference to it. 37 virtual void OnActorDestroyed(UserImageScreenActor* actor) = 0; 38 39 virtual bool profile_picture_absent() = 0; 40 virtual int selected_image() = 0; 41 virtual std::string profile_picture_data_url() = 0; 42 43 }; 44 45 virtual ~UserImageScreenActor() {} 46 47 // Sets screen this actor belongs to. 48 virtual void SetDelegate(Delegate* screen) = 0; 49 50 // Prepare the contents to showing. 51 virtual void PrepareToShow() = 0; 52 53 // Shows the contents of the screen. 54 virtual void Show() = 0; 55 56 // Hides the contents of the screen. 57 virtual void Hide() = 0; 58 59 // Selects image with the index specified. 60 virtual void SelectImage(int index) = 0; 61 62 // Sends profile image as a data URL to the page. 63 virtual void SendProfileImage(const std::string& data_url) = 0; 64 65 // Indicates that there is no custom profile image for the user. 66 virtual void OnProfileImageAbsent() = 0; 67 68 // Enables or disables profile picture. 69 virtual void SetProfilePictureEnabled(bool enabled) = 0; 70 71 // Sends result of camera check 72 virtual void SetCameraPresent(bool enabled) = 0; 73 }; 74 75 } // namespace chromeos 76 77 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_ 78