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 <string> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "chrome/browser/ui/browser_list_observer.h" | |
| 13 #include "chrome/browser/ui/views/browser_modal_dialog.h" | |
| 14 | |
| 15 class Browser; | |
| 16 class ForceSignoutDialogView; | |
| 17 class Profile; | |
| 18 class SigninManager; | |
| 19 | |
| 20 // A modal dialog that displays a warning message of the auth failure | |
| 21 // before signing the user out and closing browser windows. | |
| 22 class ForceSignoutDialog : public BrowserModalDialog, | |
| 23 public chrome::BrowserListObserver { | |
| 24 public: | |
| 25 ForceSignoutDialog(Browser* browser, | |
| 26 SigninManager* signin_manager, | |
| 27 const base::Closure& signout_timer); | |
|
sky
2017/05/17 18:03:18
signout_closure? Also, document what 'browser' and
zmin
2017/05/18 03:31:18
Done.
| |
| 28 ~ForceSignoutDialog() override; | |
| 29 | |
| 30 // Show the warning dialog on the browser window that is belonged to the | |
|
sky
2017/05/17 18:03:18
How about:
Shows a warning dialog for |profile|.
zmin
2017/05/18 03:31:18
Done.
| |
| 31 // |profile|. Sign out the profile directly if there is no opened browser | |
| 32 // window or tabs. | |
| 33 // Sign out the profile if user confirmed the window or sign out the profile | |
| 34 // with a delay if signout_timer is set. | |
| 35 static ForceSignoutDialog* ShowDialog(Profile* profile, | |
| 36 SigninManager* signin_manager, | |
| 37 const base::Closure& signout_timer); | |
| 38 | |
| 39 // override BrowserModalDialog | |
| 40 void ActivateModalDialog(Browser* other_browser) override; | |
| 41 bool IsShowing() override; | |
| 42 | |
| 43 // override chrome::BrowserListObserver | |
| 44 void OnBrowserRemoved(Browser* browser) override; | |
| 45 | |
| 46 // Return true if SignoutTimer is set. | |
| 47 bool IsDelayAllowed(); | |
| 48 void OnAccept(); | |
| 49 void OnCancel(); | |
| 50 std::string GetEmail(); | |
| 51 void OnViewClosing(); | |
| 52 | |
| 53 ForceSignoutDialogView* GetDialogViewForTesting(); | |
| 54 | |
| 55 private: | |
| 56 Browser* browser_; | |
| 57 SigninManager* signin_manager_; | |
| 58 const base::Closure signout_timer_; | |
| 59 | |
| 60 ForceSignoutDialogView* dialog_view_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(ForceSignoutDialog); | |
| 63 }; | |
| 64 | |
| 65 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_FORCE_SIGNOUT_DIALOG_H_ | |
| OLD | NEW |