Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(889)

Side by Side Diff: chrome/browser/ui/user_manager.h

Issue 2351173004: Display local signin error without browser and record the path of selected profile in user manager. (Closed)
Patch Set: cr+fix trybot Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_USER_MANAGER_H_ 5 #ifndef CHROME_BROWSER_UI_USER_MANAGER_H_
6 #define CHROME_BROWSER_UI_USER_MANAGER_H_ 6 #define CHROME_BROWSER_UI_USER_MANAGER_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "chrome/browser/profiles/profile_window.h" 10 #include "chrome/browser/profiles/profile_window.h"
11 #include "components/signin/core/browser/signin_metrics.h" 11 #include "components/signin/core/browser/signin_metrics.h"
12 #include "content/public/browser/web_contents_delegate.h" 12 #include "content/public/browser/web_contents_delegate.h"
13 13
14 namespace base { 14 namespace base {
15 class FilePath; 15 class FilePath;
16 } 16 }
17 17
18 // Cross-platform methods for displaying the user manager. 18 // Cross-platform methods for displaying the user manager.
19 class UserManager { 19 class UserManager {
20 public: 20 public:
21 // TODO(noms): Figure out if this size can be computed dynamically or adjusted
22 // for smaller screens.
23 static const int kWindowWidth = 800;
24 static const int kWindowHeight = 600;
25
26 // Dimensions of the reauth dialog displaying the old-style signin flow with
27 // the username and password challenge on the same form.
28 static const int kPasswordCombinedReauthDialogHeight = 440;
29 static const int kPasswordCombinedReauthDialogWidth = 360;
30
31 // Dimensions of the reauth dialog displaying the password-separated signin
32 // flow.
33 static const int kReauthDialogHeight = 512;
34 static const int kReauthDialogWidth = 448;
35
21 // Shows the User Manager or re-activates an existing one, focusing the 36 // Shows the User Manager or re-activates an existing one, focusing the
22 // profile given by |profile_path_to_focus|; passing an empty base::FilePath 37 // profile given by |profile_path_to_focus|; passing an empty base::FilePath
23 // focuses no user pod. Based on the value of |tutorial_mode|, a tutorial 38 // focuses no user pod. Based on the value of |tutorial_mode|, a tutorial
24 // could be shown, in which case |profile_path_to_focus| is ignored. After a 39 // could be shown, in which case |profile_path_to_focus| is ignored. After a
25 // profile is opened, executes the |profile_open_action|. 40 // profile is opened, executes the |profile_open_action|.
26 static void Show(const base::FilePath& profile_path_to_focus, 41 static void Show(const base::FilePath& profile_path_to_focus,
27 profiles::UserManagerTutorialMode tutorial_mode, 42 profiles::UserManagerTutorialMode tutorial_mode,
28 profiles::UserManagerProfileSelected profile_open_action); 43 profiles::UserManagerProfileSelected profile_open_action);
29 44
30 // Hides the User Manager. 45 // Hides the User Manager.
(...skipping 17 matching lines...) Expand all
48 // reauthenticated. 63 // reauthenticated.
49 // |reason| can be REASON_UNLOCK or REASON_REAUTHENTICATION to indicate 64 // |reason| can be REASON_UNLOCK or REASON_REAUTHENTICATION to indicate
50 // whether this is a reauth or unlock scenario. 65 // whether this is a reauth or unlock scenario.
51 static void ShowReauthDialog(content::BrowserContext* browser_context, 66 static void ShowReauthDialog(content::BrowserContext* browser_context,
52 const std::string& email, 67 const std::string& email,
53 signin_metrics::Reason reason); 68 signin_metrics::Reason reason);
54 69
55 // Hides the reauth dialog if it is showing. 70 // Hides the reauth dialog if it is showing.
56 static void HideReauthDialog(); 71 static void HideReauthDialog();
57 72
58 // TODO(noms): Figure out if this size can be computed dynamically or adjusted 73 #if !defined(OS_MACOSX)
59 // for smaller screens. 74 // Shows a dialog where the user login his or her profile by the first time
60 static const int kWindowWidth = 800; 75 // via user manager.
61 static const int kWindowHeight = 600; 76 static void ShowSigninDialog(content::BrowserContext* browser_context,
77 const base::FilePath& profile_path);
62 78
63 // Dimensions of the reauth dialog displaying the old-style signin flow with 79 // Display local sign in error message without browser.
64 // the username and password challenge on the same form. 80 static void DisplayErrorMessage();
65 static const int kPasswordCombinedReauthDialogHeight = 440;
66 static const int kPasswordCombinedReauthDialogWidth = 360;
67 81
68 // Dimensions of the reauth dialog displaying the password-separated signin 82 // Get the path of profile that is being signed in.
69 // flow. 83 static base::FilePath GetSigninProfilePath();
70 static const int kReauthDialogHeight = 512; 84 #endif
71 static const int kReauthDialogWidth = 448;
72 85
73 // Abstract base class for performing online reauthentication of profiles in 86 // Abstract base class for performing online reauthentication of profiles in
74 // the User Manager. It is concretely implemented in UserManagerMac and 87 // the User Manager. It is concretely implemented in UserManagerMac and
75 // UserManagerView to specialize the closing of the UI's dialog widgets. 88 // UserManagerView to specialize the closing of the UI's dialog widgets.
76 class BaseReauthDialogDelegate : public content::WebContentsDelegate { 89 class BaseReauthDialogDelegate : public content::WebContentsDelegate {
77 public: 90 public:
78 BaseReauthDialogDelegate(); 91 BaseReauthDialogDelegate();
79 92
80 // content::WebContentsDelegate: 93 // content::WebContentsDelegate:
81 bool HandleContextMenu(const content::ContextMenuParams& params) override; 94 bool HandleContextMenu(const content::ContextMenuParams& params) override;
82 95
83 // content::WebContentsDelegate: 96 // content::WebContentsDelegate:
84 void LoadingStateChanged(content::WebContents* source, 97 void LoadingStateChanged(content::WebContents* source,
85 bool to_different_document) override; 98 bool to_different_document) override;
86 99
87 private: 100 private:
88 virtual void CloseReauthDialog() = 0; 101 virtual void CloseReauthDialog() = 0;
89 102
90 // WebContents of the embedded WebView. 103 // WebContents of the embedded WebView.
91 content::WebContents* guest_web_contents_; 104 content::WebContents* guest_web_contents_;
92 105
93 DISALLOW_COPY_AND_ASSIGN(BaseReauthDialogDelegate); 106 DISALLOW_COPY_AND_ASSIGN(BaseReauthDialogDelegate);
94 }; 107 };
95 108
96 private: 109 private:
97 DISALLOW_COPY_AND_ASSIGN(UserManager); 110 DISALLOW_COPY_AND_ASSIGN(UserManager);
98 }; 111 };
99 112
100 #endif // CHROME_BROWSER_UI_USER_MANAGER_H_ 113 #endif // CHROME_BROWSER_UI_USER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698