Chromium Code Reviews| 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_FORCE_SIGNOUT_DIALOG_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_FORCE_SIGNOUT_DIALOG_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 #include "base/macros.h" | |
| 13 #include "ui/views/controls/button/button.h" | |
| 14 #include "ui/views/window/dialog_delegate.h" | |
| 15 | |
| 16 namespace base { | |
| 17 class RepeatingTimer; | |
| 18 class TimeDelta; | |
| 19 class Timer; | |
| 20 } // namespace base | |
| 21 | |
| 22 class Browser; | |
| 23 class Profile; | |
| 24 class SigninManager; | |
| 25 | |
| 26 // A modal dialog that displays a warning message of the auth failure | |
| 27 // before signing the user out and closing browser windows. | |
| 28 class ForceSignoutDialog : public views::DialogDelegateView { | |
| 
 
sky
2017/06/05 23:43:18
WDYT of naming this ReauthenticateDialog?
 
zmin
2017/06/06 21:00:44
There're lots of different situations requires rea
 
sky
2017/06/06 23:10:39
ForcedReauthenticationDialog?
 
 | |
| 29 public: | |
| 30 // Show the dialog for |browser|, call signout_callback after the dialog is | |
| 
 
sky
2017/06/05 23:43:19
there is no signout_callback.
 
zmin
2017/06/06 21:00:43
Done.
 
 | |
| 31 // confirmed or canceled by user. | |
| 32 ForceSignoutDialog(Browser* browser, | |
| 
 
sky
2017/06/05 23:43:18
Does this function need to be public? Don't you wa
 
zmin
2017/06/06 21:00:43
Move it to private
 
 | |
| 33 SigninManager* signin_manager, | |
| 34 base::Timer* close_timer); | |
| 
 
sky
2017/06/05 23:43:18
Document ownership. Also, why does the caller need
 
zmin
2017/06/06 21:00:43
The |close_timer| is used to track the remaining t
 
sky
2017/06/06 23:10:39
I get that you want a close_timer, but why does it
 
 | |
| 35 ~ForceSignoutDialog() override; | |
| 36 | |
| 37 // Shows a warning dialog for |profile|. If there are no Browser windows | |
| 38 // associated with |profile| this signs out the profile immediately, otherwise | |
| 39 // the user clicks accept or cancel on the dialog. Sign out the profile if | |
| 40 // user confirmed the window or sign out the profile with a delay if | |
| 41 // |delay_allow| is true. Call |signout_callback| with false if user cancel | |
| 
 
sky
2017/06/05 23:43:18
There is no delay_allow or signout_callback.
 
zmin
2017/06/06 21:00:43
Done.
 
 | |
| 42 // the dialog, otherwise call it with true. | |
| 43 static ForceSignoutDialog* ShowDialog(Profile* profile, | |
| 
 
sky
2017/06/05 23:43:19
Document who owns the return value.
 
zmin
2017/06/06 21:00:43
Done.
 
 | |
| 44 SigninManager* signin_manager, | |
| 45 base::Timer* close_timer); | |
| 46 | |
| 47 // override views::DialogDelegateView | |
| 48 bool Accept() override; | |
| 49 bool Cancel() override; | |
| 50 void WindowClosing() override; | |
| 51 base::string16 GetWindowTitle() const override; | |
| 52 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | |
| 53 ui::ModalType GetModalType() const override; | |
| 54 | |
| 55 // override views::View | |
| 56 void AddedToWidget() override; | |
| 57 | |
| 58 private: | |
| 59 void OnCountDown(); | |
| 60 base::TimeDelta GetCountDownRemainTime() const; | |
| 
 
sky
2017/06/05 23:43:18
remaining?
optional: rename this GetTimeRemaining(
 
zmin
2017/06/06 21:00:44
Done.
 
 | |
| 61 | |
| 62 Browser* browser_; | |
| 63 SigninManager* signin_manager_; | |
| 64 base::Timer* close_timer_; | |
| 65 base::RepeatingTimer refresh_timer_; | |
| 
 
sky
2017/06/05 23:43:18
It's not obvious why you have two timers and is wo
 
zmin
2017/06/06 21:00:43
Done.
 
 | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(ForceSignoutDialog); | |
| 68 }; | |
| 69 | |
| 70 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_FORCE_SIGNOUT_DIALOG_H_ | |
| OLD | NEW |