Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / user_manager.h
blob81021cafd849f5182a5916364dff1b9bc8baa02b
1 // Copyright (c) 2014 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.
5 #ifndef CHROME_BROWSER_UI_USER_MANAGER_H_
6 #define CHROME_BROWSER_UI_USER_MANAGER_H_
8 #include "chrome/browser/profiles/profile_window.h"
10 namespace base {
11 class FilePath;
14 // Cross-platform methods for displaying the user manager.
15 class UserManager {
16 public:
17 // Shows the User Manager or re-activates an existing one, focusing the
18 // profile given by |profile_path_to_focus|; passing an empty base::FilePath
19 // focuses no user pod. Based on the value of |tutorial_mode|, a tutorial
20 // could be shown, in which case |profile_path_to_focus| is ignored. After a
21 // profile is opened, executes the |profile_open_action|.
22 static void Show(const base::FilePath& profile_path_to_focus,
23 profiles::UserManagerTutorialMode tutorial_mode,
24 profiles::UserManagerProfileSelected profile_open_action);
26 // Hides the User Manager.
27 static void Hide();
29 // Returns whether the User Manager is showing.
30 static bool IsShowing();
32 // To be called once the User Manager's contents are showing.
33 static void OnUserManagerShown();
35 // Shows a dialog where the user can re-authenticate when their profile is
36 // not yet open. This is called from the user manager when a profile is
37 // locked and it has detected that the user's password has changed since the
38 // profile was locked.
39 static void ShowReauthDialog(content::BrowserContext* browser_context,
40 const std::string& email);
42 // TODO(noms): Figure out if this size can be computed dynamically or adjusted
43 // for smaller screens.
44 static const int kWindowWidth = 800;
45 static const int kWindowHeight = 600;
47 static const int kReauthDialogWidth = 360;
48 static const int kReauthDialogHeight = 440;
50 // This class observes the WebUI used in the UserManager to perform online
51 // reauthentication of locked profiles. Its concretely implemented in
52 // UserManagerMac and UserManagerView to specialize the closing of the UI's
53 // dialog widget.
54 class ReauthDialogObserver : public content::WebContentsObserver {
55 public:
56 ReauthDialogObserver(content::WebContents* web_contents,
57 const std::string& email_address);
58 ~ReauthDialogObserver() override {}
60 private:
61 // content::WebContentsObserver:
62 void DidStopLoading() override;
64 virtual void CloseReauthDialog() = 0;
66 const std::string email_address_;
68 DISALLOW_COPY_AND_ASSIGN(ReauthDialogObserver);
71 private:
72 DISALLOW_COPY_AND_ASSIGN(UserManager);
75 #endif // CHROME_BROWSER_UI_USER_MANAGER_H_