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