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

Unified Diff: chrome/browser/ui/views/profiles/forced_reauthentication_dialog.cc

Issue 2944713003: After signin token check failed, show force reauth dialog and start window closing countdown. (Closed)
Patch Set: delegate Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/profiles/forced_reauthentication_dialog.cc
diff --git a/chrome/browser/ui/views/profiles/forced_reauthentication_dialog.cc b/chrome/browser/ui/views/profiles/forced_reauthentication_dialog.cc
index d02b9265849fc78e230351abdbc301786206f4d5..7af677ca0419df01769c2ca53d65b187cc34064c 100644
--- a/chrome/browser/ui/views/profiles/forced_reauthentication_dialog.cc
+++ b/chrome/browser/ui/views/profiles/forced_reauthentication_dialog.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/views/profiles/forced_reauthentication_dialog.h"
+#include <map>
#include <memory>
#include <string>
#include <utility>
@@ -15,6 +16,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/forced_reauthentication_dialog_delegate.h"
#include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
@@ -85,10 +87,11 @@ class PromptLabel : public views::StyledLabel {
ForcedReauthenticationDialog::ForcedReauthenticationDialog(
Browser* browser,
SigninManager* signin_manager,
- const base::TimeDelta& countdown_duration)
+ base::TimeDelta countdown_duration)
: browser_(browser),
signin_manager_(signin_manager),
- desired_close_time_(base::TimeTicks::Now() + countdown_duration) {
+ desired_close_time_(base::TimeTicks::Now() + countdown_duration),
+ weak_factory_(this) {
constrained_window::CreateBrowserModalDialogViews(
this, browser->window()->GetNativeWindow())
->Show();
@@ -102,7 +105,7 @@ ForcedReauthenticationDialog::~ForcedReauthenticationDialog() {}
ForcedReauthenticationDialog* ForcedReauthenticationDialog::ShowDialog(
Profile* profile,
SigninManager* signin_manager,
- const base::TimeDelta& countdown_duration) {
+ base::TimeDelta countdown_duration) {
Browser* browser = FindBrowserWithProfile(profile);
if (browser == nullptr) { // If there is no browser, we can just sign
// out profile directly.
@@ -234,6 +237,10 @@ void ForcedReauthenticationDialog::AddedToWidget() {
&ForcedReauthenticationDialog::OnCountDown);
}
+void ForcedReauthenticationDialog::CloseDialog() {
+ GetWidget()->Close();
+}
+
void ForcedReauthenticationDialog::OnCountDown() {
if (desired_close_time_ <= base::TimeTicks::Now()) {
Cancel();
@@ -248,3 +255,20 @@ base::TimeDelta ForcedReauthenticationDialog::GetTimeRemaining() const {
return base::TimeDelta();
return desired_close_time_ - now;
}
+
+ForcedReauthenticationDialogDelegate::ForcedReauthenticationDialogDelegate() {}
+ForcedReauthenticationDialogDelegate::~ForcedReauthenticationDialogDelegate() {}
+
+void ForcedReauthenticationDialogDelegate::ShowDialog(
+ Profile* profile,
+ SigninManager* signin_manager,
+ base::TimeDelta countdown_duration) {
+ dialog_ = ForcedReauthenticationDialog::ShowDialog(profile, signin_manager,
+ countdown_duration)
+ ->AsWeakPtr();
+}
+
+void ForcedReauthenticationDialogDelegate::CloseDialog() {
+ if (dialog_)
+ dialog_->CloseDialog();
+}

Powered by Google App Engine
This is Rietveld 408576698