OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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_UI_VIEWS_PROFILES_FORCED_REAUTHENTICATION_DIALOG_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_FORCED_REAUTHENTICATION_DIALOG_H_ | |
7 | |
8 #include <memory> | |
9 #include <string> | |
10 | |
11 #include "base/callback.h" | |
12 #include "base/macros.h" | |
13 #include "base/timer/timer.h" | |
14 #include "ui/views/controls/button/button.h" | |
15 #include "ui/views/window/dialog_delegate.h" | |
16 | |
17 class Browser; | |
18 class Profile; | |
19 class SigninManager; | |
20 | |
21 // A modal dialog that displays a warning message of the auth failure | |
22 // and ask user to sign in again. | |
23 class ForcedReauthenticationDialog : public views::DialogDelegateView { | |
24 public: | |
25 ~ForcedReauthenticationDialog() override; | |
26 | |
27 // Shows a warning dialog for |profile|. If there are no Browser windows | |
28 // associated with |profile|, signs out the profile immediately, otherwise the | |
29 // user can clicks accept to sign in again. Dialog will be closed after | |
30 // |countdown_duration| seconds. | |
31 // Dialog will delete itself after closing. | |
32 static ForcedReauthenticationDialog* ShowDialog(Profile* profile, | |
33 SigninManager* signin_manager, | |
34 int countdown_duration); | |
sky
2017/06/07 20:37:59
Use TimeDelta, it's less ambiguous as to what the
zmin
2017/06/07 20:56:49
Done.
| |
35 | |
36 // override views::DialogDelegateView | |
37 bool Accept() override; | |
38 bool Cancel() override; | |
39 void WindowClosing() override; | |
40 base::string16 GetWindowTitle() const override; | |
41 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | |
42 ui::ModalType GetModalType() const override; | |
43 | |
44 // override views::View | |
45 void AddedToWidget() override; | |
46 | |
47 private: | |
48 // Show the dialog for |browser|. The dialog will delete itself after closing. | |
49 ForcedReauthenticationDialog(Browser* browser, | |
50 SigninManager* signin_manager, | |
51 int countdown_duration); | |
52 | |
53 void OnCountDown(); | |
54 base::TimeDelta GetTimeRemaining() const; | |
55 | |
56 Browser* browser_; | |
57 SigninManager* signin_manager_; | |
58 | |
59 base::TimeTicks desired_close_time_; | |
60 | |
61 // The timer which is used to refresh the dialog title to display the | |
62 // remaining time. | |
63 base::RepeatingTimer refresh_timer_; | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(ForcedReauthenticationDialog); | |
66 }; | |
67 | |
68 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_FORCED_REAUTHENTICATION_DIALOG_H_ | |
OLD | NEW |