| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/profiles/profile_window.h" | 13 #include "chrome/browser/profiles/profile_window.h" |
| 14 #include "chrome/browser/ui/user_manager.h" | 14 #include "chrome/browser/ui/user_manager.h" |
| 15 #include "components/signin/core/browser/signin_metrics.h" | 15 #include "components/signin/core/browser/signin_metrics.h" |
| 16 #include "ui/views/controls/webview/webview.h" | 16 #include "ui/views/controls/webview/webview.h" |
| 17 #include "ui/views/window/dialog_delegate.h" | 17 #include "ui/views/window/dialog_delegate.h" |
| 18 | 18 |
| 19 class ScopedKeepAlive; | 19 class ScopedKeepAlive; |
| 20 class UserManagerView; | 20 class UserManagerView; |
| 21 | 21 |
| 22 // TODO(zmin): Rename the delgate as it's not only used to reauth now. |
| 22 class ReauthDelegate : public views::DialogDelegateView, | 23 class ReauthDelegate : public views::DialogDelegateView, |
| 23 public UserManager::BaseReauthDialogDelegate { | 24 public UserManager::BaseReauthDialogDelegate { |
| 24 public: | 25 public: |
| 25 ReauthDelegate(UserManagerView* parent, | 26 ReauthDelegate(UserManagerView* parent, |
| 26 views::WebView* web_view, | 27 views::WebView* web_view, |
| 27 const std::string& email_address, | 28 const std::string& email_address, |
| 28 signin_metrics::Reason reason); | 29 const GURL& url); |
| 29 ~ReauthDelegate() override; | 30 ~ReauthDelegate() override; |
| 30 | 31 |
| 31 // UserManager::BaseReauthDialogDelegate: | 32 // UserManager::BaseReauthDialogDelegate: |
| 32 void CloseReauthDialog() override; | 33 void CloseReauthDialog() override; |
| 33 | 34 |
| 34 // Display the local error message inside login window. | 35 // Display the local error message inside login window. |
| 35 void DisplayErrorMessage(); | 36 void DisplayErrorMessage(); |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 ReauthDelegate(); | 39 ReauthDelegate(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 const std::string& url); | 79 const std::string& url); |
| 79 | 80 |
| 80 void set_user_manager_started_showing( | 81 void set_user_manager_started_showing( |
| 81 const base::Time& user_manager_started_showing) { | 82 const base::Time& user_manager_started_showing) { |
| 82 user_manager_started_showing_ = user_manager_started_showing; | 83 user_manager_started_showing_ = user_manager_started_showing; |
| 83 } | 84 } |
| 84 | 85 |
| 85 // Logs how long it took the UserManager to open. | 86 // Logs how long it took the UserManager to open. |
| 86 void LogTimeToOpen(); | 87 void LogTimeToOpen(); |
| 87 | 88 |
| 88 // Shows a dialog where the user can re-authenticate the profile with the | 89 // Hides the reauth dialog if it is showing. |
| 89 // given |email|. This is called in the following scenarios: | 90 void HideDialog(); |
| 90 // -From the user manager when a profile is locked and the user's password is | |
| 91 // detected to have been changed. | |
| 92 // -From the user manager when a custodian account needs to be | |
| 93 // reauthenticated. | |
| 94 // reason| can be REASON_UNLOCK or REASON_REAUTHENTICATION to indicate | |
| 95 // whether this is a reauth or unlock scenario. | |
| 96 void ShowReauthDialog(content::BrowserContext* browser_context, | |
| 97 const std::string& email, | |
| 98 signin_metrics::Reason reason); | |
| 99 | 91 |
| 100 // Hides the reauth dialog if it is showing. | 92 // Show a dialog where the user can auth the profile or see the auth error |
| 101 void HideReauthDialog(); | 93 // message. |
| 94 void ShowDialog(content::BrowserContext* browser_context, |
| 95 const std::string& email, |
| 96 const GURL& url); |
| 102 | 97 |
| 103 // Display sign in error message that is created by Chrome but not GAIA | 98 // Display sign in error message that is created by Chrome but not GAIA |
| 104 // without browser window. | 99 // without browser window. |
| 105 void DisplayErrorMessage(); | 100 void DisplayErrorMessage(); |
| 106 | 101 |
| 107 // Setter and getter of the path of profile which is selected in user manager | 102 // Setter and getter of the path of profile which is selected in user manager |
| 108 // for first time signin. | 103 // for first time signin. |
| 109 void SetSigninProfilePath(const base::FilePath& profile_path); | 104 void SetSigninProfilePath(const base::FilePath& profile_path); |
| 110 base::FilePath GetSigninProfilePath(); | 105 base::FilePath GetSigninProfilePath(); |
| 111 | 106 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 140 | 135 |
| 141 std::unique_ptr<ScopedKeepAlive> keep_alive_; | 136 std::unique_ptr<ScopedKeepAlive> keep_alive_; |
| 142 base::Time user_manager_started_showing_; | 137 base::Time user_manager_started_showing_; |
| 143 | 138 |
| 144 base::FilePath signin_profile_path_; | 139 base::FilePath signin_profile_path_; |
| 145 | 140 |
| 146 DISALLOW_COPY_AND_ASSIGN(UserManagerView); | 141 DISALLOW_COPY_AND_ASSIGN(UserManagerView); |
| 147 }; | 142 }; |
| 148 | 143 |
| 149 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ | 144 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ |
| OLD | NEW |