• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 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_SCREEN_LOCKER_DELEGATE_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_DELEGATE_H_
7 
8 #include "base/callback_forward.h"
9 #include "base/strings/string16.h"
10 #include "chrome/browser/chromeos/login/help_app_launcher.h"
11 #include "ui/gfx/native_widget_types.h"
12 
13 class GURL;
14 
15 namespace content {
16 class WebUI;
17 }
18 
19 namespace gfx {
20 class Image;
21 }
22 
23 namespace chromeos {
24 
25 class ScreenLocker;
26 
27 // ScreenLockerDelegate takes care of displaying the lock screen UI.
28 class ScreenLockerDelegate {
29  public:
30   explicit ScreenLockerDelegate(ScreenLocker* screen_locker);
31   virtual ~ScreenLockerDelegate();
32 
33   // Initialize the screen locker delegate. This will call ScreenLockReady when
34   // done to notify ScreenLocker.
35   virtual void LockScreen() = 0;
36 
37   // Inform the screen locker that the screen has been locked
38   virtual void ScreenLockReady();
39 
40   // This function is called when ScreenLocker::Authenticate is called to
41   // attempt to authenticate with a given password.
42   virtual void OnAuthenticate() = 0;
43 
44   // Enable/disable password input.
45   virtual void SetInputEnabled(bool enabled) = 0;
46 
47   // Displays a banner containing |message| on the lock screen.
48   virtual void ShowBannerMessage(const std::string& message) = 0;
49 
50   // Shows a button inside the user pod on the lock screen with an icon.
51   virtual void ShowUserPodButton(const std::string& username,
52                                  const std::string& iconURL,
53                                  const base::Closure& click_callback) = 0;
54 
55   // Disables all UI needed and shows error bubble with |message|.
56   // If |sign_out_only| is true then all other input except "Sign Out"
57   // button is blocked.
58   virtual void ShowErrorMessage(
59       int error_msg_id,
60       HelpAppLauncher::HelpTopic help_topic_id) = 0;
61 
62   // Close message bubble to clear error messages.
63   virtual void ClearErrors() = 0;
64 
65   // Allows to have visual effects once unlock authentication is successful,
66   // Must call ScreenLocker::UnlockOnLoginSuccess() once all effects are done.
67   virtual void AnimateAuthenticationSuccess() = 0;
68 
69   // Returns the native window displaying the lock screen.
70   virtual gfx::NativeWindow GetNativeWindow() const = 0;
71 
72   // Returns WebUI associated with screen locker implementation or NULL if
73   // there isn't one.
74   virtual content::WebUI* GetAssociatedWebUI();
75 
76   // Called when webui lock screen is ready.
77   virtual void OnLockWebUIReady() = 0;
78 
79   // Called when webui lock screen wallpaper is loaded and displayed.
80   virtual void OnLockBackgroundDisplayed() = 0;
81 
82   // Returns screen locker associated with delegate.
screen_locker()83   ScreenLocker* screen_locker() { return screen_locker_; }
84 
85  protected:
86   // ScreenLocker that owns this delegate.
87   ScreenLocker* screen_locker_;
88 
89   DISALLOW_COPY_AND_ASSIGN(ScreenLockerDelegate);
90 };
91 
92 }  // namespace chromeos
93 
94 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_DELEGATE_H_
95