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

Unified Diff: chrome/browser/ui/views/login_prompt_views.cc

Issue 12276010: Factor out uses of the WebContentsModalDialog interface from platform-independent code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove incorrect override Created 7 years, 10 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/login_prompt_views.cc
diff --git a/chrome/browser/ui/views/login_prompt_views.cc b/chrome/browser/ui/views/login_prompt_views.cc
index aa026ee1647a07a5edfb0c0a05c3c4a206261e0b..8ae11a8d998c93012b0576be1882d9abe485040d 100644
--- a/chrome/browser/ui/views/login_prompt_views.cc
+++ b/chrome/browser/ui/views/login_prompt_views.cc
@@ -35,7 +35,8 @@ class LoginHandlerViews : public LoginHandler,
public:
LoginHandlerViews(net::AuthChallengeInfo* auth_info, net::URLRequest* request)
: LoginHandler(auth_info, request),
- login_view_(NULL) {
+ login_view_(NULL),
+ dialog_(NULL) {
}
// LoginModelObserver implementation.
@@ -64,7 +65,7 @@ class LoginHandlerViews : public LoginHandler,
tab->GetRenderViewHost()->SetIgnoreInputEvents(false);
// Reference is no longer valid.
- SetDialog(NULL);
+ dialog_ = NULL;
CancelAuth();
}
@@ -73,7 +74,7 @@ class LoginHandlerViews : public LoginHandler,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// The constrained window is going to delete itself; clear our pointer.
- SetDialog(NULL);
+ dialog_ = NULL;
SetModel(NULL);
ReleaseSoon();
@@ -135,10 +136,16 @@ class LoginHandlerViews : public LoginHandler,
// will occur via an InvokeLater on the UI thread, which is guaranteed
// to happen after this is called (since this was InvokeLater'd first).
WebContents* requesting_contents = GetWebContentsForLogin();
- SetDialog(ConstrainedWindowViews::Create(requesting_contents, this));
+ dialog_ = ConstrainedWindowViews::Create(requesting_contents, this);
NotifyAuthNeeded();
}
+ virtual void CloseDialog() OVERRIDE {
+ // The hosting WebContentsModalDialog may have been freed.
+ if (dialog_)
+ dialog_->CloseWebContentsModalDialog();
+ }
+
private:
friend class base::RefCountedThreadSafe<LoginHandlerViews>;
friend class LoginPrompt;
@@ -148,6 +155,8 @@ class LoginHandlerViews : public LoginHandler,
// The LoginView that contains the user's login information
LoginView* login_view_;
+ ConstrainedWindowViews* dialog_;
+
DISALLOW_COPY_AND_ASSIGN(LoginHandlerViews);
};

Powered by Google App Engine
This is Rietveld 408576698