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

Unified Diff: chrome/browser/views/html_dialog_view.cc

Issue 220011: There is a race condition when the HtmlDialogView is closed which causes a cr... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/html_dialog_view.cc
===================================================================
--- chrome/browser/views/html_dialog_view.cc (revision 26676)
+++ chrome/browser/views/html_dialog_view.cc (working copy)
@@ -12,7 +12,7 @@
namespace browser {
-// Declared in browser_dialogs.h so that others don't need to depend on our .h.
+// Declared in browser_dialogs.h so that others don't need to depend on our .h.
void ShowHtmlDialogView(gfx::NativeWindow parent, Browser* browser,
HtmlDialogUIDelegate* delegate) {
HtmlDialogView* html_view = new HtmlDialogView(browser, delegate);
@@ -43,7 +43,8 @@
gfx::Size HtmlDialogView::GetPreferredSize() {
gfx::Size out;
- delegate_->GetDialogSize(&out);
+ if (delegate_)
+ delegate_->GetDialogSize(&out);
return out;
}
@@ -55,11 +56,17 @@
}
bool HtmlDialogView::IsModal() const {
- return delegate_->IsDialogModal();
+ if (delegate_)
+ return delegate_->IsDialogModal();
+ else
+ return false;
}
std::wstring HtmlDialogView::GetWindowTitle() const {
- return delegate_->GetDialogTitle();
+ if (delegate_)
+ return delegate_->GetDialogTitle();
+ else
+ return std::wstring();
}
void HtmlDialogView::WindowClosing() {
@@ -90,25 +97,34 @@
}
GURL HtmlDialogView::GetDialogContentURL() const {
- return delegate_->GetDialogContentURL();
+ if (delegate_)
+ return delegate_->GetDialogContentURL();
+ else
+ return GURL();
}
void HtmlDialogView::GetDOMMessageHandlers(
std::vector<DOMMessageHandler*>* handlers) const {
- delegate_->GetDOMMessageHandlers(handlers);
+ if (delegate_)
+ delegate_->GetDOMMessageHandlers(handlers);
}
void HtmlDialogView::GetDialogSize(gfx::Size* size) const {
- delegate_->GetDialogSize(size);
+ if (delegate_)
+ delegate_->GetDialogSize(size);
}
std::string HtmlDialogView::GetDialogArgs() const {
- return delegate_->GetDialogArgs();
+ if (delegate_)
+ return delegate_->GetDialogArgs();
+ else
+ return std::string();
}
void HtmlDialogView::OnDialogClosed(const std::string& json_retval) {
- delegate_->OnDialogClosed(json_retval);
+ HtmlDialogUIDelegate* dialog_delegate = delegate_;
delegate_ = NULL; // We will not communicate further with the delegate.
+ dialog_delegate->OnDialogClosed(json_retval);
window()->Close();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698