#include "base/strings/string16.h"
#include "base/values.h"
-namespace gfx {
-class Image;
-}
class Profile;
// ScreenlockBridge brings together the screenLockPrivate API and underlying
// support. On ChromeOS, it delegates calls to the ScreenLocker. On other
// platforms, it delegates calls to UserManagerUI (and friends).
+// TODO(tbarzic): Rename ScreenlockBridge to SignInScreenBridge, as this is not
+// used solely for the lock screen anymore.
class ScreenlockBridge {
public:
class Observer {
virtual void OnScreenDidLock() = 0;
// Invoked after the screen lock is dismissed.
virtual void OnScreenDidUnlock() = 0;
+ // Invoked when the user focused on the lock screen changes.
+ virtual void OnFocusedUserChanged(const std::string& user_id) = 0;
protected:
virtual ~Observer() {}
};
// Sets the icon as chrome://theme resource URL.
void SetIconAsResourceURL(const std::string& url);
- // Sets the icon as a gfx::Image. The image will be converted to set of data
- // URLs for each icon representation. Use |SetIconAsResourceURL| instead of
- // this.
- // TODO(tbarzic): Remove this one once easy unlock app stops using
- // screenlockPrivate.showCustomIcon.
- void SetIconAsImage(const gfx::Image& image);
-
- // Sets the icon size. Has to be called if |SetIconAsResourceURL| was used
- // to set the icon. For animated icon, this should be set to a single frame
- // size, not the animation resource size.
+ // Sets the icon size. If not called, the icon will not be visible.
+ // For animated icon, this should be set to a single frame size, not the
+ // animation resource size.
void SetSize(size_t icon_width, size_t icon_height);
// If the icon is supposed to be animated, sets the animation parameters.
- // If set, it expects that the resource set using |SetIcon*| methods
- // contains horizontally arranged ordered list of animation frames.
+ // If set, it expects that the resource set using |SetIconAsResourceURL|
+ // method contains horizontally arranged ordered list of animation frames.
// Note that the icon size set in |SetSize| should be a single frame size.
// |resource_width|: Total animation resource width.
// |frame_length_ms|: Time for which a single animation frame is shown.
private:
std::string icon_resource_url_;
- scoped_ptr<gfx::Image> icon_image_;
size_t width_;
size_t height_;
// Unlock from easy unlock app for a user.
virtual void Unlock(const std::string& user_email) = 0;
+ // Attempts to login the user using an easy unlock key.
+ virtual void AttemptEasySignin(const std::string& user_email,
+ const std::string& secret,
+ const std::string& key_label) = 0;
+
protected:
virtual ~LockHandler() {}
};
static std::string GetAuthenticatedUserEmail(Profile* profile);
void SetLockHandler(LockHandler* lock_handler);
+ void SetFocusedUser(const std::string& user_id);
bool IsLocked() const;
void Lock(Profile* profile);
LockHandler* lock_handler() { return lock_handler_; }
+ std::string focused_user_id() const { return focused_user_id_; }
+
private:
friend struct base::DefaultLazyInstanceTraits<ScreenlockBridge>;
friend struct base::DefaultDeleter<ScreenlockBridge>;
~ScreenlockBridge();
LockHandler* lock_handler_; // Not owned
+ // The last focused user's id.
+ std::string focused_user_id_;
ObserverList<Observer, true> observers_;
DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge);