user_image_screen_actor.h revision effb81e5f8246d0db0270817048dc992db66e9fb
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#include "chrome/browser/chromeos/camera_presence_notifier.h" 11 12class SkBitmap; 13 14namespace gfx { 15class ImageSkia; 16} 17 18namespace chromeos { 19 20// Interface for dependency injection between UserImageScreen and its actual 21// representation, either views based or WebUI. 22class UserImageScreenActor { 23 public: 24 class Delegate : public CameraPresenceNotifier::Observer { 25 public: 26 virtual ~Delegate() {} 27 28 // CameraPresenceNotifier::Observer implementation: 29 virtual void OnCameraPresenceCheckDone(bool is_camera_present) = 0; 30 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; 35 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; 43 44 // Called when actor is destroyed so there's no dead reference to it. 45 virtual void OnActorDestroyed(UserImageScreenActor* actor) = 0; 46 47 virtual bool profile_picture_absent() = 0; 48 virtual int selected_image() = 0; 49 virtual std::string profile_picture_data_url() = 0; 50 51 }; 52 53 virtual ~UserImageScreenActor() {} 54 55 // Sets screen this actor belongs to. 56 virtual void SetDelegate(Delegate* screen) = 0; 57 58 // Prepare the contents to showing. 59 virtual void PrepareToShow() = 0; 60 61 // Shows the contents of the screen. 62 virtual void Show() = 0; 63 64 // Hides the contents of the screen. 65 virtual void Hide() = 0; 66 67 // Selects image with the index specified. 68 virtual void SelectImage(int index) = 0; 69 70 // Sends profile image as a data URL to the page. 71 virtual void SendProfileImage(const std::string& data_url) = 0; 72 73 // Indicates that there is no custom profile image for the user. 74 virtual void OnProfileImageAbsent() = 0; 75 76 // Enables or disables profile picture. 77 virtual void SetProfilePictureEnabled(bool enabled) = 0; 78 79 // Sends result of camera check 80 virtual void SetCameraPresent(bool enabled) = 0; 81 82 // Hides curtain with spinner. 83 virtual void HideCurtain() = 0; 84}; 85 86} // namespace chromeos 87 88#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_ACTOR_H_ 89